2024-02-17 16:15:31 +00:00
|
|
|
package gemini
|
|
|
|
|
|
|
|
type ChatRequest struct {
|
|
|
|
Contents []ChatContent `json:"contents"`
|
|
|
|
SafetySettings []ChatSafetySettings `json:"safety_settings,omitempty"`
|
|
|
|
GenerationConfig ChatGenerationConfig `json:"generation_config,omitempty"`
|
|
|
|
Tools []ChatTools `json:"tools,omitempty"`
|
|
|
|
}
|
|
|
|
|
2024-05-28 17:17:32 +00:00
|
|
|
type EmbeddingRequest struct {
|
|
|
|
Model string `json:"model"`
|
|
|
|
Content ChatContent `json:"content"`
|
|
|
|
TaskType string `json:"taskType,omitempty"`
|
|
|
|
Title string `json:"title,omitempty"`
|
|
|
|
OutputDimensionality int `json:"outputDimensionality,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type BatchEmbeddingRequest struct {
|
|
|
|
Requests []EmbeddingRequest `json:"requests"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type EmbeddingData struct {
|
|
|
|
Values []float64 `json:"values"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type EmbeddingResponse struct {
|
|
|
|
Embeddings []EmbeddingData `json:"embeddings"`
|
|
|
|
Error *Error `json:"error,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type Error struct {
|
|
|
|
Code int `json:"code,omitempty"`
|
|
|
|
Message string `json:"message,omitempty"`
|
|
|
|
Status string `json:"status,omitempty"`
|
|
|
|
}
|
|
|
|
|
2024-02-17 16:15:31 +00:00
|
|
|
type InlineData struct {
|
|
|
|
MimeType string `json:"mimeType"`
|
|
|
|
Data string `json:"data"`
|
|
|
|
}
|
|
|
|
|
2024-04-24 13:26:45 +00:00
|
|
|
type FunctionCall struct {
|
|
|
|
FunctionName string `json:"name"`
|
|
|
|
Arguments any `json:"args"`
|
|
|
|
}
|
|
|
|
|
2024-02-17 16:15:31 +00:00
|
|
|
type Part struct {
|
2024-04-24 13:26:45 +00:00
|
|
|
Text string `json:"text,omitempty"`
|
|
|
|
InlineData *InlineData `json:"inlineData,omitempty"`
|
|
|
|
FunctionCall *FunctionCall `json:"functionCall,omitempty"`
|
2024-02-17 16:15:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type ChatContent struct {
|
|
|
|
Role string `json:"role,omitempty"`
|
|
|
|
Parts []Part `json:"parts"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type ChatSafetySettings struct {
|
|
|
|
Category string `json:"category"`
|
|
|
|
Threshold string `json:"threshold"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type ChatTools struct {
|
2024-04-24 13:26:45 +00:00
|
|
|
FunctionDeclarations any `json:"function_declarations,omitempty"`
|
2024-02-17 16:15:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type ChatGenerationConfig struct {
|
|
|
|
Temperature float64 `json:"temperature,omitempty"`
|
|
|
|
TopP float64 `json:"topP,omitempty"`
|
|
|
|
TopK float64 `json:"topK,omitempty"`
|
|
|
|
MaxOutputTokens int `json:"maxOutputTokens,omitempty"`
|
|
|
|
CandidateCount int `json:"candidateCount,omitempty"`
|
|
|
|
StopSequences []string `json:"stopSequences,omitempty"`
|
|
|
|
}
|