-
Notifications
You must be signed in to change notification settings - Fork 386
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Description
Using elevenlabs.conversational_ai.agents.client.AgentsClient().create() with override fields set to True in the platform_settings produces an agent with overrides disabled. On version 2.16.0.
Code example
import os
import httpx
from elevenlabs import ConversationalConfig
from elevenlabs.types.agent_config import AgentConfig
from elevenlabs.core.client_wrapper import SyncClientWrapper
from elevenlabs.conversational_ai.agents.client import AgentsClient
from elevenlabs import AuthSettings
from elevenlabs.types import ConversationConfigClientOverrideConfigInput
from elevenlabs.types.agent_platform_settings_request_model import AgentPlatformSettingsRequestModel
from elevenlabs.types.agent_platform_settings_request_model import AgentPlatformSettingsRequestModel
from elevenlabs.types.conversation_initiation_client_data_config_input import ConversationInitiationClientDataConfigInput
from elevenlabs.types.agent_config_override_config import AgentConfigOverrideConfig
from elevenlabs.types.prompt_agent_api_model_override_config import PromptAgentApiModelOverrideConfig
from elevenlabs.types.tts_conversational_config_override_config import TtsConversationalConfigOverrideConfig
from elevenlabs.types.conversation_config_override_config import ConversationConfigOverrideConfig
from dotenv import load_dotenv
load_dotenv()
def get_qa_agent_wrapped_client():
api_key = os.getenv("ELEVENLABS_API_KEY")
base_url = "https://api.elevenlabs.io"
wrapped_client = SyncClientWrapper(
api_key=api_key,
httpx_client=httpx.Client(),
base_url=base_url,
)
return wrapped_client
def get_qa_agent_config():
patient_config = ConversationalConfig(
agent=AgentConfig(
first_message="Hello, This is John Speaking.",
prompt={
"prompt": (
"You are simulating a customer receiving a call from a support agent."
)
},
language="en",
),
)
return patient_config
def get_qa_agent_platform_settings():
conversation_config_override = ConversationConfigClientOverrideConfigInput(
tts=TtsConversationalConfigOverrideConfig(
voice_id=True, stability=True, speed=True, similarity_boost=True
),
conversation=ConversationConfigOverrideConfig(text_only=True),
agent=AgentConfigOverrideConfig(
first_message=True,
prompt=PromptAgentApiModelOverrideConfig(prompt=True, native_mcp_server_ids=False),
),
)
override = ConversationInitiationClientDataConfigInput(
conversation_config_override=conversation_config_override
)
platform_settings = AgentPlatformSettingsRequestModel(
auth=AuthSettings(
enable_auth=True,
),
override=override
)
return platform_settings
def create_patient_agent(
wrapped_client,
conversational_config: ConversationalConfig,
platform_settings: AgentPlatformSettingsRequestModel,
):
agents_client = AgentsClient(client_wrapper=wrapped_client)
print('platform_settings:\n', platform_settings)
agent = agents_client.create(
conversation_config=conversational_config,
platform_settings=platform_settings,
name="QA_Customer",
)
return agent
def create_qa_agent(wrapped_client):
patient_config = get_qa_agent_config()
platform_settings = get_qa_agent_platform_settings()
qa_agent = create_patient_agent(
wrapped_client, conversational_config=patient_config, platform_settings=platform_settings
)
print(qa_agent)
return qa_agent
if __name__ == "__main__":
wrapped_client = get_qa_agent_wrapped_client()
qa_agent_response = create_qa_agent(wrapped_client)
agents_client = AgentsClient(client_wrapper=wrapped_client)
qa_agent = agents_client.get(qa_agent_response.agent_id)
import pprint
pprint.pprint(qa_agent.platform_settings.overrides.conversation_config_override.__dict__)
Returns:
{'agent': AgentConfigOverrideConfig(first_message=False, language=False, prompt=PromptAgentApiModelOverrideConfig(prompt=False, native_mcp_server_ids=False)),
'conversation': ConversationConfigOverrideConfig(text_only=True),
'tts': TtsConversationalConfigOverrideConfig(voice_id=False, stability=False, speed=False, similarity_boost=False)}
Additional context
Related to elevenlabs/packages#92
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working