Documentation ¶
Index ¶
- Variables
- type Agent
- func (s *Agent) Ask(prompt string, content string) (rxgo.Observable, error)
- func (s *Agent) Call(ctx context.Context, content string, functions []llms.FunctionDefinition) (*schema.FunctionCall, error)
- func (s *Agent) GenerateImages(ctx context.Context, prompt string) ([]string, error)
- func (s *Agent) Prompt(ctx context.Context, prompt string) (string, error)
- func (s *Agent) PromptStream(ctx context.Context, prompt string) (rxgo.Observable, error)
- func (s *Agent) PromptToProto(ctx context.Context, prompt string, p protoreflect.ProtoMessage) error
- func (s *Agent) TextToSpeech(ctx context.Context, text string) (io.Reader, error)
- type Config
- type Definition
- type FunctionCallJSON
- type LogHandler
- func (l *LogHandler) HandleAgentAction(_ context.Context, action schema.AgentAction)
- func (l *LogHandler) HandleAgentFinish(ctx context.Context, finish schema.AgentFinish)
- func (l *LogHandler) HandleChainEnd(_ context.Context, outputs map[string]any)
- func (l *LogHandler) HandleChainError(ctx context.Context, err error)
- func (l *LogHandler) HandleChainStart(_ context.Context, inputs map[string]any)
- func (l *LogHandler) HandleLLMError(ctx context.Context, err error)
- func (l *LogHandler) HandleLLMGenerateContentEnd(ctx context.Context, res *llms.ContentResponse)
- func (l *LogHandler) HandleLLMGenerateContentStart(ctx context.Context, ms []llms.MessageContent)
- func (l *LogHandler) HandleLLMStart(_ context.Context, prompts []string)
- func (l *LogHandler) HandleRetrieverEnd(_ context.Context, query string, documents []schema.Document)
- func (l *LogHandler) HandleRetrieverStart(_ context.Context, query string)
- func (l *LogHandler) HandleStreamingFunc(ctx context.Context, chunk []byte)
- func (l *LogHandler) HandleText(_ context.Context, text string)
- func (l *LogHandler) HandleToolEnd(_ context.Context, output string)
- func (l *LogHandler) HandleToolError(ctx context.Context, err error)
- func (l *LogHandler) HandleToolStart(_ context.Context, input string)
- type ModelDetails
- type Option
Constants ¶
This section is empty.
Variables ¶
View Source
var ProviderSet = wire.NewSet( NewConfig, NewAgent, )
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
func (*Agent) Call ¶
func (s *Agent) Call( ctx context.Context, content string, functions []llms.FunctionDefinition, ) (*schema.FunctionCall, error)
func (*Agent) GenerateImages ¶
func (*Agent) PromptStream ¶
func (*Agent) PromptToProto ¶
func (s *Agent) PromptToProto( ctx context.Context, prompt string, p protoreflect.ProtoMessage, ) error
type Config ¶
type Config struct { APIKey string `yaml:"api_key"` Timeout time.Duration `yaml:"timeout"` Model string `yaml:"model"` }
func NewDefaultConfig ¶
func NewDefaultConfig() Config
type Definition ¶
type Definition struct { Properties json.RawMessage `json:"properties"` AdditionalProperties bool `json:"additionalProperties"` Type string `json:"type"` Title string `json:"title"` }
type FunctionCallJSON ¶
type FunctionCallJSON struct { Schema string `json:"$schema"` Ref string `json:"$ref"` Definitions map[string]Definition `json:"definitions"` }
type LogHandler ¶
type LogHandler struct {
// contains filtered or unexported fields
}
LogHandler is a callback handler that prints to the standard output.
func NewHandler ¶
func NewHandler(ops ...Option) *LogHandler
func (*LogHandler) HandleAgentAction ¶
func (l *LogHandler) HandleAgentAction(_ context.Context, action schema.AgentAction)
func (*LogHandler) HandleAgentFinish ¶
func (l *LogHandler) HandleAgentFinish(ctx context.Context, finish schema.AgentFinish)
func (*LogHandler) HandleChainEnd ¶
func (l *LogHandler) HandleChainEnd(_ context.Context, outputs map[string]any)
func (*LogHandler) HandleChainError ¶
func (l *LogHandler) HandleChainError(ctx context.Context, err error)
func (*LogHandler) HandleChainStart ¶
func (l *LogHandler) HandleChainStart(_ context.Context, inputs map[string]any)
func (*LogHandler) HandleLLMError ¶
func (l *LogHandler) HandleLLMError(ctx context.Context, err error)
func (*LogHandler) HandleLLMGenerateContentEnd ¶
func (l *LogHandler) HandleLLMGenerateContentEnd(ctx context.Context, res *llms.ContentResponse)
func (*LogHandler) HandleLLMGenerateContentStart ¶
func (l *LogHandler) HandleLLMGenerateContentStart(ctx context.Context, ms []llms.MessageContent)
func (*LogHandler) HandleLLMStart ¶
func (l *LogHandler) HandleLLMStart(_ context.Context, prompts []string)
func (*LogHandler) HandleRetrieverEnd ¶
func (*LogHandler) HandleRetrieverStart ¶
func (l *LogHandler) HandleRetrieverStart(_ context.Context, query string)
func (*LogHandler) HandleStreamingFunc ¶
func (l *LogHandler) HandleStreamingFunc(ctx context.Context, chunk []byte)
func (*LogHandler) HandleText ¶
func (l *LogHandler) HandleText(_ context.Context, text string)
func (*LogHandler) HandleToolEnd ¶
func (l *LogHandler) HandleToolEnd(_ context.Context, output string)
func (*LogHandler) HandleToolError ¶
func (l *LogHandler) HandleToolError(ctx context.Context, err error)
func (*LogHandler) HandleToolStart ¶
func (l *LogHandler) HandleToolStart(_ context.Context, input string)
type ModelDetails ¶
type Option ¶
type Option func(*LogHandler)
func WithEvents ¶
func WithEvents(events chan rxgo.Item) Option
Click to show internal directories.
Click to hide internal directories.