Agent.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.
Usage exampleUsage example的直接链接
await agent.getVoice()
ParametersParameters的直接链接
options?:
{ requestContext?: RequestContext }
= {}
Optional configuration object containing request context.
{ requestContext?: RequestContext }
requestContext?:
RequestContext
Request Context for dependency injection and contextual information.
ReturnsReturns的直接链接
voice:
Promise<MastraVoice>
A promise that resolves to the voice provider configured for the agent, or a default voice provider if none was configured.
Extended usage exampleExtended usage example的直接链接
await agent.getVoice({
requestContext: new RequestContext(),
})