Skip to content

Commit c27ad54

Browse files
committed
gen azure sdk
1 parent cd26391 commit c27ad54

20 files changed

+217
-106
lines changed

.speakeasy/workflow.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ speakeasyVersion: 1.451.1
22
sources:
33
mistral-azure-source:
44
sourceNamespace: mistral-azure-source
5-
sourceRevisionDigest: sha256:c441f2d21e7879f5fb9d8d99e2ae242d1e5a84c0c06db971911eb578173e7f62
6-
sourceBlobDigest: sha256:de4af0f100f15fef89e093a6b5393302b2218fb154230594ec811aacdd4f2ec7
5+
sourceRevisionDigest: sha256:9c35eed0174f2d8165807bcd7c8e7b7111fa97c059a77ae7eeaa352ca7e83b4d
6+
sourceBlobDigest: sha256:07283bfde08363f9f69b133888b482472c4bf12d2e5b59cb33c8993c517278e3
77
tags:
88
- latest
99
mistral-google-cloud-source:
@@ -22,10 +22,10 @@ targets:
2222
mistralai-azure-sdk:
2323
source: mistral-azure-source
2424
sourceNamespace: mistral-azure-source
25-
sourceRevisionDigest: sha256:c441f2d21e7879f5fb9d8d99e2ae242d1e5a84c0c06db971911eb578173e7f62
26-
sourceBlobDigest: sha256:de4af0f100f15fef89e093a6b5393302b2218fb154230594ec811aacdd4f2ec7
25+
sourceRevisionDigest: sha256:9c35eed0174f2d8165807bcd7c8e7b7111fa97c059a77ae7eeaa352ca7e83b4d
26+
sourceBlobDigest: sha256:07283bfde08363f9f69b133888b482472c4bf12d2e5b59cb33c8993c517278e3
2727
codeSamplesNamespace: mistral-openapi-azure-code-samples
28-
codeSamplesRevisionDigest: sha256:5db0b04cc2b3962de41cb07e87fe817dd5ec8bc5d8b0254245b26faf70ede027
28+
codeSamplesRevisionDigest: sha256:79a227720579444358a825b1a272c153f3d9dd48cd0913be6c988d7931a44241
2929
mistralai-gcp-sdk:
3030
source: mistral-google-cloud-source
3131
sourceNamespace: mistral-google-cloud-source

packages/mistralai_azure/.speakeasy/gen.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
lockVersion: 2.0.0
22
id: dc40fa48-2c4d-46ad-ac8b-270749770f34
33
management:
4-
docChecksum: d0000cbe03848bfe843794965cba332f
4+
docChecksum: 26271aa279a7a7182f7af19df8b67038
55
docVersion: 0.0.2
6-
speakeasyVersion: 1.440.1
7-
generationVersion: 2.460.1
6+
speakeasyVersion: 1.451.1
7+
generationVersion: 2.470.1
88
releaseVersion: 1.2.3
99
configChecksum: 60295c765204eb0aa26205ec02e574fc
1010
published: true
1111
features:
1212
python:
1313
additionalDependencies: 1.0.0
1414
constsAndDefaults: 1.0.5
15-
core: 5.6.5
15+
core: 5.6.8
1616
defaultEnabledRetries: 0.2.0
1717
enumUnions: 0.1.0
1818
envVarSecurityUsage: 0.3.2
@@ -29,11 +29,10 @@ features:
2929
responseFormat: 1.0.1
3030
retries: 3.0.2
3131
sdkHooks: 1.0.0
32-
serverEvents: 1.0.4
32+
serverEvents: 1.0.7
3333
serverEventsSentinels: 0.1.0
3434
serverIDs: 3.0.0
35-
tests: 1.6.0
36-
unions: 3.0.3
35+
unions: 3.0.4
3736
generatedFiles:
3837
- .gitattributes
3938
- .python-version
@@ -166,3 +165,4 @@ examples:
166165
"200":
167166
application/json: {"id": "cmpl-e5cc70bb28c444948073e77776eb30ef", "object": "chat.completion", "model": "mistral-small-latest", "usage": {"prompt_tokens": 16, "completion_tokens": 34, "total_tokens": 50}, "created": 1702256327, "choices": []}
168167
"422": {}
168+
generatedTests: {}

packages/mistralai_azure/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ eval-type-backport = "^0.2.0"
2121
httpx = "^0.27.0"
2222
jsonpath-python = "^1.0.6"
2323
pydantic = "~2.9.2"
24-
python-dateutil = "2.8.2"
24+
python-dateutil = "^2.8.2"
2525
typing-inspect = "^0.9.0"
2626

2727
[tool.poetry.group.dev.dependencies]
28-
mypy = "==1.10.1"
28+
mypy = "==1.13.0"
2929
pylint = "==3.2.3"
3030
pytest = "^8.2.2"
3131
pytest-asyncio = "^0.23.7"

