mock

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 7, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

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) InputKeys

func (a Agent) InputKeys() []string

func (Agent) OutputKeys

func (a Agent) OutputKeys() []string

func (Agent) Plan

func (a Agent) Plan(ctx context.Context, steps []llm.AgentStep, in map[string]string) ([]llm.AgentAction, *llm.AgentFinish, error)

func (Agent) Tools added in v0.0.2

func (a Agent) Tools() []llm.AgentTool

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) Call

func (c Chain) Call(ctx context.Context, values map[string]any, options ...llm.ChainOption) (map[string]any, error)

func (Chain) ChainHooks

func (c Chain) ChainHooks() llm.ChainHooks

func (Chain) InputKeys

func (c Chain) InputKeys() []string

func (Chain) Memory

func (c Chain) Memory() llm.Memory

func (Chain) OutputKeys

func (c Chain) OutputKeys() []string

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) ChainEnd

func (h Hooks) ChainEnd(ctx context.Context, out map[string]any)

func (Hooks) ChainError

func (h Hooks) ChainError(ctx context.Context, err error)

func (Hooks) ChainHooks

func (h Hooks) ChainHooks() llm.ChainHooks

func (Hooks) ChainStart

func (h Hooks) ChainStart(ctx context.Context, in map[string]any)

func (Hooks) ProviderError

func (h Hooks) ProviderError(ctx context.Context, err error)

func (Hooks) ProviderGenerateContentEnd

func (h Hooks) ProviderGenerateContentEnd(ctx context.Context, res *llm.ContentResponse)

func (Hooks) ProviderGenerateContentStart

func (h Hooks) ProviderGenerateContentStart(ctx context.Context, messages []llm.Message)

func (Hooks) ProviderStart

func (h Hooks) ProviderStart(ctx context.Context, prompts []string)

func (Hooks) RetrieverEnd

func (h Hooks) RetrieverEnd(ctx context.Context, query string, docs []llm.Document)

func (Hooks) RetrieverStart

func (h Hooks) RetrieverStart(ctx context.Context, query string)

func (Hooks) StreamingFunc

func (h Hooks) StreamingFunc(ctx context.Context, chunk []byte)

func (Hooks) ToolEnd

func (h Hooks) ToolEnd(ctx context.Context, out string)

func (Hooks) ToolError

func (h Hooks) ToolError(ctx context.Context, err error)

func (Hooks) ToolStart

func (h Hooks) ToolStart(ctx context.Context, in string)

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) Clear

func (m Memory) Clear(ctx context.Context) error

func (Memory) LoadVariables

func (m Memory) LoadVariables(ctx context.Context, in map[string]any) (map[string]any, error)

func (Memory) MemoryKey

func (m Memory) MemoryKey(ctx context.Context) string

func (Memory) SaveContext

func (m Memory) SaveContext(ctx context.Context, in map[string]any, out map[string]any) error

func (Memory) Variables

func (m Memory) Variables(ctx context.Context) []string

type Provider

type Provider struct {
	GenerateContentFunc func(context.Context, []llm.Message, ...llm.ContentOption) (*llm.ContentResponse, error)
}

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)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL