@paean-ai/adk 0.2.28 → 0.2.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -61,7 +61,8 @@ class Gemini extends BaseLlm {
61
61
  project,
62
62
  location,
63
63
  headers,
64
- apiEndpoint
64
+ apiEndpoint,
65
+ vertexApiEndpoint
65
66
  }) {
66
67
  if (!model) {
67
68
  model = "gemini-2.5-flash";
@@ -79,9 +80,15 @@ class Gemini extends BaseLlm {
79
80
  if (!this.apiEndpoint && canReadEnv) {
80
81
  this.apiEndpoint = process.env["GEMINI_API_ENDPOINT"];
81
82
  }
82
- if (!this.apiEndpoint && this.isGemini3Preview && !useAiStudioMode) {
83
- this.apiEndpoint = GEMINI3_PREVIEW_API_ENDPOINT;
84
- logger.info("Using Gemini 3 preview endpoint: ".concat(this.apiEndpoint));
83
+ this.vertexApiEndpoint = vertexApiEndpoint;
84
+ if (!this.vertexApiEndpoint && canReadEnv) {
85
+ this.vertexApiEndpoint = process.env["GEMINI_VERTEX_API_ENDPOINT"];
86
+ }
87
+ if (!this.vertexApiEndpoint && this.isGemini3Preview && !useAiStudioMode) {
88
+ this.vertexApiEndpoint = GEMINI3_PREVIEW_API_ENDPOINT;
89
+ logger.info(
90
+ "Using Gemini 3 preview endpoint: ".concat(this.vertexApiEndpoint)
91
+ );
85
92
  }
86
93
  let useVertexAI = !!vertexai;
87
94
  if (!useVertexAI && canReadEnv) {
@@ -98,6 +105,7 @@ class Gemini extends BaseLlm {
98
105
  }
99
106
  useVertexAI = false;
100
107
  this.apiKey = aiStudioApiKey;
108
+ this.vertexApiEndpoint = void 0;
101
109
  }
102
110
  if (this.isGemini3Preview && useVertexAI) {
103
111
  const availableApiKey = apiKey || (canReadEnv ? process.env["GOOGLE_GENAI_API_KEY"] || process.env["GEMINI_API_KEY"] : void 0);
@@ -406,15 +414,14 @@ class Gemini extends BaseLlm {
406
414
  });
407
415
  } else {
408
416
  const httpOptions = { headers: combinedHeaders };
409
- if (this.apiEndpoint) {
417
+ if (this.isGemini3Preview && this.vertexApiEndpoint) {
418
+ const isBuiltIn = this.vertexApiEndpoint === GEMINI3_PREVIEW_API_ENDPOINT;
419
+ httpOptions.baseUrl = isBuiltIn ? this.vertexApiEndpoint : "".concat(this.vertexApiEndpoint, "/v1/publishers/google");
420
+ httpOptions.apiVersion = "";
421
+ logger.debug("Gemini 3 preview endpoint: ".concat(httpOptions.baseUrl));
422
+ } else if (this.apiEndpoint) {
410
423
  httpOptions.baseUrl = this.apiEndpoint;
411
- logger.debug("Using custom API endpoint: ".concat(this.apiEndpoint));
412
- if (this.isGemini3Preview) {
413
- httpOptions.apiVersion = "";
414
- logger.info(
415
- "Gemini 3 preview mode: using direct API path without version prefix"
416
- );
417
- }
424
+ logger.debug("API endpoint: ".concat(httpOptions.baseUrl));
418
425
  }
419
426
  this._apiClient = new GoogleGenAI({
420
427
  apiKey: this.apiKey,
@@ -442,11 +449,12 @@ class Gemini extends BaseLlm {
442
449
  headers: this.trackingHeaders,
443
450
  apiVersion: this.liveApiVersion
444
451
  };
445
- if (this.apiEndpoint) {
452
+ if (this.isGemini3Preview && this.vertexApiEndpoint) {
453
+ const isBuiltIn = this.vertexApiEndpoint === GEMINI3_PREVIEW_API_ENDPOINT;
454
+ httpOptions.baseUrl = isBuiltIn ? this.vertexApiEndpoint : "".concat(this.vertexApiEndpoint, "/v1/publishers/google");
455
+ httpOptions.apiVersion = "";
456
+ } else if (this.apiEndpoint) {
446
457
  httpOptions.baseUrl = this.apiEndpoint;
447
- if (this.isGemini3Preview) {
448
- httpOptions.apiVersion = "";
449
- }
450
458
  }
451
459
  this._liveApiClient = new GoogleGenAI({
452
460
  apiKey: this.apiKey,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paean-ai/adk",
3
- "version": "0.2.28",
3
+ "version": "0.2.30",
4
4
  "description": "Google ADK JS (paean-ai fork with streaming fixes)",
5
5
  "author": "paean-ai",
6
6
  "license": "Apache-2.0",