Documentation ¶
Index ¶
- Variables
- type Brain
- func (m *Brain) Append(ctx context.Context, thread string, messages []types.Message) (Response, error)
- func (m *Brain) Chat(ctx context.Context, thread string, messages ...types.Message) (Response, error)
- func (m *Brain) Definition() Definition
- func (m *Brain) Run(ctx context.Context, messages []types.Message, thread string) (Response, error)
- type Definition
- type Provider
- type Response
- type Vision
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidProvider = errors.New("not a valid Provider")
var (
ErrProviderNotFound = errors.New("provider not found")
)
Functions ¶
This section is empty.
Types ¶
type Brain ¶
type Brain struct {
// contains filtered or unexported fields
}
func NewFromFile ¶
func (*Brain) Append ¶ added in v0.0.6
func (m *Brain) Append(ctx context.Context, thread string, messages []types.Message) (Response, error)
Append messages to thread.
func (*Brain) Definition ¶ added in v0.0.6
func (m *Brain) Definition() Definition
type Definition ¶
type Definition struct { types.Config `yaml:",inline"` // model configuration Parallel bool `yaml:"parallel"` // allow parallel execution for calls Vision *Vision `yaml:"vision,omitempty" json:"vision"` // separate model for vision MaxIterations int `json:"max_iterations" yaml:"maxIterations"` Provider Provider `json:"provider" yaml:"provider"` // provider name (openai, bedrock) URL string `json:"url" yaml:"url"` // provider URL Secret utils.Value[string] `json:"secret" yaml:"secret"` // provider secret Depth int `yaml:"depth" json:"depth"` // history depth }
func Default ¶
func Default() Definition
type Provider ¶ added in v0.0.4
type Provider string
Provider name ENUM(openai,bedrock,ollama,google)
const ( // ProviderOpenai is a Provider of type openai. ProviderOpenai Provider = "openai" // ProviderBedrock is a Provider of type bedrock. ProviderBedrock Provider = "bedrock" // ProviderOllama is a Provider of type ollama. ProviderOllama Provider = "ollama" // ProviderGoogle is a Provider of type google. ProviderGoogle Provider = "google" )
func ParseProvider ¶ added in v0.0.4
ParseProvider attempts to convert a string to a Provider.
func (Provider) IsValid ¶ added in v0.0.4
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (Provider) MarshalText ¶ added in v0.0.4
MarshalText implements the text marshaller method.
func (*Provider) UnmarshalText ¶ added in v0.0.4
UnmarshalText implements the text unmarshaller method.
type Response ¶ added in v0.0.3
func (Response) Called ¶ added in v0.0.3
Called returns how many times function (tool) with specified name has been called.
func (Response) Reply ¶ added in v0.0.3
Reply returns first non-tool calling model response. If nothing found, empty text content returned.
func (Response) TotalInputTokens ¶ added in v0.0.3
TotalInputTokens returns sum of all used input tokens.
func (Response) TotalOutputTokens ¶ added in v0.0.3
TotalOutputTokens returns sum of all used output tokens.
func (Response) TotalTokens ¶ added in v0.0.3
TotalTokens returns sum of all tokens.