-
public final class ConversationConfigConfiguration class for conversation sessions
This class defines the parameters needed to start a conversation with an ElevenLabs agent. It supports two distinct authentication modes:
Public Agents (no authentication required):
Use
agentIdonlySDK automatically generates conversation token
No API key needed
Private Agents (backend authentication required):
Use
conversationTokenonly (generated on your backend with API key)API key should never be in client-side applications
-
-
Field Summary
-
Constructor Summary
Constructors Constructor Description ConversationConfig(String agentId, String conversationToken, String userId, Boolean textOnly, Integer audioInputSampleRate, String apiEndpoint, String websocketUrl, Overrides overrides, Map<String, Object> customLlmExtraBody, Map<String, Object> dynamicVariables, Map<String, ClientTool> clientTools, Function1<String, Unit> onConnect, Function2<String, String, Unit> onMessage, Function1<ConversationMode, Unit> onModeChange, Function1<ConversationStatus, Unit> onStatusChange, Function1<Boolean, Unit> onCanSendFeedbackChange, Function1<ConversationEvent.ClientToolCall, Unit> onUnhandledClientToolCall, Function1<Float, Unit> onVadScore, Function1<Float, Unit> onAudioLevelChanged, Function1<Map<String, Object>, Unit> onAudioAlignment, Function1<Map<String, Object>, Unit> onAgentResponseMetadata, Function1<String, Unit> onUserTranscript, Function1<String, Unit> onAgentResponse, Function2<String, String, Unit> onAgentResponseCorrection, Function4<String, String, String, Boolean, Unit> onAgentToolResponse, Function3<String, String, String, Unit> onConversationInitiationMetadata, Function1<Integer, Unit> onInterruption, Function1<DisconnectionDetails, Unit> onDisconnect)
-
Method Summary
-
-
Constructor Detail
-
ConversationConfig
ConversationConfig(String agentId, String conversationToken, String userId, Boolean textOnly, Integer audioInputSampleRate, String apiEndpoint, String websocketUrl, Overrides overrides, Map<String, Object> customLlmExtraBody, Map<String, Object> dynamicVariables, Map<String, ClientTool> clientTools, Function1<String, Unit> onConnect, Function2<String, String, Unit> onMessage, Function1<ConversationMode, Unit> onModeChange, Function1<ConversationStatus, Unit> onStatusChange, Function1<Boolean, Unit> onCanSendFeedbackChange, Function1<ConversationEvent.ClientToolCall, Unit> onUnhandledClientToolCall, Function1<Float, Unit> onVadScore, Function1<Float, Unit> onAudioLevelChanged, Function1<Map<String, Object>, Unit> onAudioAlignment, Function1<Map<String, Object>, Unit> onAgentResponseMetadata, Function1<String, Unit> onUserTranscript, Function1<String, Unit> onAgentResponse, Function2<String, String, Unit> onAgentResponseCorrection, Function4<String, String, String, Boolean, Unit> onAgentToolResponse, Function3<String, String, String, Unit> onConversationInitiationMetadata, Function1<Integer, Unit> onInterruption, Function1<DisconnectionDetails, Unit> onDisconnect)
- Parameters:
agentId- Agent identifier for public agents (mutually exclusive with conversationToken)conversationToken- Pre-generated token for private agents (mutually exclusive with agentId)userId- Optional user identifier for conversation trackingtextOnly- Whether to use text-only mode (true) or voice mode (false, default)audioInputSampleRate- Sample rate for audio recording in Hz (default: 48000 for high quality)apiEndpoint- Base URL for ElevenLabs API (default: "https://api.elevenlabs.websocketUrl- WebSocket URL for LiveKit WebRTC connection (default: "wss://livekit.rtc.elevenlabs.
-
-
Method Detail
-
getIsPrivateAgent
final Boolean getIsPrivateAgent()
-
getAgentId
final String getAgentId()
-
getConversationToken
final String getConversationToken()
-
getTextOnly
final Boolean getTextOnly()
-
getAudioInputSampleRate
final Integer getAudioInputSampleRate()
-
getApiEndpoint
final String getApiEndpoint()
-
getWebsocketUrl
final String getWebsocketUrl()
-
getOverrides
final Overrides getOverrides()
-
getCustomLlmExtraBody
final Map<String, Object> getCustomLlmExtraBody()
-
getDynamicVariables
final Map<String, Object> getDynamicVariables()
-
getClientTools
final Map<String, ClientTool> getClientTools()
-
getOnConnect
final Function1<String, Unit> getOnConnect()
-
getOnMessage
final Function2<String, String, Unit> getOnMessage()
-
getOnModeChange
final Function1<ConversationMode, Unit> getOnModeChange()
-
getOnStatusChange
final Function1<ConversationStatus, Unit> getOnStatusChange()
-
getOnCanSendFeedbackChange
final Function1<Boolean, Unit> getOnCanSendFeedbackChange()
-
getOnUnhandledClientToolCall
final Function1<ConversationEvent.ClientToolCall, Unit> getOnUnhandledClientToolCall()
-
getOnVadScore
final Function1<Float, Unit> getOnVadScore()
-
getOnAudioLevelChanged
final Function1<Float, Unit> getOnAudioLevelChanged()
-
getOnAudioAlignment
final Function1<Map<String, Object>, Unit> getOnAudioAlignment()
-
getOnAgentResponseMetadata
final Function1<Map<String, Object>, Unit> getOnAgentResponseMetadata()
-
getOnUserTranscript
final Function1<String, Unit> getOnUserTranscript()
-
getOnAgentResponse
final Function1<String, Unit> getOnAgentResponse()
-
getOnAgentResponseCorrection
final Function2<String, String, Unit> getOnAgentResponseCorrection()
-
getOnAgentToolResponse
final Function4<String, String, String, Boolean, Unit> getOnAgentToolResponse()
-
getOnConversationInitiationMetadata
final Function3<String, String, String, Unit> getOnConversationInitiationMetadata()
-
getOnInterruption
final Function1<Integer, Unit> getOnInterruption()
-
getOnDisconnect
final Function1<DisconnectionDetails, Unit> getOnDisconnect()
-
-
-
-