Documentation ¶
Index ¶
- func FuncArg[T any](from map[string]any, key string) (*T, error)
- func UploadFilesAndWait(ctx context.Context, client *genai.Client, files []io.Reader) (uploaded []genai.FileData, err error)
- type Client
- func (c *Client) Generate(ctx context.Context, promptText string, promptFiles []io.Reader, ...) (res *genai.GenerateContentResponse, err error)
- func (c *Client) GenerateStreamed(ctx context.Context, promptText string, promptFiles []io.Reader, ...) error
- func (c *Client) SetSystemInstructionFunc(fn FnSystemInstruction)
- func (c *Client) SetTimeout(seconds int)
- type FnStreamCallback
- type FnSystemInstruction
- type GenerationOptions
- type NumTokens
- type StreamCallbackData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct { Verbose bool // contains filtered or unexported fields }
Client struct
func (*Client) Generate ¶
func (c *Client) Generate( ctx context.Context, promptText string, promptFiles []io.Reader, options ...*GenerationOptions, ) (res *genai.GenerateContentResponse, err error)
Generate generates with given values synchronously.
func (*Client) GenerateStreamed ¶
func (c *Client) GenerateStreamed( ctx context.Context, promptText string, promptFiles []io.Reader, fnStreamCallback FnStreamCallback, options ...*GenerationOptions, ) error
GenerateStreamed generates with given values synchronously.
func (*Client) SetSystemInstructionFunc ¶
func (c *Client) SetSystemInstructionFunc(fn FnSystemInstruction)
SetSystemInstructionFunc sets the system instruction function.
func (*Client) SetTimeout ¶
SetTimeout sets the timeout in seconds.
type FnStreamCallback ¶
type FnStreamCallback func(callbackData StreamCallbackData)
type GenerationOptions ¶
type GenerationOptions struct { // generation config Config *genai.GenerationConfig // tool config Tools []*genai.Tool ToolConfig *genai.ToolConfig // history (for session) History []*genai.Content }
GenerationOptions struct for function Generate.
type StreamCallbackData ¶
type StreamCallbackData struct { // when there is a text delta, TextDelta *string // when there is a function call, FunctionCall *genai.FunctionCall // when the number of tokens are calculated, NumTokens *NumTokens // when there is a finish reason, FinishReason *genai.FinishReason // when there is an error, Error error }
StreamCallbackData struct contains the data for stream callback function.
Click to show internal directories.
Click to hide internal directories.