@mastra/mcp-docs-server 0.0.0-a2a-20250421213654
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 +253 -0
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +16 -0
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +202 -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 +113 -0
- package/.docs/organized/changelogs/%40mastra%2Fmcp.md +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fmem0.md +281 -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 +302 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +302 -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 +426 -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 +331 -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 +288 -0
- package/.docs/raw/agents/adding-voice.mdx +200 -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/agents/runtime-variables.mdx +137 -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/overview.mdx +63 -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/model-capability.mdx +11 -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 +124 -0
- package/.docs/raw/mastra-cloud/deploying.mdx +136 -0
- package/.docs/raw/mastra-cloud/observability.mdx +163 -0
- package/.docs/raw/mastra-cloud/overview.mdx +57 -0
- package/.docs/raw/mastra-cloud/setting-up.mdx +122 -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 +126 -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 +212 -0
- package/.docs/raw/reference/deployer/deployer.mdx +159 -0
- package/.docs/raw/reference/deployer/netlify.mdx +116 -0
- package/.docs/raw/reference/deployer/vercel.mdx +122 -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 +249 -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 +501 -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/cloudflare-d1.mdx +89 -0
- package/.docs/raw/reference/storage/cloudflare.mdx +93 -0
- package/.docs/raw/reference/storage/libsql.mdx +74 -0
- package/.docs/raw/reference/storage/postgresql.mdx +93 -0
- package/.docs/raw/reference/storage/upstash.mdx +86 -0
- package/.docs/raw/reference/tools/client.mdx +321 -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 +222 -0
- package/.docs/raw/reference/tools/vector-query-tool.mdx +212 -0
- package/.docs/raw/reference/voice/azure.mdx +215 -0
- package/.docs/raw/reference/voice/cloudflare.mdx +152 -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 +432 -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.addInstructions.mdx +70 -0
- package/.docs/raw/reference/voice/voice.addTools.mdx +77 -0
- package/.docs/raw/reference/voice/voice.answer.mdx +69 -0
- package/.docs/raw/reference/voice/voice.close.mdx +56 -0
- package/.docs/raw/reference/voice/voice.connect.mdx +124 -0
- package/.docs/raw/reference/voice/voice.events.mdx +80 -0
- package/.docs/raw/reference/voice/voice.getSpeakers.mdx +283 -0
- package/.docs/raw/reference/voice/voice.listen.mdx +198 -0
- package/.docs/raw/reference/voice/voice.off.mdx +72 -0
- package/.docs/raw/reference/voice/voice.on.mdx +129 -0
- package/.docs/raw/reference/voice/voice.send.mdx +81 -0
- package/.docs/raw/reference/voice/voice.speak.mdx +203 -0
- package/.docs/raw/reference/voice/voice.updateConfig.mdx +87 -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 +816 -0
- package/.docs/raw/voice/speech-to-speech.mdx +73 -0
- package/.docs/raw/voice/speech-to-text.mdx +84 -0
- package/.docs/raw/voice/text-to-speech.mdx +89 -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 +170 -0
- package/.docs/raw/workflows/runtime-variables.mdx +153 -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 +140 -0
- package/dist/chunk-HYPVNJL7.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 +650 -0
- package/package.json +60 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Reference: OpenAI Voice | Voice Providers | Mastra Docs"
|
|
3
|
+
description: "Documentation for the OpenAIVoice class, providing text-to-speech and speech-to-text capabilities."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# OpenAI
|
|
7
|
+
|
|
8
|
+
The OpenAIVoice class in Mastra provides text-to-speech and speech-to-text capabilities using OpenAI's models.
|
|
9
|
+
|
|
10
|
+
## Usage Example
|
|
11
|
+
|
|
12
|
+
```typescript
|
|
13
|
+
import { OpenAIVoice } from '@mastra/voice-openai';
|
|
14
|
+
|
|
15
|
+
// Initialize with default configuration using environment variables
|
|
16
|
+
const voice = new OpenAIVoice();
|
|
17
|
+
|
|
18
|
+
// Or initialize with specific configuration
|
|
19
|
+
const voiceWithConfig = new OpenAIVoice({
|
|
20
|
+
speechModel: {
|
|
21
|
+
name: 'tts-1-hd',
|
|
22
|
+
apiKey: 'your-openai-api-key'
|
|
23
|
+
},
|
|
24
|
+
listeningModel: {
|
|
25
|
+
name: 'whisper-1',
|
|
26
|
+
apiKey: 'your-openai-api-key'
|
|
27
|
+
},
|
|
28
|
+
speaker: 'alloy' // Default voice
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// Convert text to speech
|
|
32
|
+
const audioStream = await voice.speak('Hello, how can I help you?', {
|
|
33
|
+
speaker: 'nova', // Override default voice
|
|
34
|
+
speed: 1.2 // Adjust speech speed
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// Convert speech to text
|
|
38
|
+
const text = await voice.listen(audioStream, {
|
|
39
|
+
filetype: 'mp3'
|
|
40
|
+
});
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Configuration
|
|
44
|
+
|
|
45
|
+
### Constructor Options
|
|
46
|
+
|
|
47
|
+
<PropertiesTable
|
|
48
|
+
content={[
|
|
49
|
+
{
|
|
50
|
+
name: "speechModel",
|
|
51
|
+
type: "OpenAIConfig",
|
|
52
|
+
description: "Configuration for text-to-speech synthesis.",
|
|
53
|
+
isOptional: true,
|
|
54
|
+
defaultValue: "{ name: 'tts-1' }",
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: "listeningModel",
|
|
58
|
+
type: "OpenAIConfig",
|
|
59
|
+
description: "Configuration for speech-to-text recognition.",
|
|
60
|
+
isOptional: true,
|
|
61
|
+
defaultValue: "{ name: 'whisper-1' }",
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: "speaker",
|
|
65
|
+
type: "OpenAIVoiceId",
|
|
66
|
+
description: "Default voice ID for speech synthesis.",
|
|
67
|
+
isOptional: true,
|
|
68
|
+
defaultValue: "'alloy'",
|
|
69
|
+
},
|
|
70
|
+
]}
|
|
71
|
+
/>
|
|
72
|
+
|
|
73
|
+
### OpenAIConfig
|
|
74
|
+
|
|
75
|
+
<PropertiesTable
|
|
76
|
+
content={[
|
|
77
|
+
{
|
|
78
|
+
name: "name",
|
|
79
|
+
type: "'tts-1' | 'tts-1-hd' | 'whisper-1'",
|
|
80
|
+
description: "Model name. Use 'tts-1-hd' for higher quality audio.",
|
|
81
|
+
isOptional: true,
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: "apiKey",
|
|
85
|
+
type: "string",
|
|
86
|
+
description: "OpenAI API key. Falls back to OPENAI_API_KEY environment variable.",
|
|
87
|
+
isOptional: true,
|
|
88
|
+
},
|
|
89
|
+
]}
|
|
90
|
+
/>
|
|
91
|
+
|
|
92
|
+
## Methods
|
|
93
|
+
|
|
94
|
+
### speak()
|
|
95
|
+
|
|
96
|
+
Converts text to speech using OpenAI's text-to-speech models.
|
|
97
|
+
|
|
98
|
+
<PropertiesTable
|
|
99
|
+
content={[
|
|
100
|
+
{
|
|
101
|
+
name: "input",
|
|
102
|
+
type: "string | NodeJS.ReadableStream",
|
|
103
|
+
description: "Text or text stream to convert to speech.",
|
|
104
|
+
isOptional: false,
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: "options.speaker",
|
|
108
|
+
type: "OpenAIVoiceId",
|
|
109
|
+
description: "Voice ID to use for speech synthesis.",
|
|
110
|
+
isOptional: true,
|
|
111
|
+
defaultValue: "Constructor's speaker value",
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
name: "options.speed",
|
|
115
|
+
type: "number",
|
|
116
|
+
description: "Speech speed multiplier.",
|
|
117
|
+
isOptional: true,
|
|
118
|
+
defaultValue: "1.0",
|
|
119
|
+
},
|
|
120
|
+
]}
|
|
121
|
+
/>
|
|
122
|
+
|
|
123
|
+
Returns: `Promise<NodeJS.ReadableStream>`
|
|
124
|
+
|
|
125
|
+
### listen()
|
|
126
|
+
|
|
127
|
+
Transcribes audio using OpenAI's Whisper model.
|
|
128
|
+
|
|
129
|
+
<PropertiesTable
|
|
130
|
+
content={[
|
|
131
|
+
{
|
|
132
|
+
name: "audioStream",
|
|
133
|
+
type: "NodeJS.ReadableStream",
|
|
134
|
+
description: "Audio stream to transcribe.",
|
|
135
|
+
isOptional: false,
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
name: "options.filetype",
|
|
139
|
+
type: "string",
|
|
140
|
+
description: "Audio format of the input stream.",
|
|
141
|
+
isOptional: true,
|
|
142
|
+
defaultValue: "'mp3'",
|
|
143
|
+
},
|
|
144
|
+
]}
|
|
145
|
+
/>
|
|
146
|
+
|
|
147
|
+
Returns: `Promise<string>`
|
|
148
|
+
|
|
149
|
+
### getSpeakers()
|
|
150
|
+
|
|
151
|
+
Returns an array of available voice options, where each node contains:
|
|
152
|
+
|
|
153
|
+
<PropertiesTable
|
|
154
|
+
content={[
|
|
155
|
+
{
|
|
156
|
+
name: "voiceId",
|
|
157
|
+
type: "string",
|
|
158
|
+
description: "Unique identifier for the voice",
|
|
159
|
+
isOptional: false,
|
|
160
|
+
},
|
|
161
|
+
]}
|
|
162
|
+
/>
|
|
163
|
+
|
|
164
|
+
## Notes
|
|
165
|
+
|
|
166
|
+
- API keys can be provided via constructor options or the `OPENAI_API_KEY` environment variable
|
|
167
|
+
- The `tts-1-hd` model provides higher quality audio but may have slower processing times
|
|
168
|
+
- Speech recognition supports multiple audio formats including mp3, wav, and webm
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Reference: PlayAI Voice | Voice Providers | Mastra Docs"
|
|
3
|
+
description: "Documentation for the PlayAI voice implementation, providing text-to-speech capabilities."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# PlayAI
|
|
7
|
+
|
|
8
|
+
The PlayAI voice implementation in Mastra provides text-to-speech capabilities using PlayAI's API.
|
|
9
|
+
|
|
10
|
+
## Usage Example
|
|
11
|
+
|
|
12
|
+
```typescript
|
|
13
|
+
import { PlayAIVoice } from "@mastra/voice-playai";
|
|
14
|
+
|
|
15
|
+
// Initialize with default configuration (uses PLAYAI_API_KEY environment variable and PLAYAI_USER_ID environment variable)
|
|
16
|
+
const voice = new PlayAIVoice();
|
|
17
|
+
|
|
18
|
+
// Initialize with default configuration
|
|
19
|
+
const voice = new PlayAIVoice({
|
|
20
|
+
speechModel: {
|
|
21
|
+
name: 'PlayDialog',
|
|
22
|
+
apiKey: process.env.PLAYAI_API_KEY,
|
|
23
|
+
userId: process.env.PLAYAI_USER_ID
|
|
24
|
+
},
|
|
25
|
+
speaker: 'Angelo' // Default voice
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// Convert text to speech with a specific voice
|
|
29
|
+
const audioStream = await voice.speak("Hello, world!", {
|
|
30
|
+
speaker: 's3://voice-cloning-zero-shot/b27bc13e-996f-4841-b584-4d35801aea98/original/manifest.json' // Dexter voice
|
|
31
|
+
});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Constructor Parameters
|
|
35
|
+
|
|
36
|
+
<PropertiesTable
|
|
37
|
+
content={[
|
|
38
|
+
{
|
|
39
|
+
name: "speechModel",
|
|
40
|
+
type: "PlayAIConfig",
|
|
41
|
+
description: "Configuration for text-to-speech functionality",
|
|
42
|
+
isOptional: true,
|
|
43
|
+
defaultValue: "{ name: 'PlayDialog' }",
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: "speaker",
|
|
47
|
+
type: "string",
|
|
48
|
+
description: "Default voice ID to use for speech synthesis",
|
|
49
|
+
isOptional: true,
|
|
50
|
+
defaultValue: "First available voice ID",
|
|
51
|
+
},
|
|
52
|
+
]}
|
|
53
|
+
/>
|
|
54
|
+
|
|
55
|
+
### PlayAIConfig
|
|
56
|
+
|
|
57
|
+
<PropertiesTable
|
|
58
|
+
content={[
|
|
59
|
+
{
|
|
60
|
+
name: "name",
|
|
61
|
+
type: "'PlayDialog' | 'Play3.0-mini'",
|
|
62
|
+
description: "The PlayAI model to use",
|
|
63
|
+
isOptional: true,
|
|
64
|
+
defaultValue: "'PlayDialog'",
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: "apiKey",
|
|
68
|
+
type: "string",
|
|
69
|
+
description: "PlayAI API key. Falls back to PLAYAI_API_KEY environment variable",
|
|
70
|
+
isOptional: true,
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: "userId",
|
|
74
|
+
type: "string",
|
|
75
|
+
description: "PlayAI user ID. Falls back to PLAYAI_USER_ID environment variable",
|
|
76
|
+
isOptional: true,
|
|
77
|
+
},
|
|
78
|
+
]}
|
|
79
|
+
/>
|
|
80
|
+
|
|
81
|
+
## Methods
|
|
82
|
+
|
|
83
|
+
### speak()
|
|
84
|
+
|
|
85
|
+
Converts text to speech using the configured speech model and voice.
|
|
86
|
+
|
|
87
|
+
<PropertiesTable
|
|
88
|
+
content={[
|
|
89
|
+
{
|
|
90
|
+
name: "input",
|
|
91
|
+
type: "string | NodeJS.ReadableStream",
|
|
92
|
+
description: "Text to convert to speech. If a stream is provided, it will be converted to text first.",
|
|
93
|
+
isOptional: false,
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: "options.speaker",
|
|
97
|
+
type: "string",
|
|
98
|
+
description: "Override the default speaker for this request",
|
|
99
|
+
isOptional: true,
|
|
100
|
+
defaultValue: "Constructor's speaker value",
|
|
101
|
+
},
|
|
102
|
+
]}
|
|
103
|
+
/>
|
|
104
|
+
|
|
105
|
+
Returns: `Promise<NodeJS.ReadableStream>`.
|
|
106
|
+
|
|
107
|
+
### getSpeakers()
|
|
108
|
+
|
|
109
|
+
Returns an array of available voice options, where each node contains:
|
|
110
|
+
|
|
111
|
+
<PropertiesTable
|
|
112
|
+
content={[
|
|
113
|
+
{
|
|
114
|
+
name: "name",
|
|
115
|
+
type: "string",
|
|
116
|
+
description: "Name of the voice",
|
|
117
|
+
isOptional: false,
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
name: "accent",
|
|
121
|
+
type: "string",
|
|
122
|
+
description: "Accent of the voice (e.g., 'US', 'British', 'Australian')",
|
|
123
|
+
isOptional: false,
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
name: "gender",
|
|
127
|
+
type: "'M' | 'F'",
|
|
128
|
+
description: "Gender of the voice",
|
|
129
|
+
isOptional: false,
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
name: "age",
|
|
133
|
+
type: "'Young' | 'Middle' | 'Old'",
|
|
134
|
+
description: "Age category of the voice",
|
|
135
|
+
isOptional: false,
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
name: "style",
|
|
139
|
+
type: "'Conversational' | 'Narrative'",
|
|
140
|
+
description: "Speaking style of the voice",
|
|
141
|
+
isOptional: false,
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
name: "voiceId",
|
|
145
|
+
type: "string",
|
|
146
|
+
description: "Unique identifier for the voice",
|
|
147
|
+
isOptional: false,
|
|
148
|
+
},
|
|
149
|
+
]}
|
|
150
|
+
/>
|
|
151
|
+
### listen()
|
|
152
|
+
|
|
153
|
+
This method is not supported by PlayAI and will throw an error. PlayAI does not provide speech-to-text functionality.
|
|
154
|
+
|
|
155
|
+
## Notes
|
|
156
|
+
|
|
157
|
+
- PlayAI requires both an API key and a user ID for authentication
|
|
158
|
+
- The service offers two models: 'PlayDialog' and 'Play3.0-mini'
|
|
159
|
+
- Each voice has a unique S3 manifest ID that must be used when making API calls
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Reference: Sarvam Voice | Voice Providers | Mastra Docs"
|
|
3
|
+
description: "Documentation for the Sarvam class, providing text-to-speech and speech-to-text capabilities."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Sarvam
|
|
7
|
+
|
|
8
|
+
The SarvamVoice class in Mastra provides text-to-speech and speech-to-text capabilities using Sarvam AI models.
|
|
9
|
+
|
|
10
|
+
## Usage Example
|
|
11
|
+
|
|
12
|
+
```typescript
|
|
13
|
+
import { SarvamVoice } from "@mastra/voice-sarvam";
|
|
14
|
+
|
|
15
|
+
// Initialize with default configuration using environment variables
|
|
16
|
+
const voice = new SarvamVoice();
|
|
17
|
+
|
|
18
|
+
// Or initialize with specific configuration
|
|
19
|
+
const voiceWithConfig = new SarvamVoice({
|
|
20
|
+
speechModel: {
|
|
21
|
+
model: "bulbul:v1",
|
|
22
|
+
apiKey: process.env.SARVAM_API_KEY!,
|
|
23
|
+
language: "en-IN",
|
|
24
|
+
properties: {
|
|
25
|
+
pitch: 0,
|
|
26
|
+
pace: 1.65,
|
|
27
|
+
loudness: 1.5,
|
|
28
|
+
speech_sample_rate: 8000,
|
|
29
|
+
enable_preprocessing: false,
|
|
30
|
+
eng_interpolation_wt: 123,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
listeningModel: {
|
|
34
|
+
model: "saarika:v2",
|
|
35
|
+
apiKey: process.env.SARVAM_API_KEY!,
|
|
36
|
+
languageCode: "en-IN",
|
|
37
|
+
filetype?: 'wav';
|
|
38
|
+
},
|
|
39
|
+
speaker: "meera", // Default voice
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
// Convert text to speech
|
|
44
|
+
const audioStream = await voice.speak("Hello, how can I help you?");
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
// Convert speech to text
|
|
48
|
+
const text = await voice.listen(audioStream, {
|
|
49
|
+
filetype: "wav",
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Sarvam API Docs -
|
|
54
|
+
|
|
55
|
+
https://docs.sarvam.ai/api-reference-docs/endpoints/text-to-speech
|
|
56
|
+
|
|
57
|
+
## Configuration
|
|
58
|
+
|
|
59
|
+
### Constructor Options
|
|
60
|
+
|
|
61
|
+
<PropertiesTable
|
|
62
|
+
content={[
|
|
63
|
+
{
|
|
64
|
+
name: "speechModel",
|
|
65
|
+
type: "SarvamVoiceConfig",
|
|
66
|
+
description: "Configuration for text-to-speech synthesis.",
|
|
67
|
+
isOptional: true,
|
|
68
|
+
defaultValue: "{ model: 'bulbul:v1', language: 'en-IN' }",
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: "speaker",
|
|
72
|
+
type: "SarvamVoiceId",
|
|
73
|
+
description:
|
|
74
|
+
"The speaker to be used for the output audio. If not provided, Meera will be used as default. AvailableOptions - meera, pavithra, maitreyi, arvind, amol, amartya, diya, neel, misha, vian, arjun, maya",
|
|
75
|
+
isOptional: true,
|
|
76
|
+
defaultValue: "'meera'",
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: "listeningModel",
|
|
80
|
+
type: "SarvamListenOptions",
|
|
81
|
+
description: "Configuration for speech-to-text recognition.",
|
|
82
|
+
isOptional: true,
|
|
83
|
+
defaultValue: "{ model: 'saarika:v2', language_code: 'unknown' }",
|
|
84
|
+
},
|
|
85
|
+
]}
|
|
86
|
+
/>
|
|
87
|
+
|
|
88
|
+
### SarvamVoiceConfig
|
|
89
|
+
|
|
90
|
+
<PropertiesTable
|
|
91
|
+
content={[
|
|
92
|
+
{
|
|
93
|
+
name: "apiKey",
|
|
94
|
+
type: "string",
|
|
95
|
+
description:
|
|
96
|
+
"Sarvam API key. Falls back to SARVAM_API_KEY environment variable.",
|
|
97
|
+
isOptional: true,
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: "model",
|
|
101
|
+
type: "SarvamTTSModel",
|
|
102
|
+
description: "Specifies the model to use for text-to-speech conversion.",
|
|
103
|
+
isOptional: true,
|
|
104
|
+
defaultValue: "'bulbul:v1'",
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: "language",
|
|
108
|
+
type: "SarvamTTSLanguage",
|
|
109
|
+
description:
|
|
110
|
+
"Target language for speech synthesis. Available options: hi-IN, bn-IN, kn-IN, ml-IN, mr-IN, od-IN, pa-IN, ta-IN, te-IN, en-IN, gu-IN",
|
|
111
|
+
isOptional: false,
|
|
112
|
+
defaultValue: "'en-IN'",
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: "properties",
|
|
116
|
+
type: "object",
|
|
117
|
+
description: "Additional voice properties for customization.",
|
|
118
|
+
isOptional: true,
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: "properties.pitch",
|
|
122
|
+
type: "number",
|
|
123
|
+
description:
|
|
124
|
+
"Controls the pitch of the audio. Lower values result in a deeper voice, while higher values make it sharper. The suitable range is between -0.75 and 0.75.",
|
|
125
|
+
isOptional: true,
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
name: "properties.pace",
|
|
129
|
+
type: "number",
|
|
130
|
+
description:
|
|
131
|
+
"Controls the speed of the audio. Lower values result in slower speech, while higher values make it faster. The suitable range is between 0.5 and 2.0. Default is 1.0. Required range: 0.3 <= x <= 3",
|
|
132
|
+
isOptional: true,
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
name: "properties.loudness",
|
|
136
|
+
type: "number",
|
|
137
|
+
description:
|
|
138
|
+
"Controls the loudness of the audio. Lower values result in quieter audio, while higher values make it louder. The suitable range is between 0.3 and 3.0. Required range: 0 <= x <= 3",
|
|
139
|
+
isOptional: true,
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
name: "properties.speech_sample_rate",
|
|
143
|
+
type: "8000 | 16000 | 22050",
|
|
144
|
+
description: "Audio sample rate in Hz.",
|
|
145
|
+
isOptional: true,
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: "properties.enable_preprocessing",
|
|
149
|
+
type: "boolean",
|
|
150
|
+
description:
|
|
151
|
+
"Controls whether normalization of English words and numeric entities (e.g., numbers, dates) is performed. Set to true for better handling of mixed-language text. Default is false.",
|
|
152
|
+
isOptional: true,
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
name: "properties.eng_interpolation_wt",
|
|
156
|
+
type: "number",
|
|
157
|
+
description: "Weight for interpolating with English speaker at encoder.",
|
|
158
|
+
isOptional: true,
|
|
159
|
+
},
|
|
160
|
+
]}
|
|
161
|
+
/>
|
|
162
|
+
|
|
163
|
+
### SarvamListenOptions
|
|
164
|
+
|
|
165
|
+
<PropertiesTable
|
|
166
|
+
content={[
|
|
167
|
+
{
|
|
168
|
+
name: "apiKey",
|
|
169
|
+
type: "string",
|
|
170
|
+
description:
|
|
171
|
+
"Sarvam API key. Falls back to SARVAM_API_KEY environment variable.",
|
|
172
|
+
isOptional: true,
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
name: "model",
|
|
176
|
+
type: "SarvamSTTModel",
|
|
177
|
+
description:
|
|
178
|
+
"Specifies the model to use for speech-to-text conversion. Note:- Default model is saarika:v2 . Available options: saarika:v1, saarika:v2, saarika:flash ",
|
|
179
|
+
isOptional: true,
|
|
180
|
+
defaultValue: "'saarika:v2'",
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
name: "languageCode",
|
|
184
|
+
type: "SarvamSTTLanguage",
|
|
185
|
+
description:
|
|
186
|
+
"Specifies the language of the input audio. This parameter is required to ensure accurate transcription. For the saarika:v1 model, this parameter is mandatory. For the saarika:v2 model, it is optional. unknown: Use this when the language is not known; the API will detect it automatically. Note:- that the saarika:v1 model does not support unknown language code. Available options: unknown, hi-IN, bn-IN, kn-IN, ml-IN, mr-IN, od-IN, pa-IN, ta-IN, te-IN, en-IN, gu-IN ",
|
|
187
|
+
isOptional: true,
|
|
188
|
+
defaultValue: "'unknown'",
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
name: "filetype",
|
|
192
|
+
type: "'mp3' | 'wav'",
|
|
193
|
+
description: "Audio format of the input stream.",
|
|
194
|
+
isOptional: true,
|
|
195
|
+
},
|
|
196
|
+
]}
|
|
197
|
+
/>
|
|
198
|
+
|
|
199
|
+
## Methods
|
|
200
|
+
|
|
201
|
+
### speak()
|
|
202
|
+
|
|
203
|
+
Converts text to speech using Sarvam's text-to-speech models.
|
|
204
|
+
|
|
205
|
+
<PropertiesTable
|
|
206
|
+
content={[
|
|
207
|
+
{
|
|
208
|
+
name: "input",
|
|
209
|
+
type: "string | NodeJS.ReadableStream",
|
|
210
|
+
description: "Text or text stream to convert to speech.",
|
|
211
|
+
isOptional: false,
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
name: "options.speaker",
|
|
215
|
+
type: "SarvamVoiceId",
|
|
216
|
+
description: "Voice ID to use for speech synthesis.",
|
|
217
|
+
isOptional: true,
|
|
218
|
+
defaultValue: "Constructor's speaker value",
|
|
219
|
+
},
|
|
220
|
+
]}
|
|
221
|
+
/>
|
|
222
|
+
|
|
223
|
+
Returns: `Promise<NodeJS.ReadableStream>`
|
|
224
|
+
|
|
225
|
+
### listen()
|
|
226
|
+
|
|
227
|
+
Transcribes audio using Sarvam's speech recognition models.
|
|
228
|
+
|
|
229
|
+
<PropertiesTable
|
|
230
|
+
content={[
|
|
231
|
+
{
|
|
232
|
+
name: "input",
|
|
233
|
+
type: "NodeJS.ReadableStream",
|
|
234
|
+
description: "Audio stream to transcribe.",
|
|
235
|
+
isOptional: false,
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
name: "options",
|
|
239
|
+
type: "SarvamListenOptions",
|
|
240
|
+
description: "Configuration options for speech recognition.",
|
|
241
|
+
isOptional: true,
|
|
242
|
+
},
|
|
243
|
+
]}
|
|
244
|
+
/>
|
|
245
|
+
|
|
246
|
+
Returns: `Promise<string>`
|
|
247
|
+
|
|
248
|
+
### getSpeakers()
|
|
249
|
+
|
|
250
|
+
Returns an array of available voice options.
|
|
251
|
+
|
|
252
|
+
Returns: `Promise<Array<{voiceId: SarvamVoiceId}>>`
|
|
253
|
+
|
|
254
|
+
## Notes
|
|
255
|
+
|
|
256
|
+
- API key can be provided via constructor options or the `SARVAM_API_KEY` environment variable
|
|
257
|
+
- If no API key is provided, the constructor will throw an error
|
|
258
|
+
- The service communicates with the Sarvam AI API at `https://api.sarvam.ai`
|
|
259
|
+
- Audio is returned as a stream containing binary audio data
|
|
260
|
+
- Speech recognition supports mp3 and wav audio formats
|