I have a multiple funtion tools with returning a ...
# ask-ai
l
I have a multiple funtion tools with returning a text. in some case multiple tools executed multiple speech generated by the agent for each executed tool. it is not professional. I want to only one spech output when parallel tool calls
t
Thanks for reaching out, Rajadurai. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I understand you’re seeing multiple speech outputs when several tools run (often in parallel) and you want just one consolidated, professional speech response. I can help get you there. Summary of the fix you can apply • Do not call
session.say()
(or otherwise trigger TTS) inside each tool function. Each
session.say()
produces its own speech output. • Run tools in parallel and return their results as text/data from the tools. • Let the LLM produce a single final response that summarizes or synthesizes all tool results, and perform one
session.say()
(or let the agent TTS run once) for that final response. Questions to narrow down the exact steps 1. Are you currently calling
session.say()
(or TTS) inside each tool implementation? 2. Are you already using
parallel_tool_calls=True
in your agent/LLM configuration? 3. Do you want the final speech to be automatically generated from the LLM’s reply, or do you want to manually assemble/format the final speech before calling TTS? Concrete approaches (pick one that fits your setup) Option A — Recommended (minimal changes) 1. Change each tool so it returns structured text/data only (no TTS calls). 2. Ensure the agent runs tools with
parallel_tool_calls=True
so results are available together. 3. Allow the LLM to generate the single combined reply — the agent will then run TTS once on that reply. Example (conceptual): • Tool A returns: "Result A" • Tool B returns: "Result B" • LLM prompt receives both results and responds: "Here’s the consolidated answer based on A and B..." • Agent performs one
session.say()
on the LLM’s reply. Option B — Full control (explicit single TTS) 1. Keep tools returning data only. 2. Intercept the final LLM output (or override
llm_node
) to collect the full response after all tool results are processed. 3. Call
session.say()
once with the consolidated text you want spoken. Example override (conceptual):
Copy code
# Pseudocode outline
async def llm_node(...):
    consolidated = await generate_llm_reply_with_tool_results(...)
    # modify/consolidate if you want
    await session.say(consolidated)  # single TTS call
    yield consolidated_chunks  # still provide text to chat
What I can help with next • If you tell me whether you’re currently calling TTS inside tools and whether
parallel_tool_calls
is enabled, I’ll give a tailored code snippet for your environment (Python or JS) to stop duplicate speech and produce a single consolidated output. • If you prefer the LLM to summarize results in a specific tone or format, tell me the desired voice/tone and I’ll show how to prompt the LLM so the single speech output sounds professional. If you share a short snippet of one of your tool functions and your agent config, I’ll point out exactly where to change it. Sources: Perplexity LLM plugin guide | LiveKit Documentation