Documentation
¶
Index ¶
- func ConvertMessageFrom(src *instructor.Message) []openai.ChatCompletionMessageParamUnion
- func ConvertMessageTo(src *openai.ChatCompletionMessageParamUnion, dist *instructor.Message) error
- type Instructor
- func (i *Instructor) CallMCP(ctx context.Context, toolUse *openai.ChatCompletionMessageToolCall, ...) *instructor.ToolCall
- func (i *Instructor) Chat(ctx context.Context, request *openai.ChatCompletionNewParams, responseType any, ...) error
- func (i *Instructor) CountUsageFromResponse(response *openai.ChatCompletion, usage *instructor.UsageSum)
- func (i *Instructor) EmptyResponseWithResponseUsage(ret *openai.ChatCompletion, response *openai.ChatCompletion)
- func (i *Instructor) EmptyResponseWithUsageSum(ret *openai.ChatCompletion, usage *instructor.UsageSum)
- func (i *Instructor) Handler(ctx context.Context, request *openai.ChatCompletionNewParams, ...) (string, error)
- func (i *Instructor) InjectMCP(ctx context.Context, req *openai.ChatCompletionNewParams)
- func (i *Instructor) SchemaStream(ctx context.Context, request *openai.ChatCompletionNewParams, responseType any, ...) (<-chan any, <-chan instructor.StreamData, error)
- func (i *Instructor) SchemaStreamHandler(ctx context.Context, request *openai.ChatCompletionNewParams, ...) (<-chan instructor.StreamData, error)
- func (i *Instructor) SetClient(clt *openai.Client)
- func (i *Instructor) SetMemory(m *instructor.Memory)
- func (i *Instructor) SetUsageSumToResponse(response *openai.ChatCompletion, usage *instructor.UsageSum)
- func (i *Instructor) Stream(ctx context.Context, request *openai.ChatCompletionNewParams, responseType any, ...) (<-chan instructor.StreamData, error)
- type ResponseFormatSchemaWrapper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertMessageFrom ¶ added in v1.5.7
func ConvertMessageFrom(src *instructor.Message) []openai.ChatCompletionMessageParamUnion
func ConvertMessageTo ¶ added in v1.5.7
func ConvertMessageTo(src *openai.ChatCompletionMessageParamUnion, dist *instructor.Message) error
Types ¶
type Instructor ¶
type Instructor struct {
*openai.Client
instructor.Options
}
func New ¶
func New(client *openai.Client, opts ...instructor.Option) *Instructor
func (*Instructor) CallMCP ¶ added in v1.4.6
func (i *Instructor) CallMCP(ctx context.Context, toolUse *openai.ChatCompletionMessageToolCall, req *openai.ChatCompletionNewParams) *instructor.ToolCall
func (*Instructor) Chat ¶
func (i *Instructor) Chat( ctx context.Context, request *openai.ChatCompletionNewParams, responseType any, response *openai.ChatCompletion, ) error
func (*Instructor) CountUsageFromResponse ¶
func (i *Instructor) CountUsageFromResponse(response *openai.ChatCompletion, usage *instructor.UsageSum)
func (*Instructor) EmptyResponseWithResponseUsage ¶
func (i *Instructor) EmptyResponseWithResponseUsage(ret *openai.ChatCompletion, response *openai.ChatCompletion)
func (*Instructor) EmptyResponseWithUsageSum ¶
func (i *Instructor) EmptyResponseWithUsageSum(ret *openai.ChatCompletion, usage *instructor.UsageSum)
func (*Instructor) Handler ¶
func (i *Instructor) Handler(ctx context.Context, request *openai.ChatCompletionNewParams, response *openai.ChatCompletion) (string, error)
func (*Instructor) InjectMCP ¶ added in v1.4.6
func (i *Instructor) InjectMCP(ctx context.Context, req *openai.ChatCompletionNewParams)
func (*Instructor) SchemaStream ¶ added in v1.2.2
func (i *Instructor) SchemaStream( ctx context.Context, request *openai.ChatCompletionNewParams, responseType any, response *openai.ChatCompletion, ) (<-chan any, <-chan instructor.StreamData, error)
func (*Instructor) SchemaStreamHandler ¶ added in v1.2.2
func (i *Instructor) SchemaStreamHandler(ctx context.Context, request *openai.ChatCompletionNewParams, response *openai.ChatCompletion) (<-chan instructor.StreamData, error)
func (*Instructor) SetClient ¶
func (i *Instructor) SetClient(clt *openai.Client)
func (*Instructor) SetMemory ¶ added in v1.5.9
func (i *Instructor) SetMemory(m *instructor.Memory)
func (*Instructor) SetUsageSumToResponse ¶
func (i *Instructor) SetUsageSumToResponse(response *openai.ChatCompletion, usage *instructor.UsageSum)
func (*Instructor) Stream ¶
func (i *Instructor) Stream( ctx context.Context, request *openai.ChatCompletionNewParams, responseType any, response *openai.ChatCompletion, ) (<-chan instructor.StreamData, error)
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"`
}
Click to show internal directories.
Click to hide internal directories.