Documentation
¶
Index ¶
- Variables
- func ApplyModelConfig(ai AI, cfg ModelConfig)
- func NewLimiter(rpm int64) *rate.Limiter
- type AI
- type Blob
- type ChatResponse
- type ChatSession
- type ChatStream
- type Chatbot
- type ClientConfig
- type ClientOption
- type Content
- type Function
- type FunctionCall
- type FunctionCallingMode
- type FunctionResponse
- type Image
- type JSONSchema
- type LLMs
- type Limiter
- type Model
- type ModelConfig
- type Part
- type Schema
- type Text
- type TokenCount
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrAIClosed = errors.New("AI client is nil or already closed")
Functions ¶
func ApplyModelConfig ¶ added in v1.0.6
func ApplyModelConfig(ai AI, cfg ModelConfig)
func NewLimiter ¶
Types ¶
type ChatResponse ¶
type ChatResponse interface { Raw() any Results() []string FunctionCalls() []FunctionCall TokenCount() TokenCount }
type ChatSession ¶ added in v1.0.2
type ChatStream ¶
type ChatStream interface { Next() (ChatResponse, error) Close() error }
type Chatbot ¶
type Chatbot interface { Chat(context.Context, ...Part) (ChatResponse, error) ChatStream(context.Context, ...Part) (ChatStream, error) }
type ClientConfig ¶ added in v1.0.6
type ClientOption ¶ added in v1.0.6
type ClientOption interface {
Apply(*ClientConfig)
}
func WithAPIKey ¶ added in v1.0.6
func WithAPIKey(apiKey string) ClientOption
func WithEndpoint ¶ added in v1.0.6
func WithEndpoint(endpoint string) ClientOption
func WithLimit ¶ added in v1.0.6
func WithLimit(rpm int64) ClientOption
func WithModel ¶ added in v1.0.7
func WithModel(model string) ClientOption
func WithModelConfig ¶ added in v1.0.6
func WithModelConfig(config ModelConfig) ClientOption
func WithProxy ¶ added in v1.0.6
func WithProxy(proxy string) ClientOption
type FunctionCall ¶ added in v1.0.19
type FunctionCallingMode ¶ added in v1.0.19
type FunctionCallingMode int
const ( FunctionCallingAuto FunctionCallingMode = iota + 1 FunctionCallingAny FunctionCallingNone )
func (*FunctionCallingMode) UnmarshalText ¶ added in v1.0.19
func (m *FunctionCallingMode) UnmarshalText(text []byte) error
type FunctionResponse ¶ added in v1.0.19
type JSONSchema ¶ added in v1.0.21
type LLMs ¶ added in v1.0.6
type LLMs string
func (LLMs) MarshalText ¶ added in v1.0.6
func (*LLMs) UnmarshalText ¶ added in v1.0.6
type Model ¶
type Model interface { SetFunctionCall([]Function, FunctionCallingMode) SetCount(x int64) SetMaxTokens(x int64) SetTemperature(x float64) SetTopP(x float64) SetJSONResponse(set bool, schema *JSONSchema) }
type ModelConfig ¶ added in v1.0.6
type ModelConfig struct { Count *int64 MaxTokens *int64 Temperature *float64 TopP *float64 JSONResponse *bool JSONSchema *JSONSchema Tools []Function ToolConfig FunctionCallingMode }
type TokenCount ¶ added in v1.0.13
Click to show internal directories.
Click to hide internal directories.