@mastra/mcp-docs-server 1.0.0-beta.5 → 1.0.0-beta.7

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.
Files changed (163) hide show
  1. package/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +9 -9
  2. package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +67 -67
  3. package/.docs/organized/changelogs/%40mastra%2Fastra.md +10 -10
  4. package/.docs/organized/changelogs/%40mastra%2Fchroma.md +12 -12
  5. package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +57 -57
  6. package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +110 -110
  7. package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +57 -57
  8. package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +57 -57
  9. package/.docs/organized/changelogs/%40mastra%2Fcodemod.md +6 -0
  10. package/.docs/organized/changelogs/%40mastra%2Fconvex.md +60 -0
  11. package/.docs/organized/changelogs/%40mastra%2Fcore.md +358 -358
  12. package/.docs/organized/changelogs/%40mastra%2Fcouchbase.md +11 -11
  13. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +24 -24
  14. package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +12 -12
  15. package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +79 -79
  16. package/.docs/organized/changelogs/%40mastra%2Fduckdb.md +42 -0
  17. package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +57 -57
  18. package/.docs/organized/changelogs/%40mastra%2Felasticsearch.md +61 -0
  19. package/.docs/organized/changelogs/%40mastra%2Fevals.md +12 -12
  20. package/.docs/organized/changelogs/%40mastra%2Flance.md +57 -57
  21. package/.docs/organized/changelogs/%40mastra%2Flibsql.md +55 -55
  22. package/.docs/organized/changelogs/%40mastra%2Floggers.md +12 -12
  23. package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +17 -17
  24. package/.docs/organized/changelogs/%40mastra%2Fmcp.md +125 -125
  25. package/.docs/organized/changelogs/%40mastra%2Fmemory.md +36 -36
  26. package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +57 -57
  27. package/.docs/organized/changelogs/%40mastra%2Fmssql.md +57 -57
  28. package/.docs/organized/changelogs/%40mastra%2Fopensearch.md +10 -10
  29. package/.docs/organized/changelogs/%40mastra%2Fpg.md +59 -59
  30. package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +10 -10
  31. package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +77 -77
  32. package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +10 -10
  33. package/.docs/organized/changelogs/%40mastra%2Frag.md +43 -43
  34. package/.docs/organized/changelogs/%40mastra%2Freact.md +16 -0
  35. package/.docs/organized/changelogs/%40mastra%2Fs3vectors.md +9 -0
  36. package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +6 -0
  37. package/.docs/organized/changelogs/%40mastra%2Fserver.md +113 -113
  38. package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +10 -10
  39. package/.docs/organized/changelogs/%40mastra%2Fupstash.md +57 -57
  40. package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +10 -10
  41. package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +19 -19
  42. package/.docs/organized/changelogs/create-mastra.md +15 -15
  43. package/.docs/organized/changelogs/mastra.md +30 -30
  44. package/.docs/organized/code-examples/agui.md +1 -0
  45. package/.docs/organized/code-examples/ai-elements.md +1 -1
  46. package/.docs/organized/code-examples/ai-sdk-useChat.md +1 -1
  47. package/.docs/organized/code-examples/ai-sdk-v5.md +2 -1
  48. package/.docs/organized/code-examples/assistant-ui.md +1 -1
  49. package/.docs/organized/code-examples/bird-checker-with-nextjs-and-eval.md +1 -1
  50. package/.docs/organized/code-examples/bird-checker-with-nextjs.md +1 -1
  51. package/.docs/organized/code-examples/crypto-chatbot.md +1 -1
  52. package/.docs/organized/code-examples/mcp-server-adapters.md +721 -0
  53. package/.docs/organized/code-examples/server-app-access.md +342 -0
  54. package/.docs/organized/code-examples/server-express-adapter.md +87 -0
  55. package/.docs/organized/code-examples/server-hono-adapter.md +85 -0
  56. package/.docs/raw/agents/agent-approval.mdx +189 -0
  57. package/.docs/raw/agents/guardrails.mdx +13 -9
  58. package/.docs/raw/agents/networks.mdx +1 -0
  59. package/.docs/raw/agents/overview.mdx +8 -152
  60. package/.docs/raw/agents/processors.mdx +279 -0
  61. package/.docs/raw/agents/structured-output.mdx +224 -0
  62. package/.docs/raw/deployment/cloud-providers/index.mdx +19 -26
  63. package/.docs/raw/deployment/cloud-providers/netlify-deployer.mdx +44 -13
  64. package/.docs/raw/evals/running-in-ci.mdx +0 -2
  65. package/.docs/raw/{guides/getting-started → getting-started}/manual-install.mdx +2 -2
  66. package/.docs/raw/getting-started/start.mdx +1 -1
  67. package/.docs/raw/guides/build-your-ui/ai-sdk-ui.mdx +8 -0
  68. package/.docs/raw/guides/getting-started/quickstart.mdx +1 -1
  69. package/.docs/raw/guides/guide/whatsapp-chat-bot.mdx +421 -0
  70. package/.docs/raw/guides/index.mdx +3 -35
  71. package/.docs/raw/guides/migrations/upgrade-to-v1/agent.mdx +11 -0
  72. package/.docs/raw/guides/migrations/upgrade-to-v1/workflows.mdx +37 -0
  73. package/.docs/raw/index.mdx +1 -1
  74. package/.docs/raw/memory/memory-processors.mdx +265 -79
  75. package/.docs/raw/memory/working-memory.mdx +11 -2
  76. package/.docs/raw/observability/overview.mdx +0 -1
  77. package/.docs/raw/observability/tracing/bridges/otel.mdx +200 -0
  78. package/.docs/raw/observability/tracing/exporters/arize.mdx +36 -0
  79. package/.docs/raw/observability/tracing/exporters/braintrust.mdx +19 -0
  80. package/.docs/raw/observability/tracing/exporters/langfuse.mdx +83 -0
  81. package/.docs/raw/observability/tracing/exporters/langsmith.mdx +12 -0
  82. package/.docs/raw/observability/tracing/exporters/otel.mdx +34 -22
  83. package/.docs/raw/observability/tracing/exporters/posthog.mdx +20 -0
  84. package/.docs/raw/observability/tracing/overview.mdx +76 -6
  85. package/.docs/raw/observability/tracing/processors/sensitive-data-filter.mdx +0 -1
  86. package/.docs/raw/rag/retrieval.mdx +23 -6
  87. package/.docs/raw/rag/vector-databases.mdx +93 -2
  88. package/.docs/raw/reference/agents/generate.mdx +55 -6
  89. package/.docs/raw/reference/agents/network.mdx +44 -0
  90. package/.docs/raw/reference/client-js/memory.mdx +43 -0
  91. package/.docs/raw/reference/client-js/workflows.mdx +92 -63
  92. package/.docs/raw/reference/deployer/netlify.mdx +1 -2
  93. package/.docs/raw/reference/evals/scorer-utils.mdx +362 -0
  94. package/.docs/raw/reference/index.mdx +1 -0
  95. package/.docs/raw/reference/observability/tracing/bridges/otel.mdx +177 -0
  96. package/.docs/raw/reference/observability/tracing/configuration.mdx +0 -4
  97. package/.docs/raw/reference/observability/tracing/exporters/arize.mdx +29 -0
  98. package/.docs/raw/reference/observability/tracing/exporters/langfuse.mdx +43 -0
  99. package/.docs/raw/reference/observability/tracing/exporters/langsmith.mdx +17 -1
  100. package/.docs/raw/reference/observability/tracing/exporters/otel.mdx +33 -43
  101. package/.docs/raw/reference/observability/tracing/instances.mdx +0 -4
  102. package/.docs/raw/reference/observability/tracing/interfaces.mdx +29 -4
  103. package/.docs/raw/reference/observability/tracing/spans.mdx +0 -4
  104. package/.docs/raw/reference/processors/language-detector.mdx +9 -2
  105. package/.docs/raw/reference/processors/message-history-processor.mdx +131 -0
  106. package/.docs/raw/reference/processors/moderation-processor.mdx +10 -3
  107. package/.docs/raw/reference/processors/pii-detector.mdx +10 -3
  108. package/.docs/raw/reference/processors/processor-interface.mdx +502 -0
  109. package/.docs/raw/reference/processors/prompt-injection-detector.mdx +9 -2
  110. package/.docs/raw/reference/processors/semantic-recall-processor.mdx +197 -0
  111. package/.docs/raw/reference/processors/system-prompt-scrubber.mdx +2 -2
  112. package/.docs/raw/reference/processors/tool-call-filter.mdx +125 -0
  113. package/.docs/raw/reference/processors/working-memory-processor.mdx +221 -0
  114. package/.docs/raw/reference/server/create-route.mdx +314 -0
  115. package/.docs/raw/reference/server/express-adapter.mdx +193 -0
  116. package/.docs/raw/reference/server/hono-adapter.mdx +174 -0
  117. package/.docs/raw/reference/server/mastra-server.mdx +316 -0
  118. package/.docs/raw/reference/server/routes.mdx +250 -0
  119. package/.docs/raw/reference/storage/cloudflare-d1.mdx +37 -0
  120. package/.docs/raw/reference/storage/convex.mdx +164 -0
  121. package/.docs/raw/reference/storage/lance.mdx +33 -0
  122. package/.docs/raw/reference/storage/libsql.mdx +37 -0
  123. package/.docs/raw/reference/storage/mongodb.mdx +39 -0
  124. package/.docs/raw/reference/storage/mssql.mdx +37 -0
  125. package/.docs/raw/reference/storage/postgresql.mdx +37 -0
  126. package/.docs/raw/reference/streaming/ChunkType.mdx +1 -1
  127. package/.docs/raw/reference/streaming/agents/stream.mdx +56 -1
  128. package/.docs/raw/reference/streaming/workflows/observeStream.mdx +7 -9
  129. package/.docs/raw/reference/streaming/workflows/{resumeStreamVNext.mdx → resumeStream.mdx} +51 -11
  130. package/.docs/raw/reference/streaming/workflows/stream.mdx +83 -24
  131. package/.docs/raw/reference/streaming/workflows/timeTravelStream.mdx +170 -0
  132. package/.docs/raw/reference/tools/mcp-client.mdx +128 -18
  133. package/.docs/raw/reference/vectors/convex.mdx +429 -0
  134. package/.docs/raw/reference/vectors/duckdb.mdx +462 -0
  135. package/.docs/raw/reference/vectors/elasticsearch.mdx +310 -0
  136. package/.docs/raw/reference/voice/google.mdx +159 -20
  137. package/.docs/raw/reference/workflows/run-methods/restart.mdx +142 -0
  138. package/.docs/raw/reference/workflows/run-methods/resume.mdx +44 -0
  139. package/.docs/raw/reference/workflows/run-methods/start.mdx +44 -0
  140. package/.docs/raw/reference/workflows/run-methods/timeTravel.mdx +310 -0
  141. package/.docs/raw/reference/workflows/run.mdx +27 -5
  142. package/.docs/raw/reference/workflows/step.mdx +13 -0
  143. package/.docs/raw/reference/workflows/workflow.mdx +19 -0
  144. package/.docs/raw/server-db/custom-adapters.mdx +380 -0
  145. package/.docs/raw/server-db/mastra-server.mdx +16 -8
  146. package/.docs/raw/server-db/request-context.mdx +0 -1
  147. package/.docs/raw/server-db/server-adapters.mdx +286 -0
  148. package/.docs/raw/server-db/storage.mdx +11 -0
  149. package/.docs/raw/streaming/overview.mdx +6 -6
  150. package/.docs/raw/streaming/tool-streaming.mdx +2 -2
  151. package/.docs/raw/streaming/workflow-streaming.mdx +5 -11
  152. package/.docs/raw/workflows/error-handling.mdx +1 -0
  153. package/.docs/raw/workflows/human-in-the-loop.mdx +4 -4
  154. package/.docs/raw/workflows/overview.mdx +56 -44
  155. package/.docs/raw/workflows/snapshots.mdx +1 -0
  156. package/.docs/raw/workflows/suspend-and-resume.mdx +85 -16
  157. package/.docs/raw/workflows/time-travel.mdx +313 -0
  158. package/.docs/raw/workflows/workflow-state.mdx +191 -0
  159. package/CHANGELOG.md +16 -0
  160. package/package.json +4 -4
  161. package/.docs/raw/agents/human-in-the-loop-with-tools.mdx +0 -91
  162. package/.docs/raw/reference/streaming/workflows/observeStreamVNext.mdx +0 -47
  163. package/.docs/raw/reference/streaming/workflows/streamVNext.mdx +0 -153
