how do I access chat_ctx if I have agent? this is...
# ask-ai
c
how do I access chat_ctx if I have agent? this is my code: agent = setup_voice_agent( ctx=ctx, stt_agent=deepgram_stt_agent, tts_agent=tts_agent, vad=ctx.proc.userdata["vad"] ) ctx.proc.userdata["agent"] = agent I set up the voice agent using the stt and tts pipeline but how do I access the llm here?
t
Thanks for reaching out, Sai. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
You can access the
chatCtx
property in LiveKit agents using a getter method. This is available in both the
VoicePipelineAgent
class and the
LLMStream
class. For example, with a `VoicePipelineAgent`:
Copy code
const chatContext = agent.chatCtx;
This getter will return a
ChatContext
object as defined in the LiveKit documentation. Sources: LLMStream | LiveKit Agents | VoicePipelineAgent | LiveKit Agents
c
how to access the content being played out in LLMStream
t
Unfortunately, I couldn't find specific information on how to access the content being played out in
LLMStream
. The available documentation only mentions speech playback functionality with different source types, including
LLMStream
, but does not detail how to retrieve the content. If you have further details or specific use cases, feel free to share, and I can assist further or escalate the query if needed.
c
how do I force an agent turn?
t
Currently, I couldn't locate specific information on how to force an agent turn in LiveKit. The documentation primarily discusses turn detection methods like Voice Activity Detection (VAD) and custom turn-detector models for determining when a user has finished speaking, but it does not detail how to manually trigger an agent turn. If you have additional context or requirements, please let me know, and I can assist further or escalate the query if necessary.
c
stream = self.agent.llm.chat(chat_ctx=self.agent.chat_ctx) this is how I get LLM Stream. how do I access the actual text of the stream before doing agent.say?
t
I'm sorry, but I don't have the information you need at the moment. If you would like a member of the LiveKit team to respond, please ask your question in one of the other channels.
c
what is the difference between await self.ctx.room.disconnect() and await self.api.room.remove_participant( api.RoomParticipantIdentity( room=self.room.name, identity=self.participant.identity, ) ) ? which actually ends the call>