@@ -31,7 +31,6 @@ import { ToolSet } from "ai";
3131 * This implementation uses the Google Generative AI SDK for Computer Use
3232 */
3333export class GoogleCUAClient extends AgentClient {
34- private apiKey : string ;
3534 private client : GoogleGenAI ;
3635 private currentViewport = { width : 1288 , height : 711 } ;
3736 private currentUrl ?: string ;
@@ -53,16 +52,15 @@ export class GoogleCUAClient extends AgentClient {
5352
5453 this . tools = tools ;
5554 // Process client options
56- this . apiKey =
57- ( clientOptions ?. apiKey as string ) ||
55+ clientOptions = clientOptions || { } ;
56+ clientOptions . apiKey =
57+ ( clientOptions . apiKey as string ) ||
5858 process . env . GEMINI_API_KEY ||
5959 process . env . GOOGLE_GENERATIVE_AI_API_KEY ||
60- "" ;
60+ undefined ;
6161
6262 // Initialize the Google Generative AI client
63- this . client = new GoogleGenAI ( {
64- apiKey : this . apiKey ,
65- } ) ;
63+ this . client = new GoogleGenAI ( clientOptions ) ;
6664
6765 // Get environment if specified
6866 if (
@@ -90,9 +88,7 @@ export class GoogleCUAClient extends AgentClient {
9088 } ;
9189
9290 // Store client options for reference
93- this . clientOptions = {
94- apiKey : this . apiKey ,
95- } ;
91+ this . clientOptions = clientOptions ;
9692
9793 // Initialize tools if provided
9894 if ( this . tools && Object . keys ( this . tools ) . length > 0 ) {
0 commit comments