Documentation
¶
Index ¶
- func Ask(ctx context.Context, prompt string, opts ...Option) (string, error)
- func GenerateSchema(v any) (*genai.Schema, error)
- type Option
- func WithAPIKey(key string) Option
- func WithBaseURL(url string) Option
- func WithClient(client *http.Client) Option
- func WithMaxOutputTokens(tokens int) Option
- func WithModel(model string) Option
- func WithResponseSchema(schema *genai.Schema) Option
- func WithRetry(max int) Option
- func WithSystemPrompt(prompt string) Option
- func WithTemperature(temperature float32) Option
- func WithTool(fn minds.Tool) Option
- func WithToolRegistry(registry minds.ToolRegistry) Option
- type Options
- type Provider
- func (p *Provider) Close()
- func (p *Provider) CountTokens(text string) (int, error)
- func (p *Provider) GenerateContent(ctx context.Context, req minds.Request) (minds.Response, error)
- func (p *Provider) HandleThread(tc minds.ThreadContext, next minds.ThreadHandler) (minds.ThreadContext, error)
- func (p *Provider) ModelName() string
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶
type Option func(*Options)
func WithAPIKey ¶
func WithBaseURL ¶
func WithClient ¶ added in v0.0.5
func WithMaxOutputTokens ¶
func WithResponseSchema ¶
func WithSystemPrompt ¶
func WithTemperature ¶
func WithToolRegistry ¶
func WithToolRegistry(registry minds.ToolRegistry) Option
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
func NewProvider ¶
NewProvider creates a new Gemini provider. If no model name is provided, the default model is used, currently "gemini-1.5-flash". The default model can be overridden by setting the GEMINI_DEFAULT_MODEL environment variable.
If no http.Client is provided, a default client is created with a retryable http client with a maximum of 10 retries provided by HashiCorp.
func (*Provider) CountTokens ¶
Implement the TokenCounter interface for the Gemini provider.
func (*Provider) GenerateContent ¶
func (*Provider) HandleThread ¶
func (p *Provider) HandleThread(tc minds.ThreadContext, next minds.ThreadHandler) (minds.ThreadContext, error)
HandleMessage implements the ThreadHandler interface for the Gemini provider.
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
Response represents a unified response type that can handle both text responses and function calls from the Gemini API
func NewResponse ¶
NewResponse creates a new Response from a Gemini API response
func (*Response) Raw ¶
func (r *Response) Raw() *genai.GenerateContentResponse
Raw returns the underlying Gemini response