Skip to content

Commit 02b8e3b

Browse files
committed
use stable interface instead of beta one
1 parent d83c1a9 commit 02b8e3b

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

docs/references.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,4 @@
7373
- [specification/cognitiveservices/data-plane/AzureOpenAI/inference/preview/2025-04-01-preview/inference.json](https://github.com/Azure/azure-rest-api-specs/blob/main/specification/cognitiveservices/data-plane/AzureOpenAI/inference/preview/2025-04-01-preview/inference.json)
7474
- [Realtime API with WebSocket](https://platform.openai.com/docs/guides/realtime-websocket)
7575
- [GPT-4o Realtime API for speech and audio](https://learn.microsoft.com/en-us/azure/ai-foundry/openai/realtime-audio-quickstart?tabs=keyless%2Clinux&pivots=programming-language-python)
76+
- [OpenAI Python API library > examples/realtime](https://github.com/openai/openai-python/tree/main/examples/realtime)

scripts/realtime_operator.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,17 @@ async def main() -> None:
3232
azure_ad_token_provider=token_provider,
3333
api_version=settings.azure_openai_api_version,
3434
)
35-
async with client.beta.realtime.connect(
35+
async with client.realtime.connect(
3636
model="gpt-realtime", # name of your deployment
3737
) as connection:
3838
await connection.session.update(
3939
session={
4040
"output_modalities": [
4141
"text",
4242
"audio",
43-
]
43+
],
44+
"model": "gpt-realtime",
45+
"type": "realtime",
4446
}
4547
)
4648
while True:
@@ -53,7 +55,10 @@ async def main() -> None:
5355
"type": "message",
5456
"role": "user",
5557
"content": [
56-
{"type": "input_text", "text": user_input},
58+
{
59+
"type": "input_text",
60+
"text": user_input,
61+
},
5762
],
5863
}
5964
)
@@ -66,6 +71,7 @@ async def main() -> None:
6671
break
6772
else:
6873
logger.debug(f"event.type: {event.type}")
74+
# logger.debug(f"event: {event.model_dump_json(indent=2)}")
6975

7076
await credential.close()
7177

0 commit comments

Comments
 (0)