@paean-ai/adk 0.2.27 → 0.2.29

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) {
@@ -406,15 +413,14 @@ class Gemini extends BaseLlm {
406
413
  });
407
414
  } else {
408
415
  const httpOptions = { headers: combinedHeaders };
409
- if (this.apiEndpoint) {
416
+ if (this.isGemini3Preview && this.vertexApiEndpoint) {
417
+ const isBuiltIn = this.vertexApiEndpoint === GEMINI3_PREVIEW_API_ENDPOINT;
418
+ httpOptions.baseUrl = isBuiltIn ? this.vertexApiEndpoint : "".concat(this.vertexApiEndpoint, "/v1/publishers/google");
419
+ httpOptions.apiVersion = "";
420
+ logger.debug("Gemini 3 preview endpoint: ".concat(httpOptions.baseUrl));
421
+ } else if (this.apiEndpoint) {
410
422
  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
- }
423
+ logger.debug("API endpoint: ".concat(httpOptions.baseUrl));
418
424
  }
419
425
  this._apiClient = new GoogleGenAI({
420
426
  apiKey: this.apiKey,
@@ -442,11 +448,12 @@ class Gemini extends BaseLlm {
442
448
  headers: this.trackingHeaders,
443
449
  apiVersion: this.liveApiVersion
444
450
  };
445
- if (this.apiEndpoint) {
451
+ if (this.isGemini3Preview && this.vertexApiEndpoint) {
452
+ const isBuiltIn = this.vertexApiEndpoint === GEMINI3_PREVIEW_API_ENDPOINT;
453
+ httpOptions.baseUrl = isBuiltIn ? this.vertexApiEndpoint : "".concat(this.vertexApiEndpoint, "/v1/publishers/google");
454
+ httpOptions.apiVersion = "";
455
+ } else if (this.apiEndpoint) {
446
456
  httpOptions.baseUrl = this.apiEndpoint;
447
- if (this.isGemini3Preview) {
448
- httpOptions.apiVersion = "";
449
- }
450
457
  }
451
458
  this._liveApiClient = new GoogleGenAI({
452
459
  apiKey: this.apiKey,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paean-ai/adk",
3
- "version": "0.2.27",
3
+ "version": "0.2.29",
4
4
  "description": "Google ADK JS (paean-ai fork with streaming fixes)",
5
5
  "author": "paean-ai",
6
6
  "license": "Apache-2.0",