@mastra/voice-google-gemini-live 0.11.0-beta.1 → 0.11.0-beta.2

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @mastra/voice-google-gemini-live
2
2
 
3
+ ## 0.11.0-beta.2
4
+
5
+ ### Patch Changes
6
+
7
+ - fix(voice): Fix Vertex AI WebSocket connection failures in GeminiLiveVoice ([#10243](https://github.com/mastra-ai/mastra/pull/10243))
8
+
9
+ - Updated dependencies [[`352a5d6`](https://github.com/mastra-ai/mastra/commit/352a5d625cfe09849b21e8f52a24c9f0366759d5), [`a0a5b4b`](https://github.com/mastra-ai/mastra/commit/a0a5b4bbebe6c701ebbadf744873aa0d5ca01371), [`69ea758`](https://github.com/mastra-ai/mastra/commit/69ea758358edd7117f191c2e69c8bb5fc79e7a1a), [`993ad98`](https://github.com/mastra-ai/mastra/commit/993ad98d7ad3bebda9ecef5fec5c94349a0d04bc), [`3ff2c17`](https://github.com/mastra-ai/mastra/commit/3ff2c17a58e312fad5ea37377262c12d92ca0908)]:
10
+ - @mastra/core@1.0.0-beta.4
11
+
3
12
  ## 0.11.0-beta.1
4
13
 
5
14
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -1510,7 +1510,8 @@ var GeminiLiveVoice = class _GeminiLiveVoice extends voice.MastraVoice {
1510
1510
  let wsUrl;
1511
1511
  let headers = {};
1512
1512
  if (this.options.vertexAI) {
1513
- wsUrl = `wss://${this.options.location}-aiplatform.googleapis.com/ws/google.cloud.aiplatform.v1beta1.PredictionService.ServerStreamingPredict`;
1513
+ const location = this.getVertexLocation();
1514
+ wsUrl = `wss://${location}-aiplatform.googleapis.com/ws/google.cloud.aiplatform.v1beta1.LlmBidiService/BidiGenerateContent`;
1514
1515
  await this.authManager.initialize();
1515
1516
  const accessToken = await this.authManager.getAccessToken();
1516
1517
  headers = { headers: { Authorization: `Bearer ${accessToken}` } };
@@ -2473,6 +2474,31 @@ var GeminiLiveVoice = class _GeminiLiveVoice extends voice.MastraVoice {
2473
2474
  }
2474
2475
  return "text";
2475
2476
  }
2477
+ /**
2478
+ * Resolve Vertex AI location with sensible default
2479
+ * @private
2480
+ */
2481
+ getVertexLocation() {
2482
+ return this.options.location?.trim() || "us-central1";
2483
+ }
2484
+ /**
2485
+ * Resolve the correct model identifier for Gemini API or Vertex AI
2486
+ * @private
2487
+ */
2488
+ resolveModelIdentifier() {
2489
+ const model = this.options.model ?? DEFAULT_MODEL;
2490
+ if (!this.options.vertexAI) {
2491
+ return `models/${model}`;
2492
+ }
2493
+ if (!this.options.project) {
2494
+ throw this.createAndEmitError(
2495
+ "project_id_missing" /* PROJECT_ID_MISSING */,
2496
+ "Google Cloud project ID is required when using Vertex AI."
2497
+ );
2498
+ }
2499
+ const location = this.getVertexLocation();
2500
+ return `projects/${this.options.project}/locations/${location}/publishers/google/models/${model}`;
2501
+ }
2476
2502
  /**
2477
2503
  * Send initial configuration to Gemini Live API
2478
2504
  * @private
@@ -2483,7 +2509,7 @@ var GeminiLiveVoice = class _GeminiLiveVoice extends voice.MastraVoice {
2483
2509
  }
2484
2510
  const setupMessage = {
2485
2511
  setup: {
2486
- model: `models/${this.options.model}`
2512
+ model: this.resolveModelIdentifier()
2487
2513
  }
2488
2514
  };
2489
2515
  if (this.options.instructions) {