File tree Expand file tree Collapse file tree 3 files changed +20
-4
lines changed Expand file tree Collapse file tree 3 files changed +20
-4
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @browserbasehq/stagehand " : patch
3+ ---
4+
5+ Support full Google GenAI client options (to e.g. use Vertex AI, or control the region)
Original file line number Diff line number Diff line change @@ -8,10 +8,11 @@ import {
88 FunctionCall ,
99 Schema ,
1010 Type ,
11+ GoogleGenAIOptions as ClientOptions ,
1112} from "@google/genai" ;
1213
1314import { LogLine } from "../types/public/logs" ;
14- import { AvailableModel , ClientOptions } from "../types/public/model" ;
15+ import { AvailableModel } from "../types/public/model" ;
1516import {
1617 validateZodSchema ,
1718 toGeminiSchema ,
@@ -71,15 +72,15 @@ export class GoogleClient extends LLMClient {
7172 } : {
7273 logger : ( message : LogLine ) => void ; // Added logger type
7374 modelName : AvailableModel ;
74- clientOptions ?: ClientOptions ; // Expecting { apiKey: string } here
75+ clientOptions ?: ClientOptions ;
7576 } ) {
7677 super ( modelName ) ;
7778 if ( ! clientOptions ?. apiKey ) {
7879 // Try to get the API key from the environment variable GOOGLE_API_KEY
7980 clientOptions . apiKey = loadApiKeyFromEnv ( "google_legacy" , logger ) ;
8081 }
8182 this . clientOptions = clientOptions ;
82- this . client = new GoogleGenAI ( { apiKey : clientOptions . apiKey } ) ;
83+ this . client = new GoogleGenAI ( clientOptions ) ;
8384 this . modelName = modelName ;
8485 this . logger = logger ;
8586 // Determine vision capability based on model name (adjust as needed)
Original file line number Diff line number Diff line change 11import type { ClientOptions as AnthropicClientOptions } from "@anthropic-ai/sdk" ;
22import type { LanguageModelV2 } from "@ai-sdk/provider" ;
3+ import { GoogleGenAIOptions as GoogleGenAIClientOptions } from "@google/genai" ;
34import type { ClientOptions as OpenAIClientOptions } from "openai" ;
45
56export type AnthropicJsonSchemaObject = {
@@ -66,7 +67,16 @@ export type ModelProvider =
6667 | "google"
6768 | "aisdk" ;
6869
69- export type ClientOptions = OpenAIClientOptions | AnthropicClientOptions ;
70+ export type ClientOptions = (
71+ | OpenAIClientOptions
72+ | AnthropicClientOptions
73+ | GoogleGenAIClientOptions
74+ ) &
75+ // aisdk client language model options
76+ {
77+ apiKey ?: string ;
78+ baseURL ?: string ;
79+ } ;
7080
7181export type ModelConfiguration =
7282 | AvailableModel
You can’t perform that action at this time.
0 commit comments