Skip to content

Commit 531710c

Browse files
xitzhangXiting Zhang
andauthored
[VoiceLive] Release 1.0.0b2 (#42946)
Co-authored-by: Xiting Zhang <[email protected]>
1 parent df01859 commit 531710c

File tree

5 files changed

+64
-22
lines changed

5 files changed

+64
-22
lines changed

sdk/ai/azure-ai-voicelive/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Release History
22

3-
## 1.0.0b2 (Unreleased)
3+
## 1.0.0b2 (2025-09-10)
44

55
### Features Added
66

sdk/ai/azure-ai-voicelive/azure/ai/voicelive/_patch.py

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,32 @@
88
99
Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
1010
"""
11+
import sys
1112
import json
1213
import logging
1314
from contextlib import AbstractContextManager
1415
from urllib.parse import parse_qs, urlencode, urlparse, urlunparse
1516

16-
try: # Python 3.11+
17-
from typing import NotRequired # type: ignore[attr-defined]
18-
except Exception: # Python <=3.10
19-
from typing_extensions import NotRequired
17+
from typing import (
18+
TYPE_CHECKING,
19+
Any,
20+
Dict,
21+
Iterator,
22+
List,
23+
Mapping,
24+
Optional,
25+
Sequence,
26+
Tuple,
27+
Union,
28+
cast,
29+
)
2030

21-
from typing import TYPE_CHECKING, Optional, Mapping, Sequence, Tuple, Union, Iterator, Any, Dict, List, cast
31+
# === Third-party ===
2232
from typing_extensions import TypedDict
33+
from azure.core.credentials import AzureKeyCredential, TokenCredential
34+
from azure.core.exceptions import AzureError
35+
36+
# === Local ===
2337
from azure.ai.voicelive.models._models import (
2438
ClientEventConversationItemCreate,
2539
ClientEventConversationItemDelete,
@@ -34,20 +48,26 @@
3448
ConversationRequestItem,
3549
ResponseCreateParams,
3650
)
37-
from azure.core.credentials import AzureKeyCredential, TokenCredential
38-
from azure.core.exceptions import AzureError
3951
from .models import ClientEvent, RequestSession, ServerEvent
4052

53+
# === Conditional typing/runtime ===
4154
if TYPE_CHECKING:
4255
from websockets.typing import Subprotocol as WSSubprotocol # exact type for checkers
4356
else:
4457
try:
4558
from websockets.typing import Subprotocol as WSSubprotocol # runtime if available
4659
except Exception:
47-
4860
class WSSubprotocol(str): # fallback, keeps runtime simple
4961
pass
5062

63+
if TYPE_CHECKING:
64+
# Not imported at runtime; only for type checkers (mypy/pyright).
65+
from websockets.sync.client import ClientConnection as _WSClientConnection
66+
67+
if sys.version_info >= (3, 11):
68+
from typing import NotRequired # noqa: F401
69+
else:
70+
from typing_extensions import NotRequired # noqa: F401
5171

5272
__all__: List[str] = [
5373
"connect",
@@ -492,7 +512,14 @@ class VoiceLiveConnection:
492512
:vartype transcription_session: ~azure.ai.voicelive.TranscriptionSessionResource
493513
"""
494514

495-
def __init__(self, connection) -> None:
515+
session: SessionResource
516+
response: ResponseResource
517+
input_audio_buffer: InputAudioBufferResource
518+
conversation: ConversationResource
519+
output_audio_buffer: OutputAudioBufferResource
520+
transcription_session: TranscriptionSessionResource
521+
522+
def __init__(self, connection: "_WSClientConnection") -> None:
496523
"""Initialize a VoiceLiveConnection.
497524
498525
:param connection: The underlying WebSocket connection.

sdk/ai/azure-ai-voicelive/azure/ai/voicelive/aio/_patch.py

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,14 @@
77
88
Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
99
"""
10+
import sys
1011
import json
1112
import logging
1213
from contextlib import AbstractAsyncContextManager
1314
from urllib.parse import urlparse, urlunparse, urlencode, parse_qs
14-
15-
# pylint: disable=ungrouped-imports
16-
try: # Python 3.11+
17-
from typing import NotRequired # type: ignore[attr-defined]
18-
except ImportError: # Python <=3.10
19-
from typing_extensions import NotRequired
20-
# pylint: enable=ungrouped-imports
21-
2215
from typing import Any, Dict, List, Mapping, Optional, Union, AsyncIterator, cast
16+
17+
# === Third-party ===
2318
from typing_extensions import TypedDict
2419
import aiohttp
2520
from azure.ai.voicelive.models._models import (
@@ -38,9 +33,16 @@
3833
)
3934
from azure.core.credentials import AzureKeyCredential, TokenCredential
4035
from azure.core.pipeline import policies
36+
37+
# === Local ===
4138
from ..models import ClientEvent, ServerEvent, RequestSession
4239
from .._patch import ConnectionError, ConnectionClosed
4340

41+
if sys.version_info >= (3, 11):
42+
from typing import NotRequired # noqa: F401
43+
else:
44+
from typing_extensions import NotRequired # noqa: F401
45+
4446
__all__: List[str] = [
4547
"connect",
4648
"WebsocketConnectionOptions",
@@ -400,6 +402,16 @@ class VoiceLiveConnection:
400402
:vartype transcription_session: ~azure.ai.voicelive.aio.TranscriptionSessionResource
401403
"""
402404

405+
_client_session: aiohttp.ClientSession
406+
_connection: aiohttp.ClientWebSocketResponse
407+
408+
session: "SessionResource"
409+
response: "ResponseResource"
410+
input_audio_buffer: "InputAudioBufferResource"
411+
conversation: "ConversationResource"
412+
output_audio_buffer: "OutputAudioBufferResource"
413+
transcription_session: "TranscriptionSessionResource"
414+
403415
def __init__(self, client_session: aiohttp.ClientSession, ws: aiohttp.ClientWebSocketResponse) -> None:
404416
"""Initialize a VoiceLiveConnection instance.
405417

sdk/ai/azure-ai-voicelive/azure/ai/voicelive/models/_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3317,7 +3317,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
33173317
super().__init__(*args, **kwargs)
33183318

33193319
@classmethod
3320-
def deserialize(cls, payload: dict) -> "ServerEvent":
3320+
def deserialize(cls, payload: dict[str, Any]) -> "ServerEvent":
33213321
# public, linter-friendly entrypoint
33223322
# pylint: disable-next=protected-access
33233323
return cls._deserialize(payload, [])

sdk/ai/azure-ai-voicelive/pyproject.toml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ keywords = ["azure", "azure sdk", "voice", "voicelive", "realtime", "websocket",
2323

2424
dependencies = [
2525
"isodate>=0.6.1",
26-
"azure-core>=1.35.1", # bump if you rely on 1.35.1
27-
"typing-extensions>=4.6.0; python_version < '3.11'",
26+
"azure-core>=1.35.0",
27+
"typing-extensions>=4.6.0",
2828
]
2929

3030
dynamic = ["version", "readme"]
@@ -60,4 +60,7 @@ readme = { file = ["README.md", "CHANGELOG.md"], content-type = "text/markdown"
6060
include = ["azure.ai.voicelive", "azure.ai.voicelive.*"]
6161

6262
[tool.setuptools.package-data]
63-
"azure.ai.voicelive" = ["py.typed"]
63+
"azure.ai.voicelive" = ["py.typed"]
64+
65+
[tool.azure-sdk-build]
66+
verifytypes = false

0 commit comments

Comments
 (0)