Hi! Anyone has issue where `conversation_item_adde...
# agents
t
Hi! Anyone has issue where
conversation_item_added
event does not capture user's transcript when using OpenAI's Realtime API? It only captures the AI's transcript. Here is my LLM setup (👇 attached snippet) Here is my `conversation_item_added`:
Copy code
@agent.on("conversation_item_added")
def on_conversation_item_added(ev: ConversationItemAddedEvent):
    if not ev.item.text_content:
        return
    print(f"Saving transcript: {ev.item.text_content}")
j
this is a limitation of realtime model that it takes audio as input directly, the user transcript is sent separately so we cannot emit a
conversation_item_added
for the user transcript. you can subscribe to the
user_input_transcribed
event if you want user transcriptions
🙏 1
h
for me this works well with realtime model:
Copy code
session.on(
        voice.AgentSessionEventTypes.ConversationItemAdded,
        async (event: voice.ConversationItemAddedEvent) => {
          try {
            const chatRole: ChatRole = event.item.role;
            const role = chatRole === "user" ? "USER" : chatRole === "assistant" ? "AGENT" : "OTHER";
            logger.info(
              `Conversation item added from ${role}: ${event.item.textContent}. interrupted: ${event.item.interrupted}`
            );
🙏 1
t
I'm on python SDK. And I found it works with Gemini Live, however not working with OpenAI's Realtime.
👍 1
user_input_transcribed
also captures nothing for Realtime API 😞
After tinkering a bit more, I found out what causes my issue: While initiating the agent, there is openAI error which I didn't address, e.g.
Copy code
ERROR livekit.plugins.openai - OpenAI Realtime API returned an error {"error": "RealtimeError(message=\"Invalid value: ''. Supported values are: 'alloy', 'ash', 'ballad', 'coral', 'echo', 'sage', 'shimmer', 'verse', 'marin', and 'cedar'.\", type='invalid_request_error', code='invalid_value', event_id='session_update_cb5cd31f220b', param='session.audio.output.voice')", "pid": 95054, "job_id": "AJ_RqQRKyA7kBjQ"}

OR

ERROR livekit.plugins.openai - OpenAI Realtime API returned an error {"error": "RealtimeError(message=\"Invalid type for 'session.audio.input.turn_detection.eagerness': expected one of 'low', 'medium', 'high', or 'auto', but got null instead.\", type='invalid_request_error', code='invalid_type', event_id='session_update_1deaa615284e', param='session.audio.input.turn_detection.eagerness')", "pid": 96110, "job_id": "AJ_S9rqTM5kZKzT"}
This kind of error causes the agent to run erratically, e.g. textual user transcript is not captured at all, and the speaking AI is sometimes captured as user's speaking (hence it keeps answering itself).
b
did you figure out a solution?
j
it should be fixed in the latest version 1.2.11?
b
i cant seem to get user transcripts no matter what i do. im using azure. for 4o relatime, user transcripts are very easily available out of the box. for 4o mini realtime, the user transcripts are elusive. I've tried all sorts of listeners, ive tried adding an stt model to the agent session, ive tried setting in the realtime model: input_audio_transcription=InputAudioTranscription( model="whisper-1" ), nothing seems to be working. i can only get the agent's transcripts
the latest version is not working for me, i keep getting openapi errors, i'm on 1.2.8 now
j
@bitter-twilight-94459 what is the error on the 1.2.11?
the user transcriptions are generated by a separate stt model in OAI realtime, so actually it shouldn’t related to which realtime model you used
b
it just say an OpenAI API error occured. The realtime conversation does not start at all
t
For me, the OpenAI API error comes with message (such as below), so I know how to fix it. https://livekit-users.slack.com/archives/C07FY8WHGPM/p1758094499180439?thread_ts=1758013394.014879&cid=C07FY8WHGPM