Documentation
¶
Overview ¶
Package chatloaders implements chat session loaders, mirroring langchain-core's chat_loaders module. A chat loader produces chat sessions from a source such as a messenger export or a database.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChatLoader ¶
type ChatLoader interface {
// Load returns all chat sessions.
Load(ctx context.Context) ([]ChatSession, error)
// LoadRange returns chat sessions, optionally limited by range.
LoadRange(ctx context.Context, offset, limit int) ([]ChatSession, error)
// LoadLazy returns chat sessions lazily via a channel.
LoadLazy(ctx context.Context) (<-chan ChatSession, error)
}
ChatLoader loads chat sessions from a source.
type ChatLoaderFunc ¶
type ChatLoaderFunc func(ctx context.Context) ([]ChatSession, error)
ChatLoaderFunc adapts a function into a ChatLoader.
func (ChatLoaderFunc) Load ¶
func (f ChatLoaderFunc) Load(ctx context.Context) ([]ChatSession, error)
Load implements ChatLoader.
func (ChatLoaderFunc) LoadLazy ¶
func (f ChatLoaderFunc) LoadLazy(ctx context.Context) (<-chan ChatSession, error)
LoadLazy implements ChatLoader.
func (ChatLoaderFunc) LoadRange ¶
func (f ChatLoaderFunc) LoadRange(ctx context.Context, offset, limit int) ([]ChatSession, error)
LoadRange implements ChatLoader.
type ChatSession ¶
type ChatSession struct {
// Messages in chronological order.
Messages []Message
}
ChatSession is an ordered list of messages representing one conversation.
type InMemory ¶
type InMemory struct {
Sessions []ChatSession
}
InMemory is a ChatLoader backed by a static slice.
func (*InMemory) Load ¶
func (m *InMemory) Load(_ context.Context) ([]ChatSession, error)
Load implements ChatLoader.
Click to show internal directories.
Click to hide internal directories.