Speech

class Speech(context: Context) : Capability, AutoCloseable(source)

Speech output as agent tools on the platform TextToSpeech engine: speak reads text aloud (and returns when it has been spoken, so the agent can sequence it) and stop_speaking interrupts it. Nothing leaves the device unless the user's TTS engine is a network one.

The engine starts lazily on the first call; close releases it.

Constructors

Link copied to clipboard
constructor(context: Context)

Properties

Link copied to clipboard
open override val instructions: String

Functions

Link copied to clipboard
open override fun close()
Link copied to clipboard
open suspend fun context(): String?
Link copied to clipboard
suspend fun speak(text: String, language: String? = null, rate: Double? = null): String

Speak text and wait until it is done (or interrupted).

Link copied to clipboard
fun stop(): String

Interrupt speech; pending speak calls return.

Link copied to clipboard
open suspend override fun tools(): List<AgentTool>