Documentation ¶
Index ¶
- Constants
- type Function
- type FunctionDefinition
- type Instructor
- type InstructorAnthropic
- func (i *InstructorAnthropic) CreateMessages(ctx context.Context, request anthropic.MessagesRequest, responseType any) (response anthropic.MessagesResponse, err error)
- func (i *InstructorAnthropic) MaxRetries() int
- func (i *InstructorAnthropic) Mode() string
- func (i *InstructorAnthropic) Provider() string
- func (i *InstructorAnthropic) Validate() bool
- type InstructorCohere
- func (i *InstructorCohere) Chat(ctx context.Context, request *cohere.ChatRequest, response any, ...) (*cohere.NonStreamedChatResponse, error)
- func (i *InstructorCohere) ChatStream(ctx context.Context, request *cohere.ChatStreamRequest, responseType any, ...) (<-chan any, error)
- func (i *InstructorCohere) MaxRetries() int
- func (i *InstructorCohere) Mode() string
- func (i *InstructorCohere) Provider() string
- func (i *InstructorCohere) Validate() bool
- type InstructorOpenAI
- func (i *InstructorOpenAI) CreateChatCompletion(ctx context.Context, request openai.ChatCompletionRequest, responseType any) (response openai.ChatCompletionResponse, err error)
- func (i *InstructorOpenAI) CreateChatCompletionStream(ctx context.Context, request openai.ChatCompletionRequest, responseType any) (stream <-chan any, err error)
- func (i *InstructorOpenAI) MaxRetries() int
- func (i *InstructorOpenAI) Mode() Mode
- func (i *InstructorOpenAI) Provider() Provider
- func (i *InstructorOpenAI) Validate() bool
- type Mode
- type Options
- type Provider
- type ResponseFormatSchemaWrapper
- type Schema
- type StreamWrapper
- type UsageSum
Constants ¶
View Source
const ( DefaultMaxRetries = 3 DefaultValidator = false )
View Source
const WRAPPER_END = `"items": [`
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Function ¶
type Function struct { Type string `json:"type"` Function FunctionDefinition `json:"function"` }
type FunctionDefinition ¶
type FunctionDefinition struct { Name string `json:"name"` Description string `json:"description,omitempty"` Parameters *jsonschema.Schema `json:"parameters"` }
func ToFunctionSchema ¶
func ToFunctionSchema(tType reflect.Type, tSchema *jsonschema.Schema) []FunctionDefinition
type Instructor ¶
type InstructorAnthropic ¶
func FromAnthropic ¶
func FromAnthropic(client *anthropic.Client, opts ...Options) *InstructorAnthropic
func (*InstructorAnthropic) CreateMessages ¶
func (i *InstructorAnthropic) CreateMessages(ctx context.Context, request anthropic.MessagesRequest, responseType any) (response anthropic.MessagesResponse, err error)
func (*InstructorAnthropic) MaxRetries ¶
func (i *InstructorAnthropic) MaxRetries() int
func (*InstructorAnthropic) Mode ¶
func (i *InstructorAnthropic) Mode() string
func (*InstructorAnthropic) Provider ¶
func (i *InstructorAnthropic) Provider() string
func (*InstructorAnthropic) Validate ¶
func (i *InstructorAnthropic) Validate() bool
type InstructorCohere ¶
func FromCohere ¶
func FromCohere(client *cohere.Client, opts ...Options) *InstructorCohere
func (*InstructorCohere) Chat ¶
func (i *InstructorCohere) Chat( ctx context.Context, request *cohere.ChatRequest, response any, opts ...option.RequestOption, ) (*cohere.NonStreamedChatResponse, error)
func (*InstructorCohere) ChatStream ¶
func (i *InstructorCohere) ChatStream( ctx context.Context, request *cohere.ChatStreamRequest, responseType any, opts ...option.RequestOption, ) (<-chan any, error)
func (*InstructorCohere) MaxRetries ¶
func (i *InstructorCohere) MaxRetries() int
func (*InstructorCohere) Mode ¶
func (i *InstructorCohere) Mode() string
func (*InstructorCohere) Provider ¶
func (i *InstructorCohere) Provider() string
func (*InstructorCohere) Validate ¶
func (i *InstructorCohere) Validate() bool
type InstructorOpenAI ¶
func FromOpenAI ¶
func FromOpenAI(client *openai.Client, opts ...Options) *InstructorOpenAI
func (*InstructorOpenAI) CreateChatCompletion ¶
func (i *InstructorOpenAI) CreateChatCompletion( ctx context.Context, request openai.ChatCompletionRequest, responseType any, ) (response openai.ChatCompletionResponse, err error)
func (*InstructorOpenAI) CreateChatCompletionStream ¶
func (i *InstructorOpenAI) CreateChatCompletionStream( ctx context.Context, request openai.ChatCompletionRequest, responseType any, ) (stream <-chan any, err error)
func (*InstructorOpenAI) MaxRetries ¶
func (i *InstructorOpenAI) MaxRetries() int
func (*InstructorOpenAI) Mode ¶
func (i *InstructorOpenAI) Mode() Mode
func (*InstructorOpenAI) Provider ¶
func (i *InstructorOpenAI) Provider() Provider
func (*InstructorOpenAI) Validate ¶
func (i *InstructorOpenAI) Validate() bool
type ResponseFormatSchemaWrapper ¶
type ResponseFormatSchemaWrapper struct { Type string `json:"type"` Required []string `json:"required"` AdditionalProperties bool `json:"additionalProperties"` Properties *jsonschema.Definitions `json:"properties"` Definitions *jsonschema.Definitions `json:"$defs"` }
type Schema ¶
type Schema struct { *jsonschema.Schema String string Functions []FunctionDefinition }
func (*Schema) NameFromRef ¶
type StreamWrapper ¶
type StreamWrapper[T any] struct { Items []T `json:"items"` }
Click to show internal directories.
Click to hide internal directories.