rhythmic-printer-24192
09/02/2025, 7:36 AMtall-airline-16756
09/02/2025, 7:36 AMtall-airline-16756
09/02/2025, 7:37 AMcaching parameter to "ephemeral." This way, your system prompts and chat history are temporarily cached without sticking around between sessions.
• Control Tool Calling Behavior: If you want to keep things predictable, use tool_choice="none" to stop any tool calls, or specify exactly which tools to use with tool_choice.
• Manage Chat Context: For clean testing, use separate chat contexts each time so previous chats don’t interfere.
• Set Explicit Model Parameters: Setting parameters like temperature=0.0 helps you get consistent results, and top_k=1 can reduce randomness.
• Disable Browser Caching: When testing in a browser, you might want to disable caching via developer tools or switch up ports between tests to keep things fresh.
• Limit Context Window: Sending only a limited chat history to the model can make outputs more predictable.
Give these a try—they should make your testing smoother and help keep those caching issues at bay. If you hit any snags, I’m here to help!
Sources: livekit-agents/livekit/agents/voice/agent_activity.py | LLM Integrations | livekit/livekit_composite | DeepWiki | tools/server/tests/unit/test_slot_save.pyrhythmic-printer-24192
09/02/2025, 7:40 AMtall-airline-16756
09/02/2025, 7:40 AMNONCE and TIMESTAMP directly to prompts isn’t something the LiveKit API officially recommends for distinguishing LLM calls. The framework actually takes care of telemetry and metrics like request IDs and timestamps behind the scenes, so tweaking prompts like this isn’t really needed and might not be the best way to go.
Instead, you might want to try using the caching parameter set to "ephemeral" or explicitly managing chat contexts to make sure each call is handled separately. If you’d like, I’m here to help walk you through these options or answer any questions you have!
Sources: livekit-plugins/livekit-plugins-anthropic/livekit/plugins/anthropic/llm.py | plugins/openai/src/llm.ts | Large language model (LLM) integrations | LiveKit Docs | LLM Integrations | livekit/livekit_composite | DeepWikirhythmic-printer-24192
09/02/2025, 7:41 AMtall-airline-16756
09/02/2025, 7:41 AMfrom livekit.plugins.anthropic import LLM
anthropic_llm = LLM(
model="claude-3-5-sonnet-20241022",
caching="ephemeral"
)
For OpenAI LLM:
from livekit.plugins.openai import LLM
openai_llm = LLM(
model="gpt-4o",
prompt_cache_key="my_cache_key",
store=True
)
Using caching="ephemeral" means your system prompts, tools, and chat history are cached temporarily, which is super handy for testing and keeping things tidy. If you have any questions or want me to walk you through it, just give me a shout!
Sources: livekit-plugins/livekit-plugins-openai/livekit/plugins/openai/llm.pyrhythmic-printer-24192
09/02/2025, 7:44 AMtall-airline-16756
09/02/2025, 7:44 AMprompt_cache_key parameter in the LiveKit LLM API. You can use either a UUID or a static string here, depending on how you want caching to work for you:
• Go with a static string: This is great if you want to get consistent cache hits for the same prompt contexts, like reusable system prompts or templates.
• Or use a UUID: This helps if you want to skip caching altogether and make sure each request is handled fresh. For example: prompt_cache_key=str(uuid.uuid4()).
Since how prompt_cache_key behaves can vary depending on your LLM provider, it’s a good idea to check how it’s working by looking at usage metrics or the provider’s docs. If you’re ever in doubt, using a UUID is a safe bet to avoid any surprise caching.
Sources: Flutter SDK | livekit/livekit_composite | DeepWiki | tools/server/README.md | livekit-plugins/livekit-plugins-aws/livekit/plugins/aws/experimental/realti...rhythmic-printer-24192
09/02/2025, 7:53 AMtall-airline-16756
09/02/2025, 7:54 AM