Documentation
¶
Index ¶
Constants ¶
View Source
const ( ApiBase = "https://generativelanguage.googleapis.com" ApiPathGenerate = "/v1beta/models/gemini-2.5-flash:generateContent" ApiPathUpload = "/upload/v1beta/files" RoleModel = "model" RoleUser = "user" MaxSourceLinks = 10 )
View Source
const ( MaxRetries = 3 Temperature = 0.8 TopK = 1 TopP = 1 MaxOutputTokens = 900 MaxInputCharacters = 250000 // Should be roughly 1 mio tokens, max input tokens are 1048576 TokensPerImage = 258 // https://ai.google.dev/gemini-api/docs/tokens?lang=go#multimodal-tokens DefaultSystemInstruction = "" /* 274-byte string literal not displayed */ )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileUploadResponse ¶
type FileUploadResponse struct {
File struct {
MimeType string `json:"mimeType"`
Uri string `json:"uri"`
} `json:"file"`
}
FileUploadResponse - https://ai.google.dev/api/files#response-body
type GenerateContentRequest ¶
type GenerateContentRequest struct {
Contents []Content `json:"contents"`
SafetySettings []SafetySetting `json:"safetySettings"`
GenerationConfig GenerationConfig `json:"generationConfig"`
SystemInstruction SystemInstruction `json:"system_instruction"`
Tools []Tool `json:"tools"`
}
GenerateContentRequest - https://ai.google.dev/api/generate-content#request-body
type GenerateContentResponse ¶
type GenerateContentResponse struct {
Candidates []struct {
Content Content `json:"content"`
FinishReason string `json:"finishReason"`
SafetyRatings []struct {
Category string `json:"category"`
Probability string `json:"probability"`
} `json:"safetyRatings"`
GroundingMetadata GroundingMetadata `json:"groundingMetadata"`
} `json:"candidates"`
}
GenerateContentResponse - https://ai.google.dev/api/generate-content#generatecontentresponse
type GenerationConfig ¶
type GenerationConfig struct {
Temperature float64 `json:"temperature"`
TopK int `json:"topK"`
TopP int `json:"topP"`
MaxOutputTokens int `json:"maxOutputTokens"`
ThinkingConfig ThinkingConfig `json:"thinkingConfig"`
}
type GroundingMetadata ¶
type GroundingMetadata struct {
// https://ai.google.dev/api/generate-content#GroundingChunk
GroundingChunks []struct {
// https://ai.google.dev/api/generate-content#Web
Web struct {
Uri string `json:"uri"`
Title string `json:"title"`
} `json:"web"`
} `json:"groundingChunks"`
WebSearchQueries []string `json:"webSearchQueries"`
}
GroundingMetadata - https://ai.google.dev/api/generate-content#GroundingMetadata
func (*GroundingMetadata) Links ¶
func (g *GroundingMetadata) Links() string
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
func (*Plugin) Commands ¶
func (p *Plugin) Commands() []gotgbot.BotCommand
type SafetySetting ¶
type SafetySetting struct {
Category string `json:"category"` // https://ai.google.dev/api/generate-content#v1beta.HarmCategory
Threshold string `json:"threshold"` // https://ai.google.dev/api/generate-content#HarmBlockThreshold
}
type SystemInstruction ¶
type SystemInstruction struct {
Parts []Part `json:"parts"`
}
type ThinkingConfig ¶
type ThinkingConfig struct {
IncludeThoughts bool `json:"includeThoughts"`
ThinkingBudget int `json:"thinkingBudget"`
}
ThinkingConfig - https://ai.google.dev/api/generate-content#ThinkingConfig
type Tool ¶
type Tool struct {
// GoogleSearch - https://ai.google.dev/api/caching#GoogleSearch (has no fields)
GoogleSearch struct {
} `json:"google_search"`
}
Click to show internal directories.
Click to hide internal directories.