@mastra/mcp-docs-server 1.0.0-beta.5 → 1.0.0-beta.6
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/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +9 -9
- package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +67 -67
- package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +26 -26
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +53 -53
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +26 -26
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +27 -27
- package/.docs/organized/changelogs/%40mastra%2Fconvex.md +29 -0
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +274 -274
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +15 -15
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +12 -12
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +65 -65
- package/.docs/organized/changelogs/%40mastra%2Fduckdb.md +42 -0
- package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +26 -26
- package/.docs/organized/changelogs/%40mastra%2Felasticsearch.md +52 -0
- package/.docs/organized/changelogs/%40mastra%2Fevals.md +12 -12
- package/.docs/organized/changelogs/%40mastra%2Flance.md +26 -26
- package/.docs/organized/changelogs/%40mastra%2Flibsql.md +24 -24
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +9 -9
- package/.docs/organized/changelogs/%40mastra%2Fmcp.md +84 -84
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +36 -36
- package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +26 -26
- package/.docs/organized/changelogs/%40mastra%2Fmssql.md +27 -27
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +28 -28
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +47 -47
- package/.docs/organized/changelogs/%40mastra%2Frag.md +43 -43
- package/.docs/organized/changelogs/%40mastra%2Freact.md +9 -0
- package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +6 -0
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +56 -56
- package/.docs/organized/changelogs/%40mastra%2Fupstash.md +26 -26
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +19 -19
- package/.docs/organized/changelogs/create-mastra.md +9 -9
- package/.docs/organized/changelogs/mastra.md +17 -17
- package/.docs/organized/code-examples/agui.md +1 -0
- package/.docs/organized/code-examples/ai-sdk-v5.md +1 -0
- package/.docs/organized/code-examples/mcp-server-adapters.md +721 -0
- package/.docs/organized/code-examples/server-app-access.md +342 -0
- package/.docs/raw/agents/agent-approval.mdx +189 -0
- package/.docs/raw/agents/guardrails.mdx +13 -9
- package/.docs/raw/agents/networks.mdx +1 -0
- package/.docs/raw/agents/overview.mdx +23 -58
- package/.docs/raw/agents/processors.mdx +279 -0
- package/.docs/raw/deployment/cloud-providers/index.mdx +19 -26
- package/.docs/raw/deployment/cloud-providers/netlify-deployer.mdx +44 -13
- package/.docs/raw/evals/running-in-ci.mdx +0 -2
- package/.docs/raw/{guides/getting-started → getting-started}/manual-install.mdx +2 -2
- package/.docs/raw/getting-started/start.mdx +1 -1
- package/.docs/raw/guides/build-your-ui/ai-sdk-ui.mdx +8 -0
- package/.docs/raw/guides/getting-started/quickstart.mdx +1 -1
- package/.docs/raw/guides/guide/whatsapp-chat-bot.mdx +421 -0
- package/.docs/raw/guides/index.mdx +3 -35
- package/.docs/raw/guides/migrations/upgrade-to-v1/agent.mdx +11 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/workflows.mdx +29 -0
- package/.docs/raw/index.mdx +1 -1
- package/.docs/raw/memory/memory-processors.mdx +265 -79
- package/.docs/raw/memory/working-memory.mdx +10 -2
- package/.docs/raw/observability/overview.mdx +0 -1
- package/.docs/raw/observability/tracing/bridges/otel.mdx +176 -0
- package/.docs/raw/observability/tracing/exporters/arize.mdx +17 -0
- package/.docs/raw/observability/tracing/exporters/braintrust.mdx +19 -0
- package/.docs/raw/observability/tracing/exporters/langfuse.mdx +20 -0
- package/.docs/raw/observability/tracing/exporters/langsmith.mdx +12 -0
- package/.docs/raw/observability/tracing/exporters/otel.mdx +5 -4
- package/.docs/raw/observability/tracing/overview.mdx +71 -6
- package/.docs/raw/observability/tracing/processors/sensitive-data-filter.mdx +0 -1
- package/.docs/raw/rag/retrieval.mdx +23 -6
- package/.docs/raw/rag/vector-databases.mdx +93 -2
- package/.docs/raw/reference/agents/generate.mdx +55 -6
- package/.docs/raw/reference/agents/network.mdx +44 -0
- package/.docs/raw/reference/client-js/memory.mdx +43 -0
- package/.docs/raw/reference/client-js/workflows.mdx +92 -63
- package/.docs/raw/reference/deployer/netlify.mdx +1 -2
- package/.docs/raw/reference/evals/scorer-utils.mdx +362 -0
- package/.docs/raw/reference/index.mdx +1 -0
- package/.docs/raw/reference/observability/tracing/bridges/otel.mdx +150 -0
- package/.docs/raw/reference/observability/tracing/configuration.mdx +0 -4
- package/.docs/raw/reference/observability/tracing/exporters/arize.mdx +4 -0
- package/.docs/raw/reference/observability/tracing/exporters/langsmith.mdx +17 -1
- package/.docs/raw/reference/observability/tracing/exporters/otel.mdx +6 -0
- package/.docs/raw/reference/observability/tracing/instances.mdx +0 -4
- package/.docs/raw/reference/observability/tracing/interfaces.mdx +29 -4
- package/.docs/raw/reference/observability/tracing/spans.mdx +0 -4
- package/.docs/raw/reference/processors/language-detector.mdx +9 -2
- package/.docs/raw/reference/processors/message-history-processor.mdx +131 -0
- package/.docs/raw/reference/processors/moderation-processor.mdx +10 -3
- package/.docs/raw/reference/processors/pii-detector.mdx +10 -3
- package/.docs/raw/reference/processors/processor-interface.mdx +502 -0
- package/.docs/raw/reference/processors/prompt-injection-detector.mdx +9 -2
- package/.docs/raw/reference/processors/semantic-recall-processor.mdx +197 -0
- package/.docs/raw/reference/processors/system-prompt-scrubber.mdx +2 -2
- package/.docs/raw/reference/processors/tool-call-filter.mdx +125 -0
- package/.docs/raw/reference/processors/working-memory-processor.mdx +221 -0
- package/.docs/raw/reference/storage/cloudflare-d1.mdx +37 -0
- package/.docs/raw/reference/storage/convex.mdx +164 -0
- package/.docs/raw/reference/storage/lance.mdx +33 -0
- package/.docs/raw/reference/storage/libsql.mdx +37 -0
- package/.docs/raw/reference/storage/mongodb.mdx +39 -0
- package/.docs/raw/reference/storage/mssql.mdx +37 -0
- package/.docs/raw/reference/storage/postgresql.mdx +37 -0
- package/.docs/raw/reference/streaming/ChunkType.mdx +1 -1
- package/.docs/raw/reference/streaming/agents/stream.mdx +56 -1
- package/.docs/raw/reference/streaming/workflows/observeStream.mdx +7 -9
- package/.docs/raw/reference/streaming/workflows/{resumeStreamVNext.mdx → resumeStream.mdx} +51 -11
- package/.docs/raw/reference/streaming/workflows/stream.mdx +83 -24
- package/.docs/raw/reference/tools/mcp-client.mdx +74 -17
- package/.docs/raw/reference/vectors/convex.mdx +429 -0
- package/.docs/raw/reference/vectors/duckdb.mdx +462 -0
- package/.docs/raw/reference/vectors/elasticsearch.mdx +310 -0
- package/.docs/raw/reference/voice/google.mdx +159 -20
- package/.docs/raw/reference/workflows/run-methods/restart.mdx +142 -0
- package/.docs/raw/reference/workflows/run-methods/resume.mdx +44 -0
- package/.docs/raw/reference/workflows/run-methods/start.mdx +44 -0
- package/.docs/raw/reference/workflows/run.mdx +13 -5
- package/.docs/raw/reference/workflows/step.mdx +13 -0
- package/.docs/raw/reference/workflows/workflow.mdx +19 -0
- package/.docs/raw/server-db/mastra-server.mdx +30 -1
- package/.docs/raw/server-db/request-context.mdx +0 -1
- package/.docs/raw/server-db/storage.mdx +11 -0
- package/.docs/raw/streaming/overview.mdx +6 -6
- package/.docs/raw/streaming/tool-streaming.mdx +2 -2
- package/.docs/raw/streaming/workflow-streaming.mdx +5 -11
- package/.docs/raw/workflows/error-handling.mdx +1 -0
- package/.docs/raw/workflows/human-in-the-loop.mdx +4 -4
- package/.docs/raw/workflows/overview.mdx +56 -44
- package/.docs/raw/workflows/snapshots.mdx +1 -0
- package/.docs/raw/workflows/suspend-and-resume.mdx +85 -16
- package/.docs/raw/workflows/time-travel.mdx +313 -0
- package/.docs/raw/workflows/workflow-state.mdx +191 -0
- package/CHANGELOG.md +8 -0
- package/package.json +4 -4
- package/.docs/raw/agents/human-in-the-loop-with-tools.mdx +0 -91
- package/.docs/raw/reference/streaming/workflows/observeStreamVNext.mdx +0 -47
- 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,
|
|
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.
|
|
199
|
-
2.
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
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)
|