How can we make sure to expect a particular schema...
# ask-ai
q
How can we make sure to expect a particular schema output by using llm, I want the output as boolean but no way of doing schema validation of livekit llm response
Copy code
from livekit.agents.llm import ChatContext, ChatMessage

    # Construct system prompt to evaluate potential tool call miss
    system_prompt = MISS_TOOL_CALL_EVALUATION_PROMPT.format(
        current_instructions=session.current_agent.instructions,
        last_message_content=last_message_content
        or "[no recent conversational message]",
        last_message_role=last_message_role or "[unknown role]",
        last_tool_call_result=last_tool_call_result or "[no previous tool call]",
    )

    # Use LLM to evaluate if a tool call was missed
    messages = [ChatMessage(role="system", content=[system_prompt])]
    stream = session.llm.chat(chat_ctx=ChatContext(messages))
    result_text = await consume_llm_text(stream)
t
Thanks for reaching out, Krishna. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!