gemini_temp

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const ChunkChannelBufferSize = 10

ChunkChannelBufferSize is the buffer size for chunk channels in UI streaming Buffer of 10 provides smooth chunk delivery without blocking the producer

View Source
const DefaultHistoryCapacity = 20

DefaultHistoryCapacity is the default capacity for pre-allocating chat history slice

View Source
const DefaultModelTemperature = float32(0.3)

DefaultModelTemperature is the default temperature parameter

View Source
const DefaultModelTopK = 40

DefaultModelTopK is the default topK parameter

View Source
const DefaultModelTopP = float32(0.95)

DefaultModelTopP is the default topP parameter

View Source
const DoneChannelBufferSize = 1

DoneChannelBufferSize is the buffer size for completion channels Buffer of 1 is sufficient as only one completion signal is sent per operation

View Source
const ErrorChannelBufferSize = 1

ErrorChannelBufferSize is the buffer size for error channels Buffer of 1 is sufficient as only one error is sent per operation

View Source
const StreamChannelBufferSize = 20

StreamChannelBufferSize is the buffer size for streaming result channels Buffer of 20 allows producer (goroutine) to continue without blocking while consumer processes results, improving streaming performance

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(ctx context.Context, apiKey, modelID string, config *preset.Config) (*Client, error)

func (*Client) GenerateContent

func (c *Client) GenerateContent(ctx context.Context, systemPrompt, userPrompt string) (string, error)

GenerateContent remains simple for one-off calls

func (*Client) GetLastUsage

func (c *Client) GetLastUsage() *TokenUsage

func (*Client) GetModelID

func (c *Client) GetModelID() string

func (*Client) LoadSession

func (c *Client) LoadSession(sessionName string) error

LoadSession loads a session (history and system prompt) from disk

func (*Client) SaveSession

func (c *Client) SaveSession(sessionName string) error

SaveSession saves the current session (history and system prompt) to disk

func (*Client) SendMessage

func (c *Client) SendMessage(ctx context.Context, message string, webSearchEnabled bool) (string, error)

SendMessage sends a message with history and optional Web Search

func (*Client) SendMessageStream

func (c *Client) SendMessageStream(ctx context.Context, message string, callback StreamCallback, webSearchEnabled bool) (string, error)

SendMessageStream streams responses while maintaining history

func (*Client) StartChat

func (c *Client) StartChat(systemPrompt string)

StartChat sets the system prompt and clears history

type SessionData

type SessionData struct {
	SystemPrompt string           `json:"systemPrompt"`
	History      []*genai.Content `json:"history"`
	ModelID      string           `json:"modelID"`
}

SessionData represents the serializable session state

type StreamCallback

type StreamCallback func(string)

StreamCallback remains the same

type TokenUsage

type TokenUsage struct {
	PromptTokens     int32
	CompletionTokens int32
	TotalTokens      int32
}

TokenUsage matches the new SDK field names

Jump to

Keyboard shortcuts

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