Skip to content

Commit

Permalink
Merge pull request Portkey-AI#923 from narengogi/vertex/google-search
Browse files Browse the repository at this point in the history
add support for google search tool
  • Loading branch information
VisargD authored Feb 8, 2025
2 parents 1d31738 + 73acd67 commit 79e2dcb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/providers/google-vertex-ai/chatComplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,13 @@ export const VertexGoogleChatCompleteConfig: ProviderConfig = {
recursivelyDeleteUnsupportedParameters(tool.function?.parameters);
delete tool.function?.strict;

if (tool.function.name === 'googleSearchRetrieval') {
if (['googleSearch', 'google_search'].includes(tool.function.name)) {
tools.push({ googleSearch: {} });
} else if (
['googleSearchRetrieval', 'google_search_retrieval'].includes(
tool.function.name
)
) {
tools.push(buildGoogleSearchRetrievalTool(tool));
} else {
functionDeclarations.push(tool.function);
Expand Down
8 changes: 7 additions & 1 deletion src/providers/google/chatComplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,13 @@ export const GoogleChatCompleteConfig: ProviderConfig = {
recursivelyDeleteUnsupportedParameters(tool.function?.parameters);
delete tool.function?.strict;

if (tool.function.name === 'googleSearchRetrieval') {
if (['googleSearch', 'google_search'].includes(tool.function.name)) {
tools.push({ googleSearch: {} });
} else if (
['googleSearchRetrieval', 'google_search_retrieval'].includes(
tool.function.name
)
) {
tools.push(buildGoogleSearchRetrievalTool(tool));
} else {
functionDeclarations.push(tool.function);
Expand Down

0 comments on commit 79e2dcb

Please sign in to comment.