Skip to content

send_contextual_update error #567

@lattimer7

Description

@lattimer7

Description

using the following basic demo from the website, plus the language from the test (conversation.send_contextual_update("...")) I encounter the following failing output. I'm not sure if this is because the release version is seemingly not updated right (pip install elevenlabs==2.2.0 seems to not work, only 2.1.0 is available) but the send_contextual_update python test seems to pass because the session is ended before the error can appear.

Code example

Failing output:

Agent: Hello welcome to Hudson Dental how are you doing today?
Latency: 50ms
sending
sent
Error sending user audio chunk: received 1008 (policy violation) Invalid message received; then sent 1008 (policy violation) Invalid message received
Error receiving message: received 1008 (policy violation) Invalid message received; then sent 1008 (policy violation) Invalid message received

Script to reproduce:

import os
import time

from elevenlabs.client import ElevenLabs
from elevenlabs.conversational_ai.conversation import Conversation
from elevenlabs.conversational_ai.default_audio_interface import DefaultAudioInterface

agent_id = os.getenv("AGENT_ID")
api_key = os.getenv("ELEVENLABS_API_KEY")

elevenlabs = ElevenLabs(api_key=api_key)

conversation = Conversation(
    # API client and agent ID.
    elevenlabs,
    agent_id,

    # Assume auth is required when API_KEY is set.
    requires_auth=bool(api_key),

    # Use the default audio interface.
    audio_interface=DefaultAudioInterface(),

    # Simple callbacks that print the conversation to the console.
    callback_agent_response=lambda response: print(f"Agent: {response}"),
    callback_agent_response_correction=lambda original, corrected: print(f"Agent: {original} -> {corrected}"),
    callback_user_transcript=lambda transcript: print(f"User: {transcript}"),
    callback_latency_measurement=lambda latency: print(f"Latency: {latency}ms"),
)

conversation.start_session()

time.sleep(5)
print('sending')
conversation.send_contextual_update("User appears to be looking at pricing page")
print('sent')

conversation_id = conversation.wait_for_session_end()
print(f"Conversation ID: {conversation_id}")

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghas reproductionA reproduction case has been provided

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions