steep-balloon-41261
11/04/2025, 11:50 AMtall-airline-16756
11/04/2025, 11:50 AMtall-airline-16756
11/04/2025, 11:51 AMChatContext and returns `ChatChunk`s. See: LLM overview, OpenAI plugin.
If helpful, I can share a minimal example. To tailor it:
• Which SDK are you using (Python or Node)?
• Will you call the OpenAI plugin with your own OPENAI_API_KEY, or use LiveKit Inference models?
• Do you already have transcripts from STT, or do you need guidance building a ChatContext from STT output?
I can then show:
• Instantiating livekit.plugins.openai.LLM standalone
• Building a short ChatContext with the transcript and a system prompt like “Return only the ISO language code”
• Consuming the streamed `ChatChunk`s to get the classification output Sources: Large language models (LLM) | LiveKit Docs | OpenAI LLM plugin guide | LiveKit Docs | OpenAI LLM models | LiveKit Docs | Speech-to-text (STT) models | LiveKit Docsbetter-sandwich-65834
11/04/2025, 11:52 AMtts = TTS.with_azure(
azure_endpoint=azure_openai_tts_settings.endpoint,
api_key=azure_openai_tts_settings.api_key,
model=agent_settings.TTS_MODEL,
azure_deployment=agent_settings.TTS_MODEL,
voice=agent_settings.TTS_VOICE,
speed=agent_settings.TTS_SPEED,
instructions=vibe_instructions,
)
llm = RealtimeModel.with_azure(
azure_deployment=agent_settings.LLM_MODEL,
voice=agent_settings.LLM_VOICE,
modalities=["text"],
turn_detection=TurnDetection(
type="semantic_vad",
eagerness="auto",
create_response=True,
interrupt_response=True,
),
)
for llm i'll use
LLM.with_azure(
azure_deployment=judge_llm_settings.model,
)tall-airline-16756
11/04/2025, 11:56 AMRealtimeModel for voice, and use a separate Azure-backed LLM for language classification. That’s supported: the LLM can run standalone with a ChatContext and returns streamed `ChatChunk`s (overview, Azure plugin guide).
Minimal Python sketch using `LLM.with_azure`:
from livekit.plugins.openai import LLM
from livekit.agents import ChatContext
# Ensure env vars are set: AZURE_OPENAI_API_KEY (or AZURE_OPENAI_ENTRA_TOKEN),
# AZURE_OPENAI_ENDPOINT, OPENAI_API_VERSION
judge_llm = LLM.with_azure(
azure_deployment="your-azure-deployment-name",
temperature=0.0,
)
# Build ChatContext from your STT transcript
transcript = "Hola, ¿cómo estás?"
ctx = ChatContext(
system="You are a classifier. Return only the ISO 639-1 language code of the user text.",
messages=[{"role": "user", "content": transcript}],
)
# Call standalone LLM and collect the streamed result
result_text = []
async for chunk in judge_llm.chat(ctx):
if chunk.delta:
result_text.append(chunk.delta)
language_code = "".join(result_text).strip()
print("Detected language:", language_code)
Notes:
• Use a deterministic config (temperature 0) for classification.
• Provide your Azure deployment name via azure_deployment and set the Azure env vars before running. Details: Azure OpenAI LLM plugin guide.
Want me to adapt this to your exact transcript source or return a JSON label instead of plain text?
Sources: Large language models (LLM) | LiveKit Docs | Azure OpenAI LLM plugin guide | LiveKit docs | OpenAI LLM models | LiveKit Docs | Azure OpenAI Realtime API and LiveKit | LiveKit Docs | Building voice agents | LiveKit Docs