#Can you provide an example of overriding the prompt when creating a WebSocket with the conversation

1 messages · Page 1 of 1 (latest)

halcyon topazBOT
#

@chrome lance Please provide more information related to your query. Original thread: #1332802220277764240 message

Can you provide an example of overriding the prompt when creating a WebSocket with the conversational API?

    this.socket = new WebSocket(
      `wss://api.elevenlabs.io/v1/convai/conversation?agent_id=${process.env.ELEVENLABS_AGENT_ID}`,
    )
chrome lance
#

Is it possible to pass dynamic variables into the websocket?

#

that thread ^ explains what i am trying to do

quaint harbor
#

Have you checked out the docs?

chrome lance
#

yep :)

#

I can define it fine on the UI side, but when creating the socket how can I pass that data in?

#

where is {id} passed in?

#
from elevenlabs.conversational_ai.conversation import Conversation, ConversationConfig

dynamic_vars = {
    "customer_name": "John Doe",
    "account_balance": 5000.50,
    "location": "New York",
    "is_premium": True
}

config = ConversationConfig(
    dynamic_variables=dynamic_vars
)

conversation = Conversation(
    config=config
)
conversation.start_session()
const conversation = await Conversation.startSession({

  dynamicVariables: {

    customer_name: "John Doe",

    account_balance: 5000.50,

    location: "New York",

    is_premium: true

  }

});```

This shows how to do it via Conversation but how via Websocket in JS?
quaint harbor
#

Sorry I'm not sure, dynamic variables were just released so I don't know anything about it yet

chrome lance
#

It's not like either of these:


    this.socket = new WebSocket(
      `wss://api.elevenlabs.io/v1/convai/conversation?agent_id=${process.env.ELEVENLABS_AGENT_ID}`,
      { dynamicVariables: { name: 'ross' } },
    )

    this.socket = new WebSocket(
      `wss://api.elevenlabs.io/v1/convai/conversation?agent_id=${process.env.ELEVENLABS_AGENT_ID}`,
      { 'dynamic-variables': { name: 'foo' } },
    )

    this.socket = new WebSocket(
      `wss://api.elevenlabs.io/v1/convai/conversation?agent_id=${process.env.ELEVENLABS_AGENT_ID}`,
      { name: 'foo' },
    )```