@mastra/mcp-docs-server 0.0.0-commonjs-20250414101718
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%2Fastra.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fchroma.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +161 -0
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +110 -0
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fevals.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Ffirecrawl.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fgithub.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Floggers.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +26 -0
- package/.docs/organized/changelogs/%40mastra%2Fmcp.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fmem0.md +196 -0
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Frag.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fragie.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fspeech-azure.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fspeech-deepgram.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fspeech-elevenlabs.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fspeech-google.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fspeech-ibm.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fspeech-murf.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fspeech-openai.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fspeech-playai.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fspeech-replicate.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fspeech-speechify.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fupstash.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-azure.md +250 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +250 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +302 -0
- package/.docs/organized/changelogs/create-mastra.md +302 -0
- package/.docs/organized/changelogs/mastra.md +302 -0
- package/.docs/organized/code-examples/agent-network.md +282 -0
- package/.docs/organized/code-examples/agent.md +388 -0
- package/.docs/organized/code-examples/ai-sdk-useChat.md +378 -0
- package/.docs/organized/code-examples/assistant-ui.md +37 -0
- package/.docs/organized/code-examples/bird-checker-with-express.md +235 -0
- package/.docs/organized/code-examples/bird-checker-with-nextjs-and-eval.md +360 -0
- package/.docs/organized/code-examples/bird-checker-with-nextjs.md +250 -0
- package/.docs/organized/code-examples/client-side-tools.md +69 -0
- package/.docs/organized/code-examples/crypto-chatbot.md +96 -0
- package/.docs/organized/code-examples/fireworks-r1.md +159 -0
- package/.docs/organized/code-examples/mcp-registry-registry.md +63 -0
- package/.docs/organized/code-examples/memory-todo-agent.md +164 -0
- package/.docs/organized/code-examples/memory-with-context.md +167 -0
- package/.docs/organized/code-examples/memory-with-libsql.md +204 -0
- package/.docs/organized/code-examples/memory-with-mem0.md +121 -0
- package/.docs/organized/code-examples/memory-with-pg.md +224 -0
- package/.docs/organized/code-examples/memory-with-upstash.md +268 -0
- package/.docs/organized/code-examples/quick-start.md +129 -0
- package/.docs/organized/code-examples/stock-price-tool.md +124 -0
- package/.docs/organized/code-examples/weather-agent.md +353 -0
- package/.docs/organized/code-examples/workflow-ai-recruiter.md +159 -0
- package/.docs/organized/code-examples/workflow-with-inline-steps.md +111 -0
- package/.docs/organized/code-examples/workflow-with-memory.md +393 -0
- package/.docs/organized/code-examples/workflow-with-separate-steps.md +131 -0
- package/.docs/raw/agents/adding-tools.mdx +317 -0
- package/.docs/raw/agents/adding-voice.mdx +175 -0
- package/.docs/raw/agents/agent-memory.mdx +62 -0
- package/.docs/raw/agents/mcp-guide.mdx +215 -0
- package/.docs/raw/agents/overview.mdx +303 -0
- package/.docs/raw/community/discord.mdx +12 -0
- package/.docs/raw/community/licensing.mdx +63 -0
- package/.docs/raw/deployment/client.mdx +120 -0
- package/.docs/raw/deployment/deployment.mdx +127 -0
- package/.docs/raw/deployment/server.mdx +282 -0
- package/.docs/raw/evals/custom-eval.mdx +22 -0
- package/.docs/raw/evals/overview.mdx +95 -0
- package/.docs/raw/evals/running-in-ci.mdx +81 -0
- package/.docs/raw/evals/textual-evals.mdx +54 -0
- package/.docs/raw/faq/index.mdx +63 -0
- package/.docs/raw/frameworks/ai-sdk.mdx +296 -0
- package/.docs/raw/frameworks/next-js.mdx +238 -0
- package/.docs/raw/getting-started/installation.mdx +442 -0
- package/.docs/raw/getting-started/mcp-docs-server.mdx +141 -0
- package/.docs/raw/getting-started/project-structure.mdx +80 -0
- package/.docs/raw/index.mdx +22 -0
- package/.docs/raw/integrations/index.mdx +213 -0
- package/.docs/raw/local-dev/add-to-existing-project.mdx +48 -0
- package/.docs/raw/local-dev/creating-a-new-project.mdx +54 -0
- package/.docs/raw/local-dev/mastra-dev.mdx +108 -0
- package/.docs/raw/memory/memory-processors.mdx +131 -0
- package/.docs/raw/memory/overview.mdx +119 -0
- package/.docs/raw/memory/semantic-recall.mdx +122 -0
- package/.docs/raw/memory/working-memory.mdx +87 -0
- package/.docs/raw/observability/logging.mdx +38 -0
- package/.docs/raw/observability/nextjs-tracing.mdx +108 -0
- package/.docs/raw/observability/tracing.mdx +115 -0
- package/.docs/raw/rag/chunking-and-embedding.mdx +156 -0
- package/.docs/raw/rag/overview.mdx +85 -0
- package/.docs/raw/rag/retrieval.mdx +365 -0
- package/.docs/raw/rag/vector-databases.mdx +340 -0
- package/.docs/raw/reference/agents/createTool.mdx +229 -0
- package/.docs/raw/reference/agents/generate.mdx +334 -0
- package/.docs/raw/reference/agents/getAgent.mdx +54 -0
- package/.docs/raw/reference/agents/stream.mdx +369 -0
- package/.docs/raw/reference/cli/build.mdx +55 -0
- package/.docs/raw/reference/cli/dev.mdx +134 -0
- package/.docs/raw/reference/cli/init.mdx +43 -0
- package/.docs/raw/reference/client-js/agents.mdx +107 -0
- package/.docs/raw/reference/client-js/error-handling.mdx +38 -0
- package/.docs/raw/reference/client-js/logs.mdx +24 -0
- package/.docs/raw/reference/client-js/memory.mdx +97 -0
- package/.docs/raw/reference/client-js/telemetry.mdx +20 -0
- package/.docs/raw/reference/client-js/tools.mdx +44 -0
- package/.docs/raw/reference/client-js/vectors.mdx +79 -0
- package/.docs/raw/reference/client-js/workflows.mdx +136 -0
- package/.docs/raw/reference/core/mastra-class.mdx +232 -0
- package/.docs/raw/reference/deployer/cloudflare.mdx +207 -0
- package/.docs/raw/reference/deployer/deployer.mdx +159 -0
- package/.docs/raw/reference/deployer/netlify.mdx +109 -0
- package/.docs/raw/reference/deployer/vercel.mdx +117 -0
- package/.docs/raw/reference/evals/answer-relevancy.mdx +186 -0
- package/.docs/raw/reference/evals/bias.mdx +186 -0
- package/.docs/raw/reference/evals/completeness.mdx +174 -0
- package/.docs/raw/reference/evals/content-similarity.mdx +183 -0
- package/.docs/raw/reference/evals/context-position.mdx +190 -0
- package/.docs/raw/reference/evals/context-precision.mdx +189 -0
- package/.docs/raw/reference/evals/context-relevancy.mdx +188 -0
- package/.docs/raw/reference/evals/contextual-recall.mdx +191 -0
- package/.docs/raw/reference/evals/faithfulness.mdx +193 -0
- package/.docs/raw/reference/evals/hallucination.mdx +219 -0
- package/.docs/raw/reference/evals/keyword-coverage.mdx +176 -0
- package/.docs/raw/reference/evals/prompt-alignment.mdx +238 -0
- package/.docs/raw/reference/evals/summarization.mdx +205 -0
- package/.docs/raw/reference/evals/textual-difference.mdx +161 -0
- package/.docs/raw/reference/evals/tone-consistency.mdx +181 -0
- package/.docs/raw/reference/evals/toxicity.mdx +165 -0
- package/.docs/raw/reference/index.mdx +12 -0
- package/.docs/raw/reference/memory/Memory.mdx +212 -0
- package/.docs/raw/reference/memory/createThread.mdx +95 -0
- package/.docs/raw/reference/memory/getThreadById.mdx +46 -0
- package/.docs/raw/reference/memory/getThreadsByResourceId.mdx +48 -0
- package/.docs/raw/reference/memory/query.mdx +167 -0
- package/.docs/raw/reference/networks/agent-network.mdx +159 -0
- package/.docs/raw/reference/observability/create-logger.mdx +106 -0
- package/.docs/raw/reference/observability/logger.mdx +55 -0
- package/.docs/raw/reference/observability/otel-config.mdx +120 -0
- package/.docs/raw/reference/observability/providers/braintrust.mdx +40 -0
- package/.docs/raw/reference/observability/providers/dash0.mdx +40 -0
- package/.docs/raw/reference/observability/providers/index.mdx +16 -0
- package/.docs/raw/reference/observability/providers/laminar.mdx +41 -0
- package/.docs/raw/reference/observability/providers/langfuse.mdx +51 -0
- package/.docs/raw/reference/observability/providers/langsmith.mdx +48 -0
- package/.docs/raw/reference/observability/providers/langwatch.mdx +45 -0
- package/.docs/raw/reference/observability/providers/new-relic.mdx +40 -0
- package/.docs/raw/reference/observability/providers/signoz.mdx +40 -0
- package/.docs/raw/reference/observability/providers/traceloop.mdx +40 -0
- package/.docs/raw/reference/rag/astra.mdx +258 -0
- package/.docs/raw/reference/rag/chroma.mdx +281 -0
- package/.docs/raw/reference/rag/chunk.mdx +235 -0
- package/.docs/raw/reference/rag/document.mdx +127 -0
- package/.docs/raw/reference/rag/embeddings.mdx +160 -0
- package/.docs/raw/reference/rag/extract-params.mdx +226 -0
- package/.docs/raw/reference/rag/graph-rag.mdx +182 -0
- package/.docs/raw/reference/rag/libsql.mdx +357 -0
- package/.docs/raw/reference/rag/metadata-filters.mdx +298 -0
- package/.docs/raw/reference/rag/pg.mdx +477 -0
- package/.docs/raw/reference/rag/pinecone.mdx +281 -0
- package/.docs/raw/reference/rag/qdrant.mdx +236 -0
- package/.docs/raw/reference/rag/rerank.mdx +212 -0
- package/.docs/raw/reference/rag/turbopuffer.mdx +249 -0
- package/.docs/raw/reference/rag/upstash.mdx +247 -0
- package/.docs/raw/reference/rag/vectorize.mdx +298 -0
- package/.docs/raw/reference/storage/libsql.mdx +74 -0
- package/.docs/raw/reference/storage/postgresql.mdx +48 -0
- package/.docs/raw/reference/storage/upstash.mdx +86 -0
- package/.docs/raw/reference/tools/client.mdx +207 -0
- package/.docs/raw/reference/tools/document-chunker-tool.mdx +141 -0
- package/.docs/raw/reference/tools/graph-rag-tool.mdx +154 -0
- package/.docs/raw/reference/tools/mcp-configuration.mdx +206 -0
- package/.docs/raw/reference/tools/vector-query-tool.mdx +212 -0
- package/.docs/raw/reference/voice/composite-voice.mdx +140 -0
- package/.docs/raw/reference/voice/deepgram.mdx +164 -0
- package/.docs/raw/reference/voice/elevenlabs.mdx +216 -0
- package/.docs/raw/reference/voice/google.mdx +198 -0
- package/.docs/raw/reference/voice/mastra-voice.mdx +394 -0
- package/.docs/raw/reference/voice/murf.mdx +251 -0
- package/.docs/raw/reference/voice/openai-realtime.mdx +431 -0
- package/.docs/raw/reference/voice/openai.mdx +168 -0
- package/.docs/raw/reference/voice/playai.mdx +159 -0
- package/.docs/raw/reference/voice/sarvam.mdx +260 -0
- package/.docs/raw/reference/voice/speechify.mdx +145 -0
- package/.docs/raw/reference/voice/voice.answer.mdx +122 -0
- package/.docs/raw/reference/voice/voice.connect.mdx +124 -0
- package/.docs/raw/reference/voice/voice.listen.mdx +195 -0
- package/.docs/raw/reference/voice/voice.on.mdx +189 -0
- package/.docs/raw/reference/voice/voice.send.mdx +118 -0
- package/.docs/raw/reference/voice/voice.speak.mdx +203 -0
- package/.docs/raw/reference/workflows/after.mdx +88 -0
- package/.docs/raw/reference/workflows/afterEvent.mdx +76 -0
- package/.docs/raw/reference/workflows/commit.mdx +37 -0
- package/.docs/raw/reference/workflows/createRun.mdx +77 -0
- package/.docs/raw/reference/workflows/else.mdx +72 -0
- package/.docs/raw/reference/workflows/events.mdx +305 -0
- package/.docs/raw/reference/workflows/execute.mdx +110 -0
- package/.docs/raw/reference/workflows/if.mdx +107 -0
- package/.docs/raw/reference/workflows/resume.mdx +155 -0
- package/.docs/raw/reference/workflows/resumeWithEvent.mdx +133 -0
- package/.docs/raw/reference/workflows/snapshots.mdx +207 -0
- package/.docs/raw/reference/workflows/start.mdx +84 -0
- package/.docs/raw/reference/workflows/step-class.mdx +100 -0
- package/.docs/raw/reference/workflows/step-condition.mdx +134 -0
- package/.docs/raw/reference/workflows/step-function.mdx +92 -0
- package/.docs/raw/reference/workflows/step-options.mdx +69 -0
- package/.docs/raw/reference/workflows/step-retries.mdx +203 -0
- package/.docs/raw/reference/workflows/suspend.mdx +70 -0
- package/.docs/raw/reference/workflows/then.mdx +74 -0
- package/.docs/raw/reference/workflows/until.mdx +165 -0
- package/.docs/raw/reference/workflows/watch.mdx +118 -0
- package/.docs/raw/reference/workflows/while.mdx +168 -0
- package/.docs/raw/reference/workflows/workflow.mdx +233 -0
- package/.docs/raw/storage/overview.mdx +378 -0
- package/.docs/raw/voice/overview.mdx +135 -0
- package/.docs/raw/voice/speech-to-text.mdx +45 -0
- package/.docs/raw/voice/text-to-speech.mdx +52 -0
- package/.docs/raw/voice/voice-to-voice.mdx +310 -0
- package/.docs/raw/workflows/control-flow.mdx +778 -0
- package/.docs/raw/workflows/dynamic-workflows.mdx +236 -0
- package/.docs/raw/workflows/error-handling.mdx +183 -0
- package/.docs/raw/workflows/nested-workflows.mdx +352 -0
- package/.docs/raw/workflows/overview.mdx +203 -0
- package/.docs/raw/workflows/steps.mdx +108 -0
- package/.docs/raw/workflows/suspend-and-resume.mdx +404 -0
- package/.docs/raw/workflows/variables.mdx +313 -0
- package/LICENSE.md +46 -0
- package/README.md +129 -0
- package/dist/_tsup-dts-rollup.d.ts +149 -0
- package/dist/chunk-QWYMT5LP.js +194 -0
- package/dist/prepare-docs/prepare.d.ts +1 -0
- package/dist/prepare-docs/prepare.js +1 -0
- package/dist/stdio.d.ts +1 -0
- package/dist/stdio.js +518 -0
- package/package.json +60 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Reference: CompositeVoice | Voice Providers | Mastra Docs"
|
|
3
|
+
description: "Documentation for the CompositeVoice class, which enables combining multiple voice providers for flexible text-to-speech and speech-to-text operations."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# CompositeVoice
|
|
7
|
+
|
|
8
|
+
The CompositeVoice class allows you to combine different voice providers for text-to-speech and speech-to-text operations. This is particularly useful when you want to use the best provider for each operation - for example, using OpenAI for speech-to-text and PlayAI for text-to-speech.
|
|
9
|
+
|
|
10
|
+
CompositeVoice is used internally by the Agent class to provide flexible voice capabilities.
|
|
11
|
+
|
|
12
|
+
## Usage Example
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
import { CompositeVoice } from "@mastra/core/voice";
|
|
16
|
+
import { OpenAIVoice } from "@mastra/voice-openai";
|
|
17
|
+
import { PlayAIVoice } from "@mastra/voice-playai";
|
|
18
|
+
|
|
19
|
+
// Create voice providers
|
|
20
|
+
const openai = new OpenAIVoice();
|
|
21
|
+
const playai = new PlayAIVoice();
|
|
22
|
+
|
|
23
|
+
// Use OpenAI for listening (speech-to-text) and PlayAI for speaking (text-to-speech)
|
|
24
|
+
const voice = new CompositeVoice({
|
|
25
|
+
input: openai,
|
|
26
|
+
output: playai
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// Convert speech to text using OpenAI
|
|
30
|
+
const text = await voice.listen(audioStream);
|
|
31
|
+
|
|
32
|
+
// Convert text to speech using PlayAI
|
|
33
|
+
const audio = await voice.speak("Hello, world!");
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Constructor Parameters
|
|
37
|
+
|
|
38
|
+
<PropertiesTable
|
|
39
|
+
content={[
|
|
40
|
+
{
|
|
41
|
+
name: "config",
|
|
42
|
+
type: "object",
|
|
43
|
+
description: "Configuration object for the composite voice service",
|
|
44
|
+
isOptional: false,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: "config.input",
|
|
48
|
+
type: "MastraVoice",
|
|
49
|
+
description: "Voice provider to use for speech-to-text operations",
|
|
50
|
+
isOptional: true,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: "config.output",
|
|
54
|
+
type: "MastraVoice",
|
|
55
|
+
description: "Voice provider to use for text-to-speech operations",
|
|
56
|
+
isOptional: true,
|
|
57
|
+
},
|
|
58
|
+
]}
|
|
59
|
+
/>
|
|
60
|
+
|
|
61
|
+
## Methods
|
|
62
|
+
|
|
63
|
+
### speak()
|
|
64
|
+
|
|
65
|
+
Converts text to speech using the configured speaking provider.
|
|
66
|
+
|
|
67
|
+
<PropertiesTable
|
|
68
|
+
content={[
|
|
69
|
+
{
|
|
70
|
+
name: "input",
|
|
71
|
+
type: "string | NodeJS.ReadableStream",
|
|
72
|
+
description: "Text to convert to speech",
|
|
73
|
+
isOptional: false,
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: "options",
|
|
77
|
+
type: "object",
|
|
78
|
+
description: "Provider-specific options passed to the speaking provider",
|
|
79
|
+
isOptional: true,
|
|
80
|
+
},
|
|
81
|
+
]}
|
|
82
|
+
/>
|
|
83
|
+
|
|
84
|
+
Notes:
|
|
85
|
+
- If no speaking provider is configured, this method will throw an error
|
|
86
|
+
- Options are passed through to the configured speaking provider
|
|
87
|
+
- Returns a stream of audio data
|
|
88
|
+
|
|
89
|
+
### listen()
|
|
90
|
+
|
|
91
|
+
Converts speech to text using the configured listening provider.
|
|
92
|
+
|
|
93
|
+
<PropertiesTable
|
|
94
|
+
content={[
|
|
95
|
+
{
|
|
96
|
+
name: "audioStream",
|
|
97
|
+
type: "NodeJS.ReadableStream",
|
|
98
|
+
description: "Audio stream to convert to text",
|
|
99
|
+
isOptional: false,
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
name: "options",
|
|
103
|
+
type: "object",
|
|
104
|
+
description: "Provider-specific options passed to the listening provider",
|
|
105
|
+
isOptional: true,
|
|
106
|
+
},
|
|
107
|
+
]}
|
|
108
|
+
/>
|
|
109
|
+
|
|
110
|
+
Notes:
|
|
111
|
+
- If no listening provider is configured, this method will throw an error
|
|
112
|
+
- Options are passed through to the configured listening provider
|
|
113
|
+
- Returns either a string or a stream of transcribed text, depending on the provider
|
|
114
|
+
|
|
115
|
+
### getSpeakers()
|
|
116
|
+
|
|
117
|
+
Returns a list of available voices from the speaking provider, where each node contains:
|
|
118
|
+
|
|
119
|
+
<PropertiesTable
|
|
120
|
+
content={[
|
|
121
|
+
{
|
|
122
|
+
name: "voiceId",
|
|
123
|
+
type: "string",
|
|
124
|
+
description: "Unique identifier for the voice",
|
|
125
|
+
isOptional: false,
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
name: "key",
|
|
129
|
+
type: "value",
|
|
130
|
+
description: "Additional voice properties that vary by provider (e.g., name, language)",
|
|
131
|
+
isOptional: true,
|
|
132
|
+
},
|
|
133
|
+
]}
|
|
134
|
+
/>
|
|
135
|
+
|
|
136
|
+
Notes:
|
|
137
|
+
- Returns voices from the speaking provider only
|
|
138
|
+
- If no speaking provider is configured, returns an empty array
|
|
139
|
+
- Each voice object will have at least a voiceId property
|
|
140
|
+
- Additional voice properties depend on the speaking provider
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Reference: Deepgram Voice | Voice Providers | Mastra Docs"
|
|
3
|
+
description: "Documentation for the Deepgram voice implementation, providing text-to-speech and speech-to-text capabilities with multiple voice models and languages."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Deepgram
|
|
7
|
+
|
|
8
|
+
The Deepgram voice implementation in Mastra provides text-to-speech (TTS) and speech-to-text (STT) capabilities using Deepgram's API. It supports multiple voice models and languages, with configurable options for both speech synthesis and transcription.
|
|
9
|
+
|
|
10
|
+
## Usage Example
|
|
11
|
+
|
|
12
|
+
```typescript
|
|
13
|
+
import { DeepgramVoice } from "@mastra/voice-deepgram";
|
|
14
|
+
|
|
15
|
+
// Initialize with default configuration (uses DEEPGRAM_API_KEY environment variable)
|
|
16
|
+
const voice = new DeepgramVoice();
|
|
17
|
+
|
|
18
|
+
// Initialize with custom configuration
|
|
19
|
+
const voice = new DeepgramVoice({
|
|
20
|
+
speechModel: {
|
|
21
|
+
name: 'aura',
|
|
22
|
+
apiKey: 'your-api-key',
|
|
23
|
+
},
|
|
24
|
+
listeningModel: {
|
|
25
|
+
name: 'nova-2',
|
|
26
|
+
apiKey: 'your-api-key',
|
|
27
|
+
},
|
|
28
|
+
speaker: 'asteria-en',
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// Text-to-Speech
|
|
32
|
+
const audioStream = await voice.speak("Hello, world!");
|
|
33
|
+
|
|
34
|
+
// Speech-to-Text
|
|
35
|
+
const transcript = await voice.listen(audioStream);
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Constructor Parameters
|
|
39
|
+
|
|
40
|
+
<PropertiesTable
|
|
41
|
+
content={[
|
|
42
|
+
{
|
|
43
|
+
name: "speechModel",
|
|
44
|
+
type: "DeepgramVoiceConfig",
|
|
45
|
+
description: "Configuration for text-to-speech functionality.",
|
|
46
|
+
isOptional: true,
|
|
47
|
+
defaultValue: "{ name: 'aura' }"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: "listeningModel",
|
|
51
|
+
type: "DeepgramVoiceConfig",
|
|
52
|
+
description: "Configuration for speech-to-text functionality.",
|
|
53
|
+
isOptional: true,
|
|
54
|
+
defaultValue: "{ name: 'nova' }"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: "speaker",
|
|
58
|
+
type: "DeepgramVoiceId",
|
|
59
|
+
description: "Default voice to use for text-to-speech",
|
|
60
|
+
isOptional: true,
|
|
61
|
+
defaultValue: "'asteria-en'",
|
|
62
|
+
},
|
|
63
|
+
]}
|
|
64
|
+
/>
|
|
65
|
+
|
|
66
|
+
### DeepgramVoiceConfig
|
|
67
|
+
|
|
68
|
+
<PropertiesTable
|
|
69
|
+
content={[
|
|
70
|
+
{
|
|
71
|
+
name: "name",
|
|
72
|
+
type: "DeepgramModel",
|
|
73
|
+
description: "The Deepgram model to use",
|
|
74
|
+
isOptional: true,
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: "apiKey",
|
|
78
|
+
type: "string",
|
|
79
|
+
description: "Deepgram API key. Falls back to DEEPGRAM_API_KEY environment variable",
|
|
80
|
+
isOptional: true,
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: "properties",
|
|
84
|
+
type: "Record<string, any>",
|
|
85
|
+
description: "Additional properties to pass to the Deepgram API",
|
|
86
|
+
isOptional: true,
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: "language",
|
|
90
|
+
type: "string",
|
|
91
|
+
description: "Language code for the model",
|
|
92
|
+
isOptional: true,
|
|
93
|
+
},
|
|
94
|
+
]}
|
|
95
|
+
/>
|
|
96
|
+
|
|
97
|
+
## Methods
|
|
98
|
+
|
|
99
|
+
### speak()
|
|
100
|
+
|
|
101
|
+
Converts text to speech using the configured speech model and voice.
|
|
102
|
+
|
|
103
|
+
<PropertiesTable
|
|
104
|
+
content={[
|
|
105
|
+
{
|
|
106
|
+
name: "input",
|
|
107
|
+
type: "string | NodeJS.ReadableStream",
|
|
108
|
+
description: "Text to convert to speech. If a stream is provided, it will be converted to text first.",
|
|
109
|
+
isOptional: false,
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: "options",
|
|
113
|
+
type: "object",
|
|
114
|
+
description: "Additional options for speech synthesis",
|
|
115
|
+
isOptional: true,
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
name: "options.speaker",
|
|
119
|
+
type: "string",
|
|
120
|
+
description: "Override the default speaker for this request",
|
|
121
|
+
isOptional: true,
|
|
122
|
+
},
|
|
123
|
+
]}
|
|
124
|
+
/>
|
|
125
|
+
|
|
126
|
+
Returns: `Promise<NodeJS.ReadableStream>`
|
|
127
|
+
|
|
128
|
+
### listen()
|
|
129
|
+
|
|
130
|
+
Converts speech to text using the configured listening model.
|
|
131
|
+
|
|
132
|
+
<PropertiesTable
|
|
133
|
+
content={[
|
|
134
|
+
{
|
|
135
|
+
name: "audioStream",
|
|
136
|
+
type: "NodeJS.ReadableStream",
|
|
137
|
+
description: "Audio stream to transcribe",
|
|
138
|
+
isOptional: false,
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
name: "options",
|
|
142
|
+
type: "object",
|
|
143
|
+
description: "Additional options to pass to the Deepgram API",
|
|
144
|
+
isOptional: true,
|
|
145
|
+
},
|
|
146
|
+
]}
|
|
147
|
+
/>
|
|
148
|
+
|
|
149
|
+
Returns: `Promise<string>`
|
|
150
|
+
|
|
151
|
+
### getSpeakers()
|
|
152
|
+
|
|
153
|
+
Returns a list of available voice options.
|
|
154
|
+
|
|
155
|
+
<PropertiesTable
|
|
156
|
+
content={[
|
|
157
|
+
{
|
|
158
|
+
name: "voiceId",
|
|
159
|
+
type: "string",
|
|
160
|
+
description: "Unique identifier for the voice",
|
|
161
|
+
isOptional: false,
|
|
162
|
+
}
|
|
163
|
+
]}
|
|
164
|
+
/>
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Reference: ElevenLabs Voice | Voice Providers | Mastra Docs"
|
|
3
|
+
description: "Documentation for the ElevenLabs voice implementation, offering high-quality text-to-speech capabilities with multiple voice models and natural-sounding synthesis."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# ElevenLabs
|
|
7
|
+
|
|
8
|
+
The ElevenLabs voice implementation in Mastra provides high-quality text-to-speech (TTS) and speech-to-text (STT) capabilities using the ElevenLabs API.
|
|
9
|
+
|
|
10
|
+
## Usage Example
|
|
11
|
+
|
|
12
|
+
```typescript
|
|
13
|
+
import { ElevenLabsVoice } from "@mastra/voice-elevenlabs";
|
|
14
|
+
|
|
15
|
+
// Initialize with default configuration (uses ELEVENLABS_API_KEY environment variable)
|
|
16
|
+
const voice = new ElevenLabsVoice();
|
|
17
|
+
|
|
18
|
+
// Initialize with custom configuration
|
|
19
|
+
const voice = new ElevenLabsVoice({
|
|
20
|
+
speechModel: {
|
|
21
|
+
name: 'eleven_multilingual_v2',
|
|
22
|
+
apiKey: 'your-api-key',
|
|
23
|
+
},
|
|
24
|
+
speaker: 'custom-speaker-id',
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
// Text-to-Speech
|
|
28
|
+
const audioStream = await voice.speak("Hello, world!");
|
|
29
|
+
|
|
30
|
+
// Get available speakers
|
|
31
|
+
const speakers = await voice.getSpeakers();
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Constructor Parameters
|
|
35
|
+
|
|
36
|
+
<PropertiesTable
|
|
37
|
+
content={[
|
|
38
|
+
{
|
|
39
|
+
name: "speechModel",
|
|
40
|
+
type: "ElevenLabsVoiceConfig",
|
|
41
|
+
description: "Configuration for text-to-speech functionality.",
|
|
42
|
+
isOptional: true,
|
|
43
|
+
defaultValue: "{ name: 'eleven_multilingual_v2' }"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: "speaker",
|
|
47
|
+
type: "string",
|
|
48
|
+
description: "ID of the speaker to use for text-to-speech",
|
|
49
|
+
isOptional: true,
|
|
50
|
+
defaultValue: "'9BWtsMINqrJLrRacOk9x' (Aria voice)",
|
|
51
|
+
},
|
|
52
|
+
]}
|
|
53
|
+
/>
|
|
54
|
+
|
|
55
|
+
### ElevenLabsVoiceConfig
|
|
56
|
+
|
|
57
|
+
<PropertiesTable
|
|
58
|
+
content={[
|
|
59
|
+
{
|
|
60
|
+
name: "name",
|
|
61
|
+
type: "ElevenLabsModel",
|
|
62
|
+
description: "The ElevenLabs model to use",
|
|
63
|
+
isOptional: true,
|
|
64
|
+
defaultValue: "'eleven_multilingual_v2'",
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: "apiKey",
|
|
68
|
+
type: "string",
|
|
69
|
+
description: "ElevenLabs API key. Falls back to ELEVENLABS_API_KEY environment variable",
|
|
70
|
+
isOptional: true,
|
|
71
|
+
},
|
|
72
|
+
]}
|
|
73
|
+
/>
|
|
74
|
+
|
|
75
|
+
## Methods
|
|
76
|
+
|
|
77
|
+
### speak()
|
|
78
|
+
|
|
79
|
+
Converts text to speech using the configured speech model and voice.
|
|
80
|
+
|
|
81
|
+
<PropertiesTable
|
|
82
|
+
content={[
|
|
83
|
+
{
|
|
84
|
+
name: "input",
|
|
85
|
+
type: "string | NodeJS.ReadableStream",
|
|
86
|
+
description: "Text to convert to speech. If a stream is provided, it will be converted to text first.",
|
|
87
|
+
isOptional: false,
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: "options",
|
|
91
|
+
type: "object",
|
|
92
|
+
description: "Additional options for speech synthesis",
|
|
93
|
+
isOptional: true,
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: "options.speaker",
|
|
97
|
+
type: "string",
|
|
98
|
+
description: "Override the default speaker ID for this request",
|
|
99
|
+
isOptional: true,
|
|
100
|
+
},
|
|
101
|
+
]}
|
|
102
|
+
/>
|
|
103
|
+
|
|
104
|
+
Returns: `Promise<NodeJS.ReadableStream>`
|
|
105
|
+
|
|
106
|
+
### getSpeakers()
|
|
107
|
+
|
|
108
|
+
Returns an array of available voice options, where each node contains:
|
|
109
|
+
|
|
110
|
+
<PropertiesTable
|
|
111
|
+
content={[
|
|
112
|
+
{
|
|
113
|
+
name: "voiceId",
|
|
114
|
+
type: "string",
|
|
115
|
+
description: "Unique identifier for the voice",
|
|
116
|
+
isOptional: false,
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: "name",
|
|
120
|
+
type: "string",
|
|
121
|
+
description: "Display name of the voice",
|
|
122
|
+
isOptional: false,
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name: "language",
|
|
126
|
+
type: "string",
|
|
127
|
+
description: "Language code for the voice",
|
|
128
|
+
isOptional: false,
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
name: "gender",
|
|
132
|
+
type: "string",
|
|
133
|
+
description: "Gender of the voice",
|
|
134
|
+
isOptional: false,
|
|
135
|
+
}
|
|
136
|
+
]}
|
|
137
|
+
/>
|
|
138
|
+
|
|
139
|
+
### listen()
|
|
140
|
+
|
|
141
|
+
Converts audio input to text using ElevenLabs Speech-to-Text API.
|
|
142
|
+
|
|
143
|
+
<PropertiesTable
|
|
144
|
+
content={[
|
|
145
|
+
{
|
|
146
|
+
name: "input",
|
|
147
|
+
type: "NodeJS.ReadableStream",
|
|
148
|
+
description: "A readable stream containing the audio data to transcribe",
|
|
149
|
+
isOptional: false,
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
name: "options",
|
|
153
|
+
type: "object",
|
|
154
|
+
description: "Configuration options for the transcription",
|
|
155
|
+
isOptional: true,
|
|
156
|
+
},
|
|
157
|
+
]}
|
|
158
|
+
/>
|
|
159
|
+
|
|
160
|
+
The options object supports the following properties:
|
|
161
|
+
|
|
162
|
+
<PropertiesTable
|
|
163
|
+
content={[
|
|
164
|
+
{
|
|
165
|
+
name: "language_code",
|
|
166
|
+
type: "string",
|
|
167
|
+
description: "ISO language code (e.g., 'en', 'fr', 'es')",
|
|
168
|
+
isOptional: true,
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
name: "tag_audio_events",
|
|
172
|
+
type: "boolean",
|
|
173
|
+
description: "Whether to tag audio events like [MUSIC], [LAUGHTER], etc.",
|
|
174
|
+
isOptional: true,
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
name: "num_speakers",
|
|
178
|
+
type: "number",
|
|
179
|
+
description: "Number of speakers to detect in the audio",
|
|
180
|
+
isOptional: true,
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
name: "filetype",
|
|
184
|
+
type: "string",
|
|
185
|
+
description: "Audio file format (e.g., 'mp3', 'wav', 'ogg')",
|
|
186
|
+
isOptional: true,
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
name: "timeoutInSeconds",
|
|
190
|
+
type: "number",
|
|
191
|
+
description: "Request timeout in seconds",
|
|
192
|
+
isOptional: true,
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
name: "maxRetries",
|
|
196
|
+
type: "number",
|
|
197
|
+
description: "Maximum number of retry attempts",
|
|
198
|
+
isOptional: true,
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
name: "abortSignal",
|
|
202
|
+
type: "AbortSignal",
|
|
203
|
+
description: "Signal to abort the request",
|
|
204
|
+
isOptional: true,
|
|
205
|
+
}
|
|
206
|
+
]}
|
|
207
|
+
/>
|
|
208
|
+
|
|
209
|
+
Returns: `Promise<string>` - A Promise that resolves to the transcribed text
|
|
210
|
+
|
|
211
|
+
## Important Notes
|
|
212
|
+
|
|
213
|
+
1. An ElevenLabs API key is required. Set it via the `ELEVENLABS_API_KEY` environment variable or pass it in the constructor.
|
|
214
|
+
2. The default speaker is set to Aria (ID: '9BWtsMINqrJLrRacOk9x').
|
|
215
|
+
3. Speech-to-text functionality is not supported by ElevenLabs.
|
|
216
|
+
4. Available speakers can be retrieved using the `getSpeakers()` method, which returns detailed information about each voice including language and gender.
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Reference: Google Voice | Voice Providers | Mastra Docs"
|
|
3
|
+
description: "Documentation for the Google Voice implementation, providing text-to-speech and speech-to-text capabilities."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Google
|
|
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.
|
|
9
|
+
|
|
10
|
+
## Usage Example
|
|
11
|
+
|
|
12
|
+
```typescript
|
|
13
|
+
import { GoogleVoice } from "@mastra/voice-google";
|
|
14
|
+
|
|
15
|
+
// Initialize with default configuration (uses GOOGLE_API_KEY environment variable)
|
|
16
|
+
const voice = new GoogleVoice();
|
|
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
|
+
// Text-to-Speech
|
|
30
|
+
const audioStream = await voice.speak("Hello, world!", {
|
|
31
|
+
languageCode: 'en-US',
|
|
32
|
+
audioConfig: {
|
|
33
|
+
audioEncoding: 'LINEAR16',
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// Speech-to-Text
|
|
38
|
+
const transcript = await voice.listen(audioStream, {
|
|
39
|
+
config: {
|
|
40
|
+
encoding: 'LINEAR16',
|
|
41
|
+
languageCode: 'en-US',
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// Get available voices for a specific language
|
|
46
|
+
const voices = await voice.getSpeakers({ languageCode: 'en-US' });
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Constructor Parameters
|
|
50
|
+
|
|
51
|
+
<PropertiesTable
|
|
52
|
+
content={[
|
|
53
|
+
{
|
|
54
|
+
name: "speechModel",
|
|
55
|
+
type: "GoogleModelConfig",
|
|
56
|
+
description: "Configuration for text-to-speech functionality",
|
|
57
|
+
isOptional: true,
|
|
58
|
+
defaultValue: "{ apiKey: process.env.GOOGLE_API_KEY }",
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: "listeningModel",
|
|
62
|
+
type: "GoogleModelConfig",
|
|
63
|
+
description: "Configuration for speech-to-text functionality",
|
|
64
|
+
isOptional: true,
|
|
65
|
+
defaultValue: "{ apiKey: process.env.GOOGLE_API_KEY }",
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: "speaker",
|
|
69
|
+
type: "string",
|
|
70
|
+
description: "Default voice ID to use for text-to-speech",
|
|
71
|
+
isOptional: true,
|
|
72
|
+
defaultValue: "'en-US-Casual-K'",
|
|
73
|
+
},
|
|
74
|
+
]}
|
|
75
|
+
/>
|
|
76
|
+
|
|
77
|
+
### GoogleModelConfig
|
|
78
|
+
|
|
79
|
+
<PropertiesTable
|
|
80
|
+
content={[
|
|
81
|
+
{
|
|
82
|
+
name: "apiKey",
|
|
83
|
+
type: "string",
|
|
84
|
+
description: "Google Cloud API key. Falls back to GOOGLE_API_KEY environment variable",
|
|
85
|
+
isOptional: true,
|
|
86
|
+
},
|
|
87
|
+
]}
|
|
88
|
+
/>
|
|
89
|
+
|
|
90
|
+
## Methods
|
|
91
|
+
|
|
92
|
+
### speak()
|
|
93
|
+
|
|
94
|
+
Converts text to speech using Google Cloud Text-to-Speech service.
|
|
95
|
+
|
|
96
|
+
<PropertiesTable
|
|
97
|
+
content={[
|
|
98
|
+
{
|
|
99
|
+
name: "input",
|
|
100
|
+
type: "string | NodeJS.ReadableStream",
|
|
101
|
+
description: "Text to convert to speech. If a stream is provided, it will be converted to text first.",
|
|
102
|
+
isOptional: false,
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: "options",
|
|
106
|
+
type: "object",
|
|
107
|
+
description: "Speech synthesis options",
|
|
108
|
+
isOptional: true,
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
name: "options.speaker",
|
|
112
|
+
type: "string",
|
|
113
|
+
description: "Voice ID to use for this request",
|
|
114
|
+
isOptional: true,
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: "options.languageCode",
|
|
118
|
+
type: "string",
|
|
119
|
+
description: "Language code for the voice (e.g., 'en-US'). Defaults to the language code from the speaker ID or 'en-US'",
|
|
120
|
+
isOptional: true,
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: "options.audioConfig",
|
|
124
|
+
type: "ISynthesizeSpeechRequest['audioConfig']",
|
|
125
|
+
description: "Audio configuration options from Google Cloud Text-to-Speech API",
|
|
126
|
+
isOptional: true,
|
|
127
|
+
defaultValue: "{ audioEncoding: 'LINEAR16' }",
|
|
128
|
+
},
|
|
129
|
+
]}
|
|
130
|
+
/>
|
|
131
|
+
|
|
132
|
+
Returns: `Promise<NodeJS.ReadableStream>`
|
|
133
|
+
|
|
134
|
+
### listen()
|
|
135
|
+
|
|
136
|
+
Converts speech to text using Google Cloud Speech-to-Text service.
|
|
137
|
+
|
|
138
|
+
<PropertiesTable
|
|
139
|
+
content={[
|
|
140
|
+
{
|
|
141
|
+
name: "audioStream",
|
|
142
|
+
type: "NodeJS.ReadableStream",
|
|
143
|
+
description: "Audio stream to transcribe",
|
|
144
|
+
isOptional: false,
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: "options",
|
|
148
|
+
type: "object",
|
|
149
|
+
description: "Recognition options",
|
|
150
|
+
isOptional: true,
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
name: "options.stream",
|
|
154
|
+
type: "boolean",
|
|
155
|
+
description: "Whether to use streaming recognition",
|
|
156
|
+
isOptional: true,
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
name: "options.config",
|
|
160
|
+
type: "IRecognitionConfig",
|
|
161
|
+
description: "Recognition configuration from Google Cloud Speech-to-Text API",
|
|
162
|
+
isOptional: true,
|
|
163
|
+
defaultValue: "{ encoding: 'LINEAR16', languageCode: 'en-US' }",
|
|
164
|
+
},
|
|
165
|
+
]}
|
|
166
|
+
/>
|
|
167
|
+
|
|
168
|
+
Returns: `Promise<string>`
|
|
169
|
+
|
|
170
|
+
### getSpeakers()
|
|
171
|
+
|
|
172
|
+
Returns an array of available voice options, where each node contains:
|
|
173
|
+
|
|
174
|
+
<PropertiesTable
|
|
175
|
+
content={[
|
|
176
|
+
{
|
|
177
|
+
name: "voiceId",
|
|
178
|
+
type: "string",
|
|
179
|
+
description: "Unique identifier for the voice",
|
|
180
|
+
isOptional: false,
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
name: "languageCodes",
|
|
184
|
+
type: "string[]",
|
|
185
|
+
description: "List of language codes supported by this voice",
|
|
186
|
+
isOptional: false,
|
|
187
|
+
}
|
|
188
|
+
]}
|
|
189
|
+
/>
|
|
190
|
+
|
|
191
|
+
## Important Notes
|
|
192
|
+
|
|
193
|
+
1. A Google Cloud API key is required. Set it via the `GOOGLE_API_KEY` environment variable or pass it in the constructor.
|
|
194
|
+
2. The default voice is set to 'en-US-Casual-K'.
|
|
195
|
+
3. Both text-to-speech and speech-to-text services use LINEAR16 as the default audio encoding.
|
|
196
|
+
4. The `speak()` method supports advanced audio configuration through the Google Cloud Text-to-Speech API.
|
|
197
|
+
5. The `listen()` method supports various recognition configurations through the Google Cloud Speech-to-Text API.
|
|
198
|
+
6. Available voices can be filtered by language code using the `getSpeakers()` method.
|