packages/mistralai_azure/src/mistralai_azure/chat.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from mistralai_azure._hooks import HookContext
66
from mistralai_azure.types import OptionalNullable, UNSET
77
from mistralai_azure.utils import eventstreaming
8-
from typing import Any, AsyncGenerator, Generator, List, Optional, Union
8+
from typing import Any, List, Optional, Union
99

1010

1111
class Chat(BaseSDK):
@@ -41,7 +41,7 @@ def stream(
4141
retries: OptionalNullable[utils.RetryConfig] = UNSET,
4242
server_url: Optional[str] = None,
4343
timeout_ms: Optional[int] = None,
44-
) -> Optional[Generator[models.CompletionEvent, None, None]]:
44+
) -> Optional[eventstreaming.EventStream[models.CompletionEvent]]:
4545
r"""Stream chat completion
4646
4747
Mistral AI provides the ability to stream responses back to a client in order to allow partial results for certain requests. Tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message. Otherwise, the server will hold the request open until the timeout or until completion, with the response containing the full result as JSON.
@@ -135,7 +135,7 @@ def stream(
135135

136136
data: Any = None
137137
if utils.match_response(http_res, "200", "text/event-stream"):
138-
return eventstreaming.stream_events(
138+
return eventstreaming.EventStream(
139139
http_res,
140140
lambda raw: utils.unmarshal_json(raw, models.CompletionEvent),
141141
sentinel="[DONE]",
@@ -189,7 +189,7 @@ async def stream_async(
189189
retries: OptionalNullable[utils.RetryConfig] = UNSET,
190190
server_url: Optional[str] = None,
191191
timeout_ms: Optional[int] = None,
192-
) -> Optional[AsyncGenerator[models.CompletionEvent, None]]:
192+
) -> Optional[eventstreaming.EventStreamAsync[models.CompletionEvent]]:
193193
r"""Stream chat completion
194194
195195
Mistral AI provides the ability to stream responses back to a client in order to allow partial results for certain requests. Tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message. Otherwise, the server will hold the request open until the timeout or until completion, with the response containing the full result as JSON.
@@ -283,7 +283,7 @@ async def stream_async(
283283

284284
data: Any = None
285285
if utils.match_response(http_res, "200", "text/event-stream"):
286-
return eventstreaming.stream_events_async(
286+
return eventstreaming.EventStreamAsync(
287287
http_res,
288288
lambda raw: utils.unmarshal_json(raw, models.CompletionEvent),
289289
sentinel="[DONE]",

packages/mistralai_azure/src/mistralai_azure/httpclient.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ def build_request(
4141
) -> httpx.Request:
4242
pass
4343

44+
def close(self) -> None:
45+
pass
46+
4447

4548
@runtime_checkable
4649
class AsyncHttpClient(Protocol):
@@ -76,3 +79,6 @@ def build_request(
7679
extensions: Optional[httpx._types.RequestExtensions] = None,
7780
) -> httpx.Request:
7881
pass
82+
83+
async def aclose(self) -> None:
84+
pass

packages/mistralai_azure/src/mistralai_azure/models/assistantmessage.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,17 @@
1212
)
1313
from pydantic import model_serializer
1414
from typing import List, Literal, Optional, Union
15-
from typing_extensions import NotRequired, TypedDict
15+
from typing_extensions import NotRequired, TypeAliasType, TypedDict
1616

1717

18-
AssistantMessageContentTypedDict = Union[str, List[ContentChunkTypedDict]]
18+
AssistantMessageContentTypedDict = TypeAliasType(
19+
"AssistantMessageContentTypedDict", Union[str, List[ContentChunkTypedDict]]
20+
)
1921

2022

21-
AssistantMessageContent = Union[str, List[ContentChunk]]
23+
AssistantMessageContent = TypeAliasType(
24+
"AssistantMessageContent", Union[str, List[ContentChunk]]
25+
)
2226

2327

2428
AssistantMessageRole = Literal["assistant"]

packages/mistralai_azure/src/mistralai_azure/models/chatcompletionrequest.py

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,30 @@
1919
from mistralai_azure.utils import get_discriminator
2020
from pydantic import Discriminator, Tag, model_serializer
2121
from typing import List, Optional, Union
22-
from typing_extensions import Annotated, NotRequired, TypedDict
22+
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
2323

2424

25-
ChatCompletionRequestStopTypedDict = Union[str, List[str]]
25+
ChatCompletionRequestStopTypedDict = TypeAliasType(
26+
"ChatCompletionRequestStopTypedDict", Union[str, List[str]]
27+
)
2628
r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
2729

2830

29-
ChatCompletionRequestStop = Union[str, List[str]]
31+
ChatCompletionRequestStop = TypeAliasType(
32+
"ChatCompletionRequestStop", Union[str, List[str]]
33+
)
3034
r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
3135

3236

33-
ChatCompletionRequestMessagesTypedDict = Union[
34-
SystemMessageTypedDict,
35-
UserMessageTypedDict,
36-
AssistantMessageTypedDict,
37-
ToolMessageTypedDict,
38-
]
37+
ChatCompletionRequestMessagesTypedDict = TypeAliasType(
38+
"ChatCompletionRequestMessagesTypedDict",
39+
Union[
40+
SystemMessageTypedDict,
41+
UserMessageTypedDict,
42+
AssistantMessageTypedDict,
43+
ToolMessageTypedDict,
44+
],
45+
)
3946

4047

4148
ChatCompletionRequestMessages = Annotated[
@@ -49,10 +56,15 @@
4956
]
5057

5158

52-
ChatCompletionRequestToolChoiceTypedDict = Union[ToolChoiceTypedDict, ToolChoiceEnum]
59+
ChatCompletionRequestToolChoiceTypedDict = TypeAliasType(
60+
"ChatCompletionRequestToolChoiceTypedDict",
61+
Union[ToolChoiceTypedDict, ToolChoiceEnum],
62+
)
5363

5464

55-
ChatCompletionRequestToolChoice = Union[ToolChoice, ToolChoiceEnum]
65+
ChatCompletionRequestToolChoice = TypeAliasType(
66+
"ChatCompletionRequestToolChoice", Union[ToolChoice, ToolChoiceEnum]
67+
)
5668

5769

5870
class ChatCompletionRequestTypedDict(TypedDict):

packages/mistralai_azure/src/mistralai_azure/models/chatcompletionstreamrequest.py

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,26 @@
1919
from mistralai_azure.utils import get_discriminator
2020
from pydantic import Discriminator, Tag, model_serializer
2121
from typing import List, Optional, Union
22-
from typing_extensions import Annotated, NotRequired, TypedDict
22+
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
2323

2424

25-
StopTypedDict = Union[str, List[str]]
25+
StopTypedDict = TypeAliasType("StopTypedDict", Union[str, List[str]])
2626
r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
2727

2828

29-
Stop = Union[str, List[str]]
29+
Stop = TypeAliasType("Stop", Union[str, List[str]])
3030
r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
3131

3232

33-
MessagesTypedDict = Union[
34-
SystemMessageTypedDict,
35-
UserMessageTypedDict,
36-
AssistantMessageTypedDict,
37-
ToolMessageTypedDict,
38-
]
33+
MessagesTypedDict = TypeAliasType(
34+
"MessagesTypedDict",
35+
Union[
36+
SystemMessageTypedDict,
37+
UserMessageTypedDict,
38+
AssistantMessageTypedDict,
39+
ToolMessageTypedDict,
40+
],
41+
)
3942

4043

4144
Messages = Annotated[
@@ -49,12 +52,15 @@
4952
]
5053

5154

52-
ChatCompletionStreamRequestToolChoiceTypedDict = Union[
53-
ToolChoiceTypedDict, ToolChoiceEnum
54-
]
55+
ChatCompletionStreamRequestToolChoiceTypedDict = TypeAliasType(
56+
"ChatCompletionStreamRequestToolChoiceTypedDict",
57+
Union[ToolChoiceTypedDict, ToolChoiceEnum],
58+
)
5559

5660

57-
ChatCompletionStreamRequestToolChoice = Union[ToolChoice, ToolChoiceEnum]
61+
ChatCompletionStreamRequestToolChoice = TypeAliasType(
62+
"ChatCompletionStreamRequestToolChoice", Union[ToolChoice, ToolChoiceEnum]
63+
)
5864

5965

6066
class ChatCompletionStreamRequestTypedDict(TypedDict):

packages/mistralai_azure/src/mistralai_azure/models/contentchunk.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66
from mistralai_azure.utils import get_discriminator
77
from pydantic import Discriminator, Tag
88
from typing import Union
9-
from typing_extensions import Annotated
9+
from typing_extensions import Annotated, TypeAliasType
1010

1111

12-
ContentChunkTypedDict = Union[TextChunkTypedDict, ReferenceChunkTypedDict]
12+
ContentChunkTypedDict = TypeAliasType(
13+
"ContentChunkTypedDict", Union[TextChunkTypedDict, ReferenceChunkTypedDict]
14+
)
1315

1416

1517
ContentChunk = Annotated[

packages/mistralai_azure/src/mistralai_azure/models/deltamessage.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@
1212
)
1313
from pydantic import model_serializer
1414
from typing import List, Union
15-
from typing_extensions import NotRequired, TypedDict
15+
from typing_extensions import NotRequired, TypeAliasType, TypedDict
1616

1717

18-
ContentTypedDict = Union[str, List[ContentChunkTypedDict]]
18+
ContentTypedDict = TypeAliasType(
19+
"ContentTypedDict", Union[str, List[ContentChunkTypedDict]]
20+
)
1921

2022

21-
Content = Union[str, List[ContentChunk]]
23+
Content = TypeAliasType("Content", Union[str, List[ContentChunk]])
2224

2325

2426
class DeltaMessageTypedDict(TypedDict):

0 commit comments

Comments
 (0)