Documentation
¶
Index ¶
- type Agent
- type Chain
- type Hooks
- func (h Hooks) AgentAction(ctx context.Context, action llm.AgentAction)
- func (h Hooks) AgentFinish(ctx context.Context, finish llm.AgentFinish)
- func (h Hooks) AgentHooks() llm.AgentHooks
- func (h Hooks) ChainEnd(ctx context.Context, out map[string]any)
- func (h Hooks) ChainError(ctx context.Context, err error)
- func (h Hooks) ChainHooks() llm.ChainHooks
- func (h Hooks) ChainStart(ctx context.Context, in map[string]any)
- func (h Hooks) ProviderError(ctx context.Context, err error)
- func (h Hooks) ProviderGenerateContentEnd(ctx context.Context, res *llm.ContentResponse)
- func (h Hooks) ProviderGenerateContentStart(ctx context.Context, messages []llm.Message)
- func (h Hooks) ProviderStart(ctx context.Context, prompts []string)
- func (h Hooks) RetrieverEnd(ctx context.Context, query string, docs []llm.Document)
- func (h Hooks) RetrieverStart(ctx context.Context, query string)
- func (h Hooks) StreamingFunc(ctx context.Context, chunk []byte)
- func (h Hooks) ToolEnd(ctx context.Context, out string)
- func (h Hooks) ToolError(ctx context.Context, err error)
- func (h Hooks) ToolStart(ctx context.Context, in string)
- type Memory
- func (m Memory) Clear(ctx context.Context) error
- func (m Memory) LoadVariables(ctx context.Context, in map[string]any) (map[string]any, error)
- func (m Memory) MemoryKey(ctx context.Context) string
- func (m Memory) SaveContext(ctx context.Context, in map[string]any, out map[string]any) error
- func (m Memory) Variables(ctx context.Context) []string
- type Provider
- type VectorStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct {
ToolsFunc func() []llm.AgentTool
InputKeysFunc func() []string
OutputKeysFunc func() []string
PlanFunc func(context.Context, []llm.AgentStep, map[string]string) ([]llm.AgentAction, *llm.AgentFinish, error)
}
func (Agent) OutputKeys ¶
type Chain ¶
type Chain struct {
CallFunc func(context.Context, map[string]any, ...llm.ChainOption) (map[string]any, error)
MemoryFunc func() llm.Memory
InputKeysFunc func() []string
OutputKeysFunc func() []string
ChainHooksFunc func() llm.ChainHooks
}
func (Chain) ChainHooks ¶
func (c Chain) ChainHooks() llm.ChainHooks
func (Chain) OutputKeys ¶
type Hooks ¶
type Hooks struct {
StreamingFuncFunc func(ctx context.Context, chunk []byte)
AgentActionFunc func(ctx context.Context, action llm.AgentAction)
AgentFinishFunc func(ctx context.Context, finish llm.AgentFinish)
ChainStartFunc func(ctx context.Context, in map[string]any)
ChainEndFunc func(ctx context.Context, out map[string]any)
ChainErrorFunc func(ctx context.Context, err error)
ProviderStartFunc func(ctx context.Context, prompts []string)
ProviderGenerateContentStartFunc func(ctx context.Context, messages []llm.Message)
ProviderGenerateContentEndFunc func(ctx context.Context, res *llm.ContentResponse)
ProviderErrorFunc func(ctx context.Context, err error)
RetrieverStartFunc func(ctx context.Context, query string)
RetrieverEndFunc func(ctx context.Context, query string, docs []llm.Document)
ToolStartFunc func(ctx context.Context, in string)
ToolEndFunc func(ctx context.Context, out string)
ToolErrorFunc func(ctx context.Context, err error)
AgentHooksFunc func() llm.AgentHooks
ChainHooksFunc func() llm.ChainHooks
}
func (Hooks) AgentAction ¶
func (h Hooks) AgentAction(ctx context.Context, action llm.AgentAction)
func (Hooks) AgentFinish ¶
func (h Hooks) AgentFinish(ctx context.Context, finish llm.AgentFinish)
func (Hooks) AgentHooks ¶
func (h Hooks) AgentHooks() llm.AgentHooks
func (Hooks) ChainHooks ¶
func (h Hooks) ChainHooks() llm.ChainHooks
func (Hooks) ProviderGenerateContentEnd ¶
func (h Hooks) ProviderGenerateContentEnd(ctx context.Context, res *llm.ContentResponse)
func (Hooks) ProviderGenerateContentStart ¶
func (Hooks) RetrieverEnd ¶
type Memory ¶
type Memory struct {
ClearFunc func(context.Context) error
LoadVariablesFunc func(context.Context, map[string]any) (map[string]any, error)
MemoryKeyFunc func(context.Context) string
SaveContextFunc func(context.Context, map[string]any, map[string]any) error
VariablesFunc func(context.Context) []string
}
func (Memory) LoadVariables ¶
func (Memory) SaveContext ¶
type Provider ¶
type Provider struct {
GenerateContentFunc func(context.Context, []llm.Message, ...llm.ContentOption) (*llm.ContentResponse, error)
CreateEmbeddingFunc func(ctx context.Context, texts []string) ([][]float32, error)
}
func (Provider) CreateEmbedding ¶ added in v0.0.3
func (Provider) GenerateContent ¶
func (p Provider) GenerateContent(ctx context.Context, messages []llm.Message, options ...llm.ContentOption) (*llm.ContentResponse, error)
type VectorStore ¶
type VectorStore struct {
AddDocumentsFunc func(ctx context.Context, docs []llm.Document, options ...llm.VectorStoreOption) ([]string, error)
SimilaritySearchFunc func(ctx context.Context, query string, numDocs int, options ...llm.VectorStoreOption) ([]llm.Document, error)
}
func (VectorStore) AddDocuments ¶
func (vs VectorStore) AddDocuments(ctx context.Context, docs []llm.Document, options ...llm.VectorStoreOption) ([]string, error)
func (VectorStore) SimilaritySearch ¶
func (vs VectorStore) SimilaritySearch(ctx context.Context, query string, numDocs int, options ...llm.VectorStoreOption) ([]llm.Document, error)
Click to show internal directories.
Click to hide internal directories.