gemini

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2025 License: MIT Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Instructor

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

func New

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

func (*Instructor) Chat

func (i *Instructor) Chat(
	ctx context.Context,
	request *Request,
	responseType any,
	response *gemini.GenerateContentResponse,
) error

func (*Instructor) CountUsageFromResponse

func (i *Instructor) CountUsageFromResponse(response *gemini.GenerateContentResponse, usage *instructor.UsageSum)

func (*Instructor) EmptyResponseWithResponseUsage

func (i *Instructor) EmptyResponseWithResponseUsage(ret *gemini.GenerateContentResponse, response *gemini.GenerateContentResponse)

func (*Instructor) EmptyResponseWithUsageSum

func (i *Instructor) EmptyResponseWithUsageSum(ret *gemini.GenerateContentResponse, usage *instructor.UsageSum)

func (*Instructor) Handler

func (i *Instructor) Handler(ctx context.Context, request *Request, schema *instructor.Schema, response *gemini.GenerateContentResponse) (string, error)

func (*Instructor) JSONStream

func (i *Instructor) JSONStream(
	ctx context.Context,
	request *Request,
	responseType any,
	response *gemini.GenerateContentResponse,
) (stream <-chan any, err error)

func (*Instructor) JSONStreamHandler

func (i *Instructor) JSONStreamHandler(ctx context.Context, request *Request, schema *instructor.Schema, response *gemini.GenerateContentResponse) (<-chan string, error)

func (*Instructor) SetClient

func (i *Instructor) SetClient(clt *gemini.Client)

func (*Instructor) SetUsageSumToResponse

func (i *Instructor) SetUsageSumToResponse(response *gemini.GenerateContentResponse, usage *instructor.UsageSum)

func (*Instructor) Stream

func (i *Instructor) Stream(
	ctx context.Context,
	request *Request,
	response *gemini.GenerateContentResponse,
) (stream <-chan string, err error)

type Request

type Request struct {
	Model   string
	System  *gemini.Content
	Parts   []gemini.Part
	History []*gemini.Content
}

Jump to

Keyboard shortcuts

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