Documentation
¶
Index ¶
- Variables
- type Client
- func (c *Client) DailyCount() int
- func (c *Client) Embed(ctx context.Context, text string) ([]float32, error)
- func (c *Client) GenerateJSON(ctx context.Context, prompt string, temperature float64, maxTokens int) (string, error)
- func (c *Client) GenerateJSONWithSystem(ctx context.Context, systemPrompt, userContent string, temperature float64, ...) (string, error)
- func (c *Client) SetDailyLimit(limit int)
- type Provider
Constants ¶
This section is empty.
Variables ¶
var ErrDailyLimitExceeded = errors.New("daily LLM call limit exceeded")
ErrDailyLimitExceeded is returned when the daily LLM call limit is reached.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps the Gemini API for text generation and embeddings.
func (*Client) DailyCount ¶
DailyCount returns the current day's LLM call count.
func (*Client) Embed ¶
Embed generates an embedding for the given text using Gemini's embedding model.
func (*Client) GenerateJSON ¶
func (c *Client) GenerateJSON(ctx context.Context, prompt string, temperature float64, maxTokens int) (string, error)
GenerateJSON sends a prompt to Gemini and returns the raw JSON response text.
func (*Client) GenerateJSONWithSystem ¶
func (c *Client) GenerateJSONWithSystem(ctx context.Context, systemPrompt, userContent string, temperature float64, maxTokens int) (string, error)
GenerateJSONWithSystem sends user content to Gemini with a trusted system instruction and returns the raw JSON response text.
func (*Client) SetDailyLimit ¶
SetDailyLimit sets the maximum number of LLM API calls per day. 0 means unlimited. Values exceeding math.MaxInt32-1 are clamped to math.MaxInt32-1; negative values are clamped to 0 (unlimited). The upper bound is math.MaxInt32-1 (not MaxInt32) so that checkAndIncrementDaily can Add(1) past the limit without int32 wraparound, which would otherwise cause count>limit to read false and silently bypass the cap.
type Provider ¶
type Provider interface {
GenerateJSON(ctx context.Context, prompt string, temperature float64, maxTokens int) (string, error)
GenerateJSONWithSystem(ctx context.Context, systemPrompt, userContent string, temperature float64, maxTokens int) (string, error)
Embed(ctx context.Context, text string) ([]float32, error)
}
Provider defines the LLM operations that triage phases require.