@@ -0,0 +1,310 @@
1
+ ---
2
+ title: "Reference: ElasticSearch Vector Store | Vectors"
3
+ description: Documentation for the ElasticSearchVector class in Mastra, which provides vector search using ElasticSearch.
4
+ ---
5
+
6
+ # ElasticSearch Vector Store
7
+
8
+ The ElasticSearchVector class provides vector search using [ElasticSearch](https://www.elastic.co/elasticsearch/) with its `dense_vector` field type and k-NN search capabilities.
9
+ It's part of the `@mastra/elasticsearch` package.
10
+
11
+ ## Installation
12
+
13
+ ```bash copy
14
+ npm install @mastra/elasticsearch@beta
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ ```typescript copy showLineNumbers
20
+ import { ElasticSearchVector } from "@mastra/elasticsearch";
21
+
22
+ const store = new ElasticSearchVector({
23
+ url: process.env.ELASTICSEARCH_URL,
24
+ });
25
+
26
+ // Create an index
27
+ await store.createIndex({
28
+ indexName: "my-collection",
29
+ dimension: 1536,
30
+ });
31
+
32
+ // Add vectors with metadata
33
+ const vectors = [[0.1, 0.2, ...], [0.3, 0.4, ...]];
34
+ const metadata = [
35
+ { text: "first document", category: "A" },
36
+ { text: "second document", category: "B" }
37
+ ];
38
+ await store.upsert({
39
+ indexName: "my-collection",
40
+ vectors,
41
+ metadata,
42
+ });
43
+
44
+ // Query similar vectors
45
+ const results = await store.query({
46
+ indexName: "my-collection",
47
+ queryVector: [0.1, 0.2, ...],
48
+ topK: 10,
49
+ filter: { category: "A" },
50
+ });
51
+ ```
52
+
53
+ ## Constructor Options
54
+
55
+ <PropertiesTable
56
+ content={[
57
+ {
58
+ name: "url",
59
+ type: "string",
60
+ description: "ElasticSearch connection URL (e.g., 'http://localhost:9200')",
61
+ },
62
+ ]}
63
+ />
64
+
65
+ ## Methods
66
+
67
+ ### createIndex()
68
+
69
+ Creates a new index with the specified configuration.
70
+
71
+ <PropertiesTable
72
+ content={[
73
+ {
74
+ name: "indexName",
75
+ type: "string",
76
+ description: "Name of the index to create",
77
+ },
78
+ {
79
+ name: "dimension",
80
+ type: "number",
81
+ description: "Vector dimension (must match your embedding model)",
82
+ },
83
+ {
84
+ name: "metric",
85
+ type: "'cosine' | 'euclidean' | 'dotproduct'",
86
+ isOptional: true,
87
+ defaultValue: "cosine",
88
+ description: "Distance metric for similarity search",
89
+ },
90
+ ]}
91
+ />
92
+
93
+ ### upsert()
94
+
95
+ Adds or updates vectors and their metadata in the index.
96
+
97
+ <PropertiesTable
98
+ content={[
99
+ {
100
+ name: "indexName",
101
+ type: "string",
102
+ description: "Name of the index to insert into",
103
+ },
104
+ {
105
+ name: "vectors",
106
+ type: "number[][]",
107
+ description: "Array of embedding vectors",
108
+ },
109
+ {
110
+ name: "metadata",
111
+ type: "Record<string, any>[]",
112
+ isOptional: true,
113
+ description: "Metadata for each vector",
114
+ },
115
+ {
116
+ name: "ids",
117
+ type: "string[]",
118
+ isOptional: true,
119
+ description: "Optional vector IDs (auto-generated if not provided)",
120
+ },
121
+ ]}
122
+ />
123
+
124
+ ### query()
125
+
126
+ Searches for similar vectors with optional metadata filtering.
127
+
128
+ <PropertiesTable
129
+ content={[
130
+ {
131
+ name: "indexName",
132
+ type: "string",
133
+ description: "Name of the index to search in",
134
+ },
135
+ {
136
+ name: "queryVector",
137
+ type: "number[]",
138
+ description: "Query vector to find similar vectors for",
139
+ },
140
+ {
141
+ name: "topK",
142
+ type: "number",
143
+ isOptional: true,
144
+ defaultValue: "10",
145
+ description: "Number of results to return",
146
+ },
147
+ {
148
+ name: "filter",
149
+ type: "Record<string, any>",
150
+ isOptional: true,
151
+ description: "Metadata filters",
152
+ },
153
+ {
154
+ name: "includeVector",
155
+ type: "boolean",
156
+ isOptional: true,
157
+ defaultValue: "false",
158
+ description: "Whether to include vector data in results",
159
+ },
160
+ ]}
161
+ />
162
+
163
+ ### describeIndex()
164
+
165
+ Gets information about an index.
166
+
167
+ <PropertiesTable
168
+ content={[
169
+ {
170
+ name: "indexName",
171
+ type: "string",
172
+ description: "Name of the index to describe",
173
+ },
174
+ ]}
175
+ />
176
+
177
+ Returns:
178
+
179
+ ```typescript copy
180
+ interface IndexStats {
181
+ dimension: number;
182
+ count: number;
183
+ metric: "cosine" | "euclidean" | "dotproduct";
184
+ }
185
+ ```
186
+
187
+ ### deleteIndex()
188
+
189
+ Deletes an index and all its data.
190
+
191
+ <PropertiesTable
192
+ content={[
193
+ {
194
+ name: "indexName",
195
+ type: "string",
196
+ description: "Name of the index to delete",
197
+ },
198
+ ]}
199
+ />
200
+
201
+ ### listIndexes()
202
+
203
+ Lists all vector indexes.
204
+
205
+ Returns: `Promise<string[]>`
206
+
207
+ ### updateVector()
208
+
209
+ Update a single vector by ID or by metadata filter. Either `id` or `filter` must be provided, but not both.
210
+
211
+ <PropertiesTable
212
+ content={[
213
+ {
214
+ name: "indexName",
215
+ type: "string",
216
+ description: "Name of the index containing the vector",
217
+ },
218
+ {
219
+ name: "id",
220
+ type: "string",
221
+ isOptional: true,
222
+ description: "ID of the vector to update (mutually exclusive with filter)",
223
+ },
224
+ {
225
+ name: "filter",
226
+ type: "Record<string, any>",
227
+ isOptional: true,
228
+ description: "Metadata filter to identify vector(s) to update (mutually exclusive with id)",
229
+ },
230
+ {
231
+ name: "update",
232
+ type: "object",
233
+ description: "Update data containing vector and/or metadata",
234
+ },
235
+ {
236
+ name: "update.vector",
237
+ type: "number[]",
238
+ isOptional: true,
239
+ description: "New vector data",
240
+ },
241
+ {
242
+ name: "update.metadata",
243
+ type: "Record<string, any>",
244
+ isOptional: true,
245
+ description: "New metadata",
246
+ },
247
+ ]}
248
+ />
249
+
250
+ ### deleteVector()
251
+
252
+ Deletes a single vector by its ID.
253
+
254
+ <PropertiesTable
255
+ content={[
256
+ {
257
+ name: "indexName",
258
+ type: "string",
259
+ description: "Name of the index containing the vector",
260
+ },
261
+ {
262
+ name: "id",
263
+ type: "string",
264
+ description: "ID of the vector to delete",
265
+ },
266
+ ]}
267
+ />
268
+
269
+ ### deleteVectors()
270
+
271
+ Delete multiple vectors by IDs or by metadata filter. Either `ids` or `filter` must be provided, but not both.
272
+
273
+ <PropertiesTable
274
+ content={[
275
+ {
276
+ name: "indexName",
277
+ type: "string",
278
+ description: "Name of the index containing the vectors to delete",
279
+ },
280
+ {
281
+ name: "ids",
282
+ type: "string[]",
283
+ isOptional: true,
284
+ description: "Array of vector IDs to delete (mutually exclusive with filter)",
285
+ },
286
+ {
287
+ name: "filter",
288
+ type: "Record<string, any>",
289
+ isOptional: true,
290
+ description: "Metadata filter to identify vectors to delete (mutually exclusive with ids)",
291
+ },
292
+ ]}
293
+ />
294
+
295
+ ## Response Types
296
+
297
+ Query results are returned in this format:
298
+
299
+ ```typescript copy
300
+ interface QueryResult {
301
+ id: string;
302
+ score: number;
303
+ metadata: Record<string, any>;
304
+ vector?: number[]; // Only included if includeVector is true
305
+ }
306
+ ```
307
+
308
+ ## Related
309
+
310
+ - [Metadata Filters](../rag/metadata-filters)
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  title: "Reference: Google | Voice"
3
- description: "Documentation for the Google Voice implementation, providing text-to-speech and speech-to-text capabilities."
3
+ description: "Documentation for the Google Voice implementation, providing text-to-speech and speech-to-text capabilities with support for both API key and Vertex AI authentication."
4
4
  ---
5
5
 
6
6
  # Google
7
7
 
8
- The Google Voice implementation in Mastra provides both text-to-speech (TTS) and speech-to-text (STT) capabilities using Google Cloud services. It supports multiple voices, languages, and advanced audio configuration options.
8
+ The Google Voice implementation in Mastra provides both text-to-speech (TTS) and speech-to-text (STT) capabilities using Google Cloud services. It supports multiple voices, languages, advanced audio configuration options, and both standard API key authentication and Vertex AI mode for enterprise deployments.
9
9
 
10
10
  ## Usage Example
11
11
 
@@ -15,17 +15,6 @@ import { GoogleVoice } from "@mastra/voice-google";
15
15
  // Initialize with default configuration (uses GOOGLE_API_KEY environment variable)
16
16
  const voice = new GoogleVoice();
17
17
 
18
- // Initialize with custom configuration
19
- const voice = new GoogleVoice({
20
- speechModel: {
21
- apiKey: "your-speech-api-key",
22
- },
23
- listeningModel: {
24
- apiKey: "your-listening-api-key",
25
- },
26
- speaker: "en-US-Casual-K",
27
- });
28
-
29
18
  // Text-to-Speech
30
19
  const audioStream = await voice.speak("Hello, world!", {
31
20
  languageCode: "en-US",
@@ -71,6 +60,29 @@ const voices = await voice.getSpeakers({ languageCode: "en-US" });
71
60
  isOptional: true,
72
61
  defaultValue: "'en-US-Casual-K'",
73
62
  },
63
+ {
64
+ name: "vertexAI",
65
+ type: "boolean",
66
+ description:
67
+ "Enable Vertex AI mode for enterprise deployments. Uses project-based authentication instead of API keys. Requires 'project' to be set.",
68
+ isOptional: true,
69
+ defaultValue: "false",
70
+ },
71
+ {
72
+ name: "project",
73
+ type: "string",
74
+ description:
75
+ "Google Cloud project ID (required when vertexAI is true). Falls back to GOOGLE_CLOUD_PROJECT environment variable.",
76
+ isOptional: true,
77
+ },
78
+ {
79
+ name: "location",
80
+ type: "string",
81
+ description:
82
+ "Google Cloud region for Vertex AI. Falls back to GOOGLE_CLOUD_LOCATION environment variable.",
83
+ isOptional: true,
84
+ defaultValue: "'us-central1'",
85
+ },
74
86
  ]}
75
87
  />
76
88
 
@@ -82,7 +94,21 @@ const voices = await voice.getSpeakers({ languageCode: "en-US" });
82
94
  name: "apiKey",
83
95
  type: "string",
84
96
  description:
85
- "Google Cloud API key. Falls back to GOOGLE_API_KEY environment variable",
97
+ "Google Cloud API key. Falls back to GOOGLE_API_KEY environment variable. Not used when vertexAI is true.",
98
+ isOptional: true,
99
+ },
100
+ {
101
+ name: "keyFilename",
102
+ type: "string",
103
+ description:
104
+ "Path to service account JSON key file. Falls back to GOOGLE_APPLICATION_CREDENTIALS environment variable.",
105
+ isOptional: true,
106
+ },
107
+ {
108
+ name: "credentials",
109
+ type: "object",
110
+ description:
111
+ "In-memory service account credentials object with client_email and private_key properties.",
86
112
  isOptional: true,
87
113
  },
88
114
  ]}
@@ -193,11 +219,124 @@ Returns an array of available voice options, where each node contains:
193
219
  ]}
194
220
  />
195
221
 
222
+ ### isUsingVertexAI()
223
+
224
+ Checks if Vertex AI mode is enabled.
225
+
226
+ Returns: `boolean` - `true` if using Vertex AI, `false` otherwise
227
+
228
+ ### getProject()
229
+
230
+ Gets the configured Google Cloud project ID.
231
+
232
+ Returns: `string | undefined` - The project ID or `undefined` if not set
233
+
234
+ ### getLocation()
235
+
236
+ Gets the configured Google Cloud location/region.
237
+
238
+ Returns: `string` - The location (default: `'us-central1'`)
239
+
240
+ ## Authentication
241
+
242
+ The Google Voice provider supports two authentication methods:
243
+
244
+ ### Standard Mode (API Key)
245
+
246
+ Uses a Google Cloud API key for authentication. Suitable for development and simple use cases.
247
+
248
+ ```typescript
249
+ // Using environment variable (GOOGLE_API_KEY)
250
+ const voice = new GoogleVoice();
251
+
252
+ // Using explicit API key
253
+ const voice = new GoogleVoice({
254
+ speechModel: { apiKey: "your-api-key" },
255
+ listeningModel: { apiKey: "your-api-key" },
256
+ speaker: "en-US-Casual-K",
257
+ });
258
+ ```
259
+
260
+ ### Vertex AI Mode (Service Account)
261
+
262
+ Uses Google Cloud project-based authentication with service accounts. Recommended for production and enterprise deployments.
263
+
264
+ **Benefits:**
265
+ - Better security (no API keys in code)
266
+ - IAM-based access control
267
+ - Project-level billing and quotas
268
+ - Audit logging
269
+ - Enterprise features
270
+
271
+ **Configuration Options:**
272
+
273
+ ```typescript
274
+ // Using Application Default Credentials (ADC)
275
+ // Set GOOGLE_APPLICATION_CREDENTIALS and GOOGLE_CLOUD_PROJECT env vars
276
+ const voice = new GoogleVoice({
277
+ vertexAI: true,
278
+ project: "your-gcp-project",
279
+ location: "us-central1", // Optional, defaults to 'us-central1'
280
+ });
281
+
282
+ // Using service account key file
283
+ const voice = new GoogleVoice({
284
+ vertexAI: true,
285
+ project: "your-gcp-project",
286
+ speechModel: {
287
+ keyFilename: "/path/to/service-account.json",
288
+ },
289
+ listeningModel: {
290
+ keyFilename: "/path/to/service-account.json",
291
+ },
292
+ });
293
+
294
+ // Using in-memory credentials
295
+ const voice = new GoogleVoice({
296
+ vertexAI: true,
297
+ project: "your-gcp-project",
298
+ speechModel: {
299
+ credentials: {
300
+ client_email: "service-account@project.iam.gserviceaccount.com",
301
+ private_key: "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----",
302
+ },
303
+ },
304
+ });
305
+ ```
306
+
307
+ **Required Permissions:**
308
+
309
+ **IAM Roles:**
310
+
311
+ For Text-to-Speech:
312
+ - `roles/texttospeech.admin` - Text-to-Speech Admin (full access)
313
+ - `roles/texttospeech.editor` - Text-to-Speech Editor (create and manage)
314
+ - `roles/texttospeech.viewer` - Text-to-Speech Viewer (read-only)
315
+
316
+ For Speech-to-Text:
317
+ - `roles/speech.client` - Speech-to-Text Client
318
+
319
+ **OAuth Scopes:**
320
+
321
+ For synchronous Text-to-Speech synthesis:
322
+ - `https://www.googleapis.com/auth/cloud-platform` - Full access to Google Cloud Platform services
323
+
324
+ For long-audio Text-to-Speech operations:
325
+ - `locations.longAudioSynthesize` - Create long-audio synthesis operations
326
+ - `operations.get` - Get operation status
327
+ - `operations.list` - List operations
328
+
196
329
  ## Important Notes
197
330
 
198
- 1. A Google Cloud API key is required. Set it via the `GOOGLE_API_KEY` environment variable or pass it in the constructor.
199
- 2. The default voice is set to 'en-US-Casual-K'.
200
- 3. Both text-to-speech and speech-to-text services use LINEAR16 as the default audio encoding.
201
- 4. The `speak()` method supports advanced audio configuration through the Google Cloud Text-to-Speech API.
202
- 5. The `listen()` method supports various recognition configurations through the Google Cloud Speech-to-Text API.
203
- 6. Available voices can be filtered by language code using the `getSpeakers()` method.
331
+ 1. **Authentication**: Either a Google Cloud API key (standard mode) or service account credentials (Vertex AI mode) is required.
332
+ 2. **Environment Variables**:
333
+ - `GOOGLE_API_KEY` - API key for standard mode
334
+ - `GOOGLE_CLOUD_PROJECT` - Project ID for Vertex AI mode
335
+ - `GOOGLE_CLOUD_LOCATION` - Location for Vertex AI mode (defaults to 'us-central1')
336
+ - `GOOGLE_APPLICATION_CREDENTIALS` - Path to service account key file
337
+ 3. The default voice is set to `'en-US-Casual-K'`.
338
+ 4. Both text-to-speech and speech-to-text services use LINEAR16 as the default audio encoding.
339
+ 5. The `speak()` method supports advanced audio configuration through the Google Cloud Text-to-Speech API.
340
+ 6. The `listen()` method supports various recognition configurations through the Google Cloud Speech-to-Text API.
341
+ 7. Available voices can be filtered by language code using the `getSpeakers()` method.
342
+ 8. Vertex AI mode provides enterprise features including IAM control, audit logs, and project-level billing.
@@ -0,0 +1,142 @@
1
+ ---
2
+ title: "Reference: Run.restart() | Workflows"
3
+ description: Documentation for the `Run.restart()` method in workflows, which restarts an active workflow run that lost connection to the server.
4
+ ---
5
+
6
+ # Run.restart()
7
+
8
+ The `.restart()` method restarts an active workflow run that lost connection to the server, allowing you to continue execution from the moment it lost connection (the last active step).
9
+
10
+ ## Usage example
11
+
12
+ ```typescript showLineNumbers copy
13
+ const run = await workflow.createRun();
14
+
15
+ const result = await run.start({ inputData: { value: "initial data" } });
16
+
17
+ //.. server connection lost,
18
+
19
+ const restartedResult = await run.restart();
20
+ ```
21
+
22
+ ## Parameters
23
+
24
+ <PropertiesTable
25
+ content={[
26
+ {
27
+ name: "requestContext",
28
+ type: "RequestContext",
29
+ description: "Request Context data to use when resuming",
30
+ isOptional: true,
31
+ },
32
+ {
33
+ name: "tracingContext",
34
+ type: "TracingContext",
35
+ isOptional: true,
36
+ description:
37
+ "Tracing context for creating child spans and adding metadata. Automatically injected when using Mastra's tracing system.",
38
+ properties: [
39
+ {
40
+ parameters: [
41
+ {
42
+ name: "currentSpan",
43
+ type: "Span",
44
+ isOptional: true,
45
+ description:
46
+ "Current span for creating child spans and adding metadata. Use this to create custom child spans or update span attributes during execution.",
47
+ },
48
+ ],
49
+ },
50
+ ],
51
+ },
52
+ {
53
+ name: "tracingOptions",
54
+ type: "TracingOptions",
55
+ isOptional: true,
56
+ description: "Options for Tracing configuration.",
57
+ properties: [
58
+ {
59
+ parameters: [
60
+ {
61
+ name: "metadata",
62
+ type: "Record<string, any>",
63
+ isOptional: true,
64
+ description:
65
+ "Metadata to add to the root trace span. Useful for adding custom attributes like user IDs, session IDs, or feature flags.",
66
+ },
67
+ ],
68
+ },
69
+ {
70
+ parameters: [
71
+ {
72
+ name: "requestContextKeys",
73
+ type: "string[]",
74
+ isOptional: true,
75
+ description:
76
+ "Additional RequestContext keys to extract as metadata for this trace. Supports dot notation for nested values (e.g., 'user.id').",
77
+ },
78
+ ],
79
+ },
80
+ {
81
+ parameters: [
82
+ {
83
+ name: "traceId",
84
+ type: "string",
85
+ isOptional: true,
86
+ description:
87
+ "Trace ID to use for this execution (1-32 hexadecimal characters). If provided, this trace will be part of the specified trace.",
88
+ },
89
+ ],
90
+ },
91
+ {
92
+ parameters: [
93
+ {
94
+ name: "parentSpanId",
95
+ type: "string",
96
+ isOptional: true,
97
+ description:
98
+ "Parent span ID to use for this execution (1-16 hexadecimal characters). If provided, the root span will be created as a child of this span.",
99
+ },
100
+ ],
101
+ },
102
+ {
103
+ parameters: [
104
+ {
105
+ name: "tags",
106
+ type: "string[]",
107
+ isOptional: true,
108
+ description:
109
+ "Tags to apply to this trace. String labels for categorizing and filtering traces.",
110
+ },
111
+ ],
112
+ },
113
+ ],
114
+ },
115
+ ]}
116
+ />
117
+
118
+ ## Returns
119
+
120
+ <PropertiesTable
121
+ content={[
122
+ {
123
+ name: "result",
124
+ type: "Promise<WorkflowResult<TState, TOutput, TSteps>>",
125
+ description:
126
+ "A promise that resolves to the workflow execution result containing step outputs and status",
127
+ },
128
+ {
129
+ name: "traceId",
130
+ type: "string",
131
+ isOptional: true,
132
+ description:
133
+ "The trace ID associated with this execution when Tracing is enabled. Use this to correlate logs and debug execution flow.",
134
+ },
135
+ ]}
136
+ />
137
+
138
+ ## Related
139
+
140
+ - [Workflows overview](/docs/v1/workflows/overview#running-workflows)
141
+ - [Restart workflows](/docs/v1/workflows/overview#restarting-active-workflow-runs)
142
+ - [Workflow.createRun()](../workflow-methods/create-run)