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,11 +8,12 @@ import {
88 FunctionCall ,
99 Schema ,
1010 Type ,
11+ GoogleGenAIOptions as ClientOptions ,
1112} from "@google/genai" ;
1213import zodToJsonSchema from "zod-to-json-schema" ;
1314
1415import { LogLine } from "../../types/log" ;
15- import { AvailableModel , ClientOptions } from "../../types/model" ;
16+ import { AvailableModel } from "../../types/model" ;
1617import { LLMCache } from "../cache/LLMCache" ;
1718import { validateZodSchema , toGeminiSchema , loadApiKeyFromEnv } from "../utils" ;
1819import {
@@ -75,15 +76,15 @@ export class GoogleClient extends LLMClient {
7576 enableCaching ?: boolean ;
7677 cache ?: LLMCache ;
7778 modelName : AvailableModel ;
78- clientOptions ?: ClientOptions ; // Expecting { apiKey: string } here
79+ clientOptions ?: ClientOptions ;
7980 } ) {
8081 super ( modelName ) ;
8182 if ( ! clientOptions ?. apiKey ) {
8283 // Try to get the API key from the environment variable GOOGLE_API_KEY
8384 clientOptions . apiKey = loadApiKeyFromEnv ( "google_legacy" , logger ) ;
8485 }
8586 this . clientOptions = clientOptions ;
86- this . client = new GoogleGenAI ( { apiKey : clientOptions . apiKey } ) ;
87+ this . client = new GoogleGenAI ( clientOptions ) ;
8788 this . cache = cache ;
8889 this . enableCaching = enableCaching ;
8990 this . modelName = modelName ;
Original file line number Diff line number Diff line change 11import type { ClientOptions as AnthropicClientOptions } from "@anthropic-ai/sdk" ;
2+ import { GoogleGenAIOptions as GoogleGenAIClientOptions } from "@google/genai" ;
23import type { ClientOptions as OpenAIClientOptions } from "openai" ;
34import { z } from "zod/v3" ;
45
@@ -44,7 +45,16 @@ export type ModelProvider =
4445 | "google"
4546 | "aisdk" ;
4647
47- export type ClientOptions = OpenAIClientOptions | AnthropicClientOptions ;
48+ export type ClientOptions = (
49+ | OpenAIClientOptions
50+ | AnthropicClientOptions
51+ | GoogleGenAIClientOptions
52+ ) &
53+ // aisdk client language model options
54+ {
55+ apiKey ?: string ;
56+ baseURL ?: string ;
57+ } ;
4858
4959export interface AnthropicJsonSchemaObject {
5060 definitions ?: {
You can’t perform that action at this time.
0 commit comments