Skip to content
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

#837 delete unsupported fields in gemini models tool definitions #840

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/providers/google-vertex-ai/chatComplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,10 @@ export const VertexGoogleChatCompleteConfig: ProviderConfig = {
const tools: any = [];
params.tools?.forEach((tool) => {
if (tool.type === 'function') {
// these are not supported by google
delete tool.function?.parameters?.properties?.additional_properties;
narengogi marked this conversation as resolved.
Show resolved Hide resolved
delete tool.function?.strict;

if (tool.function.name === 'googleSearchRetrieval') {
tools.push(buildGoogleSearchRetrievalTool(tool));
} else {
Expand Down
4 changes: 4 additions & 0 deletions src/providers/google/chatComplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,10 @@ export const GoogleChatCompleteConfig: ProviderConfig = {
const tools: any = [];
params.tools?.forEach((tool) => {
if (tool.type === 'function') {
// these are not supported by google
delete tool.function?.parameters?.properties?.additional_properties;
delete tool.function?.strict;

if (tool.function.name === 'googleSearchRetrieval') {
tools.push(buildGoogleSearchRetrievalTool(tool));
} else {
Expand Down
2 changes: 2 additions & 0 deletions src/types/requestBody.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ export interface Function {
description?: string;
/** The parameters for the function. */
parameters?: JsonSchema;
/** Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the parameters field. Only a subset of JSON Schema is supported when strict is true */
strict?: boolean;
}

export interface ToolChoiceObject {
Expand Down
Loading