Documentation
¶
Index ¶
- type Instructor
- func (i *Instructor) Chat(ctx context.Context, request *openai.ChatCompletionRequest, responseType any, ...) error
- func (i *Instructor) CountUsageFromResponse(response *openai.ChatCompletionResponse, usage *instructor.UsageSum)
- func (i *Instructor) EmptyResponseWithResponseUsage(ret *openai.ChatCompletionResponse, response *openai.ChatCompletionResponse)
- func (i *Instructor) EmptyResponseWithUsageSum(ret *openai.ChatCompletionResponse, usage *instructor.UsageSum)
- func (i *Instructor) Handler(ctx context.Context, request *openai.ChatCompletionRequest, ...) (string, error)
- func (i *Instructor) JSONStream(ctx context.Context, request *openai.ChatCompletionRequest, responseType any, ...) (stream <-chan any, err error)
- func (i *Instructor) JSONStreamHandler(ctx context.Context, request *openai.ChatCompletionRequest, ...) (<-chan string, error)
- func (i *Instructor) SetClient(clt *openai.Client)
- func (i *Instructor) SetUsageSumToResponse(response *openai.ChatCompletionResponse, usage *instructor.UsageSum)
- func (i *Instructor) Stream(ctx context.Context, request *openai.ChatCompletionRequest, responseType any, ...) (stream <-chan string, err error)
- type ResponseFormatSchemaWrapper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Instructor ¶
type Instructor struct {
*openai.Client
instructor.Options
}
func New ¶
func New(client *openai.Client, opts ...instructor.Option) *Instructor
func (*Instructor) Chat ¶
func (i *Instructor) Chat( ctx context.Context, request *openai.ChatCompletionRequest, responseType any, response *openai.ChatCompletionResponse, ) error
func (*Instructor) CountUsageFromResponse ¶
func (i *Instructor) CountUsageFromResponse(response *openai.ChatCompletionResponse, usage *instructor.UsageSum)
func (*Instructor) EmptyResponseWithResponseUsage ¶
func (i *Instructor) EmptyResponseWithResponseUsage(ret *openai.ChatCompletionResponse, response *openai.ChatCompletionResponse)
func (*Instructor) EmptyResponseWithUsageSum ¶
func (i *Instructor) EmptyResponseWithUsageSum(ret *openai.ChatCompletionResponse, usage *instructor.UsageSum)
func (*Instructor) Handler ¶
func (i *Instructor) Handler(ctx context.Context, request *openai.ChatCompletionRequest, schema *instructor.Schema, response *openai.ChatCompletionResponse) (string, error)
func (*Instructor) JSONStream ¶
func (i *Instructor) JSONStream( ctx context.Context, request *openai.ChatCompletionRequest, responseType any, response *openai.ChatCompletionResponse, ) (stream <-chan any, err error)
func (*Instructor) JSONStreamHandler ¶
func (i *Instructor) JSONStreamHandler(ctx context.Context, request *openai.ChatCompletionRequest, schema *instructor.Schema, response *openai.ChatCompletionResponse) (<-chan string, error)
func (*Instructor) SetClient ¶
func (i *Instructor) SetClient(clt *openai.Client)
func (*Instructor) SetUsageSumToResponse ¶
func (i *Instructor) SetUsageSumToResponse(response *openai.ChatCompletionResponse, usage *instructor.UsageSum)
func (*Instructor) Stream ¶
func (i *Instructor) Stream( ctx context.Context, request *openai.ChatCompletionRequest, responseType any, response *openai.ChatCompletionResponse, ) (stream <-chan string, err 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.