@mastra/voice-google-gemini-live 0.11.0 → 0.11.1-alpha.0

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.1-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - fix(voice): Fix Vertex AI WebSocket connection failures in GeminiLiveVoice ([#10292](https://github.com/mastra-ai/mastra/pull/10292))
8
+
9
+ - Updated dependencies [[`7491cc0`](https://github.com/mastra-ai/mastra/commit/7491cc0350b2ba067f98c4915bf607119bd0150f), [`0d10ac7`](https://github.com/mastra-ai/mastra/commit/0d10ac7b8efa03c2f0c330eb2520148bfa6091e9), [`e3e899c`](https://github.com/mastra-ai/mastra/commit/e3e899c650f4c435445303bd97a66f5840a52a1e)]:
10
+ - @mastra/core@0.24.3-alpha.0
11
+
3
12
  ## 0.11.0
4
13
 
5
14
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -1511,7 +1511,8 @@ var GeminiLiveVoice = class _GeminiLiveVoice extends voice.MastraVoice {
1511
1511
  let wsUrl;
1512
1512
  let headers = {};
1513
1513
  if (this.options.vertexAI) {
1514
- wsUrl = `wss://${this.options.location}-aiplatform.googleapis.com/ws/google.cloud.aiplatform.v1beta1.PredictionService.ServerStreamingPredict`;
1514
+ const location = this.getVertexLocation();
1515
+ wsUrl = `wss://${location}-aiplatform.googleapis.com/ws/google.cloud.aiplatform.v1beta1.LlmBidiService/BidiGenerateContent`;
1515
1516
  await this.authManager.initialize();
1516
1517
  const accessToken = await this.authManager.getAccessToken();
1517
1518
  headers = { headers: { Authorization: `Bearer ${accessToken}` } };
@@ -2489,6 +2490,31 @@ var GeminiLiveVoice = class _GeminiLiveVoice extends voice.MastraVoice {
2489
2490
  }
2490
2491
  return "text";
2491
2492
  }
2493
+ /**
2494
+ * Resolve Vertex AI location with sensible default
2495
+ * @private
2496
+ */
2497
+ getVertexLocation() {
2498
+ return this.options.location?.trim() || "us-central1";
2499
+ }
2500
+ /**
2501
+ * Resolve the correct model identifier for Gemini API or Vertex AI
2502
+ * @private
2503
+ */
2504
+ resolveModelIdentifier() {
2505
+ const model = this.options.model ?? DEFAULT_MODEL;
2506
+ if (!this.options.vertexAI) {
2507
+ return `models/${model}`;
2508
+ }
2509
+ if (!this.options.project) {
2510
+ throw this.createAndEmitError(
2511
+ "project_id_missing" /* PROJECT_ID_MISSING */,
2512
+ "Google Cloud project ID is required when using Vertex AI."
2513
+ );
2514
+ }
2515
+ const location = this.getVertexLocation();
2516
+ return `projects/${this.options.project}/locations/${location}/publishers/google/models/${model}`;
2517
+ }
2492
2518
  /**
2493
2519
  * Send initial configuration to Gemini Live API
2494
2520
  * @private
@@ -2499,7 +2525,7 @@ var GeminiLiveVoice = class _GeminiLiveVoice extends voice.MastraVoice {
2499
2525
  }
2500
2526
  const setupMessage = {
2501
2527
  setup: {
2502
- model: `models/${this.options.model}`
2528
+ model: this.resolveModelIdentifier()
2503
2529
  }
2504
2530
  };
2505
2531
  if (this.options.instructions) {