Agent.getVoice()
.getVoice() 方法用于获取为代理配置的语音提供商,如果它是一个函数,则会执行解析。此方法用于访问代理的语音功能,以实现文本转语音和语音转文本功能。
🌐 The .getVoice() method retrieves the voice provider configured for an agent, resolving it if it's a function. This method is used to access the agent's speech capabilities for text-to-speech and speech-to-text functionality.
使用示例Direct link to 使用示例
🌐 Usage example
await agent.getVoice();
参数Direct link to 参数
🌐 Parameters
options?:
{ requestContext?: RequestContext }
= {}
Optional configuration object containing request context.
返回Direct link to 返回
🌐 Returns
voice:
Promise<MastraVoice>
A promise that resolves to the voice provider configured for the agent, or a default voice provider if none was configured.
扩展使用示例Direct link to 扩展使用示例
🌐 Extended usage example
await agent.getVoice({
requestContext: new RequestContext(),
});
选项参数Direct link to 选项参数
🌐 Options parameters
requestContext?:
RequestContext
= new RequestContext()
Request Context for dependency injection and contextual information.
相关Direct link to 相关
🌐 Related