cohere

package
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2025 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Instructor

type Instructor struct {
	*cohereClient.Client
	instructor.Options
}

func New

func New(client *cohereClient.Client, opts ...instructor.Option) *Instructor

func (*Instructor) Chat

func (i *Instructor) Chat(
	ctx context.Context,
	request *cohere.ChatRequest,
	responseType any,
	response *cohere.NonStreamedChatResponse,
) error

func (*Instructor) CountUsageFromResponse

func (i *Instructor) CountUsageFromResponse(response *cohere.NonStreamedChatResponse, usage *instructor.UsageSum)

func (*Instructor) EmptyResponseWithResponseUsage

func (i *Instructor) EmptyResponseWithResponseUsage(ret *cohere.NonStreamedChatResponse, response *cohere.NonStreamedChatResponse)

func (*Instructor) EmptyResponseWithUsageSum

func (i *Instructor) EmptyResponseWithUsageSum(ret *cohere.NonStreamedChatResponse, usage *instructor.UsageSum)

func (*Instructor) Handler

func (i *Instructor) Handler(ctx context.Context, request *cohere.ChatRequest, schema *instructor.Schema, response *cohere.NonStreamedChatResponse) (string, error)

func (*Instructor) JSONStream

func (i *Instructor) JSONStream(
	ctx context.Context,
	request *cohere.ChatStreamRequest,
	responseType any,
	response *cohere.NonStreamedChatResponse,
) (<-chan any, error)

func (*Instructor) JSONStreamHandler

func (i *Instructor) JSONStreamHandler(ctx context.Context, request *cohere.ChatStreamRequest, schema *instructor.Schema, response *cohere.NonStreamedChatResponse) (<-chan string, error)

func (*Instructor) SetUsageSumToResponse

func (i *Instructor) SetUsageSumToResponse(response *cohere.NonStreamedChatResponse, usage *instructor.UsageSum)

func (*Instructor) Stream

func (i *Instructor) Stream(
	ctx context.Context,
	request *cohere.ChatStreamRequest,
	response *cohere.NonStreamedChatResponse,
) (<-chan string, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL