-
Notifications
You must be signed in to change notification settings - Fork 11.1k
feat: gemini-3-pro #2243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: gemini-3-pro #2243
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -141,6 +141,8 @@ func (r *GeminiChatRequest) SetTools(tools []GeminiChatTool) { | |||||||||||||||||||||
| type GeminiThinkingConfig struct { | ||||||||||||||||||||||
| IncludeThoughts bool `json:"includeThoughts,omitempty"` | ||||||||||||||||||||||
| ThinkingBudget *int `json:"thinkingBudget,omitempty"` | ||||||||||||||||||||||
| // TODO Conflict with thinkingbudget. | ||||||||||||||||||||||
| // ThinkingLevel json.RawMessage `json:"thinkingLevel,omitempty"` | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| func (c *GeminiThinkingConfig) SetThinkingBudget(budget int) { | ||||||||||||||||||||||
|
|
@@ -182,8 +184,12 @@ type FunctionCall struct { | |||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| type GeminiFunctionResponse struct { | ||||||||||||||||||||||
| Name string `json:"name"` | ||||||||||||||||||||||
| Response map[string]interface{} `json:"response"` | ||||||||||||||||||||||
| Name string `json:"name"` | ||||||||||||||||||||||
| Response map[string]interface{} `json:"response"` | ||||||||||||||||||||||
| WillContinue json.RawMessage `json:"willContinue,omitempty"` | ||||||||||||||||||||||
| Scheduling json.RawMessage `json:"scheduling,omitempty"` | ||||||||||||||||||||||
| Parts json.RawMessage `json:"parts,omitempty"` | ||||||||||||||||||||||
| ID json.RawMessage `json:"id,omitempty"` | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| type GeminiPartExecutableCode struct { | ||||||||||||||||||||||
|
|
@@ -202,11 +208,15 @@ type GeminiFileData struct { | |||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| type GeminiPart struct { | ||||||||||||||||||||||
| Text string `json:"text,omitempty"` | ||||||||||||||||||||||
| Thought bool `json:"thought,omitempty"` | ||||||||||||||||||||||
| InlineData *GeminiInlineData `json:"inlineData,omitempty"` | ||||||||||||||||||||||
| FunctionCall *FunctionCall `json:"functionCall,omitempty"` | ||||||||||||||||||||||
| FunctionResponse *GeminiFunctionResponse `json:"functionResponse,omitempty"` | ||||||||||||||||||||||
| Text string `json:"text,omitempty"` | ||||||||||||||||||||||
| Thought bool `json:"thought,omitempty"` | ||||||||||||||||||||||
| InlineData *GeminiInlineData `json:"inlineData,omitempty"` | ||||||||||||||||||||||
| FunctionCall *FunctionCall `json:"functionCall,omitempty"` | ||||||||||||||||||||||
| ThoughtSignature json.RawMessage `json:"thoughtSignature,omitempty"` | ||||||||||||||||||||||
| FunctionResponse *GeminiFunctionResponse `json:"functionResponse,omitempty"` | ||||||||||||||||||||||
| // Optional. Media resolution for the input media. | ||||||||||||||||||||||
| MediaResolution json.RawMessage `json:"mediaResolution,omitempty"` | ||||||||||||||||||||||
| VideoMetadata json.RawMessage `json:"videoMetadata,omitempty"` | ||||||||||||||||||||||
|
Comment on lines
+215
to
+219
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainVerify field types against Gemini API spec—MediaResolution type is inconsistent. Three new fields use Using Please verify the correct types for these fields in the Gemini 3 API specification: If - MediaResolution json.RawMessage `json:"mediaResolution,omitempty"`
+ MediaResolution MediaResolution `json:"mediaResolution,omitempty"`🌐 Web query: 💡 Result:
Sources: Go schema showing Part and thoughtSignature/videoMetadata. [1][2]; Gemini API docs for media_resolution enum/details. [3]; video understanding docs for VideoMetadata details. [4] Replace json.RawMessage with concrete types per Gemini 3 API spec. The three new fields are defined with incorrect types. According to the Gemini 3 API specification:
Using - ThoughtSignature json.RawMessage `json:"thoughtSignature,omitempty"`
+ ThoughtSignature []byte `json:"thoughtSignature,omitempty"`
FunctionResponse *GeminiFunctionResponse `json:"functionResponse,omitempty"`
// Optional. Media resolution for the input media.
- MediaResolution json.RawMessage `json:"mediaResolution,omitempty"`
- VideoMetadata json.RawMessage `json:"videoMetadata,omitempty"`
+ MediaResolution MediaResolution `json:"mediaResolution,omitempty"`
+ VideoMetadata *VideoMetadata `json:"videoMetadata,omitempty"`📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||
| FileData *GeminiFileData `json:"fileData,omitempty"` | ||||||||||||||||||||||
| ExecutableCode *GeminiPartExecutableCode `json:"executableCode,omitempty"` | ||||||||||||||||||||||
| CodeExecutionResult *GeminiPartCodeExecutionResult `json:"codeExecutionResult,omitempty"` | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Additions to
GeminiFunctionResponseare structurally sound; verify field names vs Gemini specUsing
json.RawMessageforWillContinue,Scheduling,Parts, andIDis consistent with the existing pattern of treating provider‑specific metadata as opaque JSON. Tags withomitemptyavoid emitting unused fields.Please double‑check that the JSON keys (
willContinue,scheduling,parts,id) exactly match what Gemini 3 returns, since any mismatch would silently drop these fields during unmarshalling.🌐 Web query:
💡 Result:
Summary of exact JSON field names and shapes (Gemini / Generative Language API):
id — string. Optional. Unique id of the function response. [1]
name — string. Required (function name). [1]
response — object (JSON object / Struct). Required. Arbitrary JSON containing the function's output. [1]
parts — array of FunctionResponsePart objects. Optional. Each part is an object with a data union (e.g., inlineData: { mimeType: string, data: string }) or other part types. [1]
willContinue — boolean. Optional. Signals the function call continues (generator behavior) for NON_BLOCKING functions; false ends the generator. (Docs also show it may be nullable in some SDK schemas.) [1][2]
scheduling — enum (Scheduling). Optional. Allowed enum values: SCHEDULING_UNSPECIFIED, SILENT, WHEN_IDLE, INTERRUPT. Controls how the response is scheduled for NON_BLOCKING calls. [1]
References
Struct field types misaligned with Gemini spec—willContinue and scheduling should be concrete types, not json.RawMessage
The JSON field names (
willContinue,scheduling,parts,id) correctly match the Gemini API. However, the types are problematic:willContinueshould bebool, notjson.RawMessage(spec: boolean)schedulingshould bestring, notjson.RawMessage(spec: enum)partsshould be[]FunctionResponsePartor similar, notjson.RawMessage(spec: array of objects)idcan remainjson.RawMessageif intentionally opaque, but spec shows it as simplestringUsing
json.RawMessagefor well-defined fields defers type checking to runtime and requires manual unmarshalling downstream, increasing error risk.🤖 Prompt for AI Agents