Skip to main content
Loading navigation
Back to prompt library

Voice Interface with Sarvam AI and Document Interaction

Linked challenge: SkillProof Document Agent

Prompt source

implementation19 lines5 sectionsNo variables1 code block
Integrate Sarvam AI's speech-to-text capabilities to allow users to verbally provide their `skill_description` and `name` to the 'SkillProofAgent'. The agent should then process this voice input to populate the document fields. Describe how Sarvam AI would convert speech to text and how your Mastra AI agent would then interpret and act upon this text input to start generating a SkillProof document. Provide a conceptual flow.

```typescript
// Conceptual integration with Sarvam AI and Mastra Agent
// import SarvamClient from 'sarvam-ai-sdk'; // Hypothetical SDK

// const sarvam = new SarvamClient({ apiKey: 'YOUR_SARVAM_API_KEY' });

// async function processVoiceInput(audioData: Buffer) {
//   const transcription = await sarvam.speechToText(audioData); // Use Sarvam ASR
//   // Then, send transcription to Mastra AI agent
//   // const agentResponse = await agent.run(transcription);
//   // Agent's turn handler would parse transcription, extract intent (e.g., 'create_skill_proof'),
//   // and update the SkillProofDocument state based on extracted skillDescription and name.
//   return 'SkillProof document started based on your voice input.';
// }

// Mastra AI agent would have a handler that understands intents from natural language:
// agent.onIntent('create_skill_proof', async ({ payload, state }) => {
//   state.set('skillProofDocument', { skillName: payload.skill, descriptionGenerated: '', ... });
//   return 'Got it. Generating your skill proof.';
// });
```