Hi, I created a new environment and installed requ...
# ask-ai
e
Hi, I created a new environment and installed requirements.txt from python-examples repo. I saw in Azure OpenAI realtime documentation that I can connect a seperate tts by adding modalities=['text'], like so https://docs.livekit.io/agents/integrations/realtime/azure-openai/#separate-tts, but it doesnt seem to work, my code session = AgentSession( llm=openai.realtime.RealtimeModel.with_azure( _azure_deployment_=azure_deployment, _azure_endpoint_=azure_endpoint, _api_key_=azure_api_key, _api_version_=azure_api_version, modalities=["text"] ), ) TypeError: RealtimeModel.with_azure() got an unexpected keyword argument 'modalities' Note that I tried the same setup with regular OpenAI Realtime and its fine. Please advise
t
Thanks for reaching out, Zaid. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
The issue you're encountering arises because the
modalities
parameter is not supported in the
RealtimeModel.with_azure()
method in the Python implementation. This is why you're seeing the
TypeError
. To resolve this, you can use the regular
RealtimeModel
constructor instead, which does support the
modalities
parameter. Here's an example:
Copy code
from livekit.plugins import openai

model = openai.realtime.RealtimeModel(
    modalities=["text"],  # or ["text", "audio"] for both text and audio
    azure_deployment="your-deployment",
    api_version="2024-10-01-preview",
    api_key="your-api-key",
    base_url="your-azure-endpoint/openai",
    voice="alloy",
    temperature=0.8,
    # ... other parameters
)
This approach allows you to specify the
modalities
parameter directly and should work as expected. Sources: Azure OpenAI Realtime API and LiveKit | LiveKit Docs | plugins/openai/src/realtime/realtime_model.ts | RealtimeModel | LiveKit Agents | examples/voice_agents/realtime_with_tts.py | plugins/openai/src/realtime/realtime_model.ts
e
i get this error now! llm=openai.realtime.RealtimeModel( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ azure_deployment=azure_deployment, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<2 lines>... api_version=azure_api_version, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ modalities=["text"]), ^^^^^^^^^^^^^^^^^^^^ TypeError: RealtimeModel.__init__() got an unexpected keyword argument 'azure_endpoint'
t
Hey there! I totally understand the frustration with this error. Let me help you navigate through fixing the
azure_endpoint
issue. I've got a few friendly solutions that should make things super smooth for you! Option 1: Use
RealtimeModel.with_azure()
(Recommended)
Sources: livekit-plugins/livekit-plugins-google/livekit/plugins/google/beta/realtime... | Azure integration guide | LiveKit Docs
e
But i want modalities to be text only, and .with_azure() doesnt acccept modalities
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!