-
Notifications
You must be signed in to change notification settings - Fork 3
Adding tool combination support #68
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
base: main
Are you sure you want to change the base?
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 | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -54,6 +54,7 @@ const GenAIApp = (function () { | |||||||||||||||||||||||||
| let knowledgeLink = []; | ||||||||||||||||||||||||||
| let compaction_enabled = false; | ||||||||||||||||||||||||||
| let compaction_threshold = 10000; | ||||||||||||||||||||||||||
| let tool_combination_enabled = false; | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| let previous_response_id; | ||||||||||||||||||||||||||
| let last_response_id = null; | ||||||||||||||||||||||||||
|
|
@@ -295,6 +296,18 @@ const GenAIApp = (function () { | |||||||||||||||||||||||||
| return this; | ||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||
| * OPTIONAL | ||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||
| * Enable or disable server-side tool invocations for Gemini (Tool Combination). | ||||||||||||||||||||||||||
| * @param {boolean} enabled - True to enable tool combination. | ||||||||||||||||||||||||||
| * @returns {Chat} - The current Chat instance. | ||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||
| this.enableToolCombination = function (enabled) { | ||||||||||||||||||||||||||
| tool_combination_enabled = enabled; | ||||||||||||||||||||||||||
| return this; | ||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||
| * Includes the content of a web page in the prompt sent to openAI | ||||||||||||||||||||||||||
| * @param {string} url - the url of the webpage you want to fetch | ||||||||||||||||||||||||||
|
|
@@ -751,7 +764,8 @@ const GenAIApp = (function () { | |||||||||||||||||||||||||
| 'tool_config': { | ||||||||||||||||||||||||||
| function_calling_config: { | ||||||||||||||||||||||||||
| mode: "AUTO" | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||
| includeServerSideToolInvocations: tool_combination_enabled | ||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||
|
Comment on lines
764
to
769
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 chain🌐 Web query:
💡 Result: Is
|
||||||||||||||||||||||||||
| 'tool_config': { | |
| function_calling_config: { | |
| mode: "AUTO" | |
| } | |
| }, | |
| includeServerSideToolInvocations: tool_combination_enabled | |
| }, | |
| 'tool_config': { | |
| function_calling_config: { | |
| mode: "AUTO" | |
| } | |
| }, |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/code.gs` around lines 764 - 769, The request payload is adding
includeServerSideToolInvocations unconditionally inside the 'tool_config' object
which causes API 400 errors; modify the code that builds the 'tool_config' (the
object containing function_calling_config) so that
includeServerSideToolInvocations is only added when tool_combination_enabled is
true (e.g., construct tool_config, set function_calling_config always, and
conditionally assign includeServerSideToolInvocations = tool_combination_enabled
only when tool_combination_enabled is truthy).
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
🏁 Script executed:
Repository: scriptit-fr/GenAIApp
Length of output: 212
🏁 Script executed:
Repository: scriptit-fr/GenAIApp
Length of output: 868
🏁 Script executed:
Repository: scriptit-fr/GenAIApp
Length of output: 102
🏁 Script executed:
Repository: scriptit-fr/GenAIApp
Length of output: 80
🏁 Script executed:
Repository: scriptit-fr/GenAIApp
Length of output: 188
🏁 Script executed:
Repository: scriptit-fr/GenAIApp
Length of output: 281
🏁 Script executed:
Repository: scriptit-fr/GenAIApp
Length of output: 131
🏁 Script executed:
Repository: scriptit-fr/GenAIApp
Length of output: 965
🏁 Script executed:
Repository: scriptit-fr/GenAIApp
Length of output: 182
🏁 Script executed:
Repository: scriptit-fr/GenAIApp
Length of output: 1734
🏁 Script executed:
Repository: scriptit-fr/GenAIApp
Length of output: 3313
🏁 Script executed:
Repository: scriptit-fr/GenAIApp
Length of output: 286
🏁 Script executed:
Repository: scriptit-fr/GenAIApp
Length of output: 273
🏁 Script executed:
Repository: scriptit-fr/GenAIApp
Length of output: 1126
🏁 Script executed:
Repository: scriptit-fr/GenAIApp
Length of output: 314
🏁 Script executed:
Repository: scriptit-fr/GenAIApp
Length of output: 719
🏁 Script executed:
Repository: scriptit-fr/GenAIApp
Length of output: 1444
Fix Boolean coercion in
enableToolCombinationto match JSDoc specification.The JSDoc declares
@param {boolean}but the implementation accepts any truthy value viaBoolean(enabled). This creates a silent type mismatch—callers passing"false"(string) will unintentionally enable the feature sinceBoolean("false")evaluates totrue. A public API with explicit boolean documentation should enforce the type rather than silently coerce it.The same issue exists in
enableCompactionat line 369.Either remove the
Boolean()wrapper and assignenableddirectly, or add explicit type validation to reject non-boolean values.🤖 Prompt for AI Agents