openrouter 0.1.2__py3-none-any.whl → 0.6.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- openrouter/_version.py +2 -2
- openrouter/analytics.py +28 -2
- openrouter/api_keys.py +210 -14
- openrouter/chat.py +192 -200
- openrouter/components/__init__.py +229 -285
- openrouter/components/_schema10.py +39 -0
- openrouter/components/_schema14.py +11 -0
- openrouter/components/_schema17.py +154 -0
- openrouter/components/{_schema3.py → _schema19.py} +28 -22
- openrouter/components/{_schema0.py → _schema5.py} +7 -5
- openrouter/components/assistantmessage.py +32 -1
- openrouter/components/chatgenerationparams.py +57 -343
- openrouter/components/chatmessagecontentitemimage.py +4 -4
- openrouter/components/chatresponsechoice.py +1 -6
- openrouter/components/chatstreamingmessagechunk.py +3 -3
- openrouter/components/developermessage.py +41 -0
- openrouter/components/message.py +6 -39
- openrouter/components/model.py +7 -1
- openrouter/components/openresponsesrequest.py +31 -39
- openrouter/components/outputmodality.py +1 -0
- openrouter/components/providername.py +2 -0
- openrouter/components/providerpreferences.py +2 -10
- openrouter/components/publicendpoint.py +8 -24
- openrouter/components/publicpricing.py +3 -24
- openrouter/credits.py +86 -14
- openrouter/embeddings.py +92 -20
- openrouter/endpoints.py +62 -2
- openrouter/generations.py +26 -0
- openrouter/guardrails.py +3367 -0
- openrouter/models_.py +120 -12
- openrouter/oauth.py +90 -22
- openrouter/operations/__init__.py +601 -30
- openrouter/operations/bulkassignkeystoguardrail.py +116 -0
- openrouter/operations/bulkassignmemberstoguardrail.py +116 -0
- openrouter/operations/bulkunassignkeysfromguardrail.py +116 -0
- openrouter/operations/bulkunassignmembersfromguardrail.py +116 -0
- openrouter/operations/createauthkeyscode.py +81 -3
- openrouter/operations/createcoinbasecharge.py +82 -2
- openrouter/operations/createembeddings.py +82 -3
- openrouter/operations/createguardrail.py +325 -0
- openrouter/operations/createkeys.py +81 -3
- openrouter/operations/createresponses.py +84 -3
- openrouter/operations/deleteguardrail.py +104 -0
- openrouter/operations/deletekeys.py +69 -3
- openrouter/operations/exchangeauthcodeforapikey.py +81 -3
- openrouter/operations/getcredits.py +70 -1
- openrouter/operations/getcurrentkey.py +81 -3
- openrouter/operations/getgeneration.py +248 -3
- openrouter/operations/getguardrail.py +228 -0
- openrouter/operations/getkey.py +64 -1
- openrouter/operations/getmodels.py +95 -5
- openrouter/operations/getuseractivity.py +62 -1
- openrouter/operations/list.py +63 -1
- openrouter/operations/listembeddingsmodels.py +74 -0
- openrouter/operations/listendpoints.py +65 -2
- openrouter/operations/listendpointszdr.py +70 -2
- openrouter/operations/listguardrailkeyassignments.py +192 -0
- openrouter/operations/listguardrailmemberassignments.py +187 -0
- openrouter/operations/listguardrails.py +238 -0
- openrouter/operations/listkeyassignments.py +180 -0
- openrouter/operations/listmemberassignments.py +175 -0
- openrouter/operations/listmodelscount.py +74 -0
- openrouter/operations/listmodelsuser.py +70 -2
- openrouter/operations/listproviders.py +70 -2
- openrouter/operations/sendchatcompletionrequest.py +87 -3
- openrouter/operations/updateguardrail.py +334 -0
- openrouter/operations/updatekeys.py +63 -0
- openrouter/providers.py +36 -2
- openrouter/responses.py +178 -148
- openrouter/sdk.py +5 -8
- openrouter/types/models.py +378 -0
- {openrouter-0.1.2.dist-info → openrouter-0.6.0.dist-info}/METADATA +5 -1
- {openrouter-0.1.2.dist-info → openrouter-0.6.0.dist-info}/RECORD +76 -63
- {openrouter-0.1.2.dist-info → openrouter-0.6.0.dist-info}/WHEEL +1 -1
- openrouter/completions.py +0 -361
- openrouter/components/completionchoice.py +0 -82
- openrouter/components/completioncreateparams.py +0 -277
- openrouter/components/completionlogprobs.py +0 -54
- openrouter/components/completionresponse.py +0 -46
- openrouter/components/completionusage.py +0 -19
- openrouter/operations/getparameters.py +0 -123
- openrouter/parameters.py +0 -237
- {openrouter-0.1.2.dist-info → openrouter-0.6.0.dist-info}/licenses/LICENSE +0 -0
- {openrouter-0.1.2.dist-info → openrouter-0.6.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from ._schema14 import Schema14, Schema14TypedDict
|
|
5
|
+
from openrouter.types import BaseModel
|
|
6
|
+
from typing import Any, Optional, Union
|
|
7
|
+
from typing_extensions import NotRequired, TypeAliasType, TypedDict
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
PromptTypedDict = TypeAliasType("PromptTypedDict", Union[float, str, Any])
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
Prompt = TypeAliasType("Prompt", Union[float, str, Any])
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
CompletionTypedDict = TypeAliasType("CompletionTypedDict", Union[float, str, Any])
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
Completion = TypeAliasType("Completion", Union[float, str, Any])
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class Schema10TypedDict(TypedDict):
|
|
23
|
+
prompt: NotRequired[PromptTypedDict]
|
|
24
|
+
completion: NotRequired[CompletionTypedDict]
|
|
25
|
+
image: NotRequired[Schema14TypedDict]
|
|
26
|
+
audio: NotRequired[Schema14TypedDict]
|
|
27
|
+
request: NotRequired[Schema14TypedDict]
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class Schema10(BaseModel):
|
|
31
|
+
prompt: Optional[Prompt] = None
|
|
32
|
+
|
|
33
|
+
completion: Optional[Completion] = None
|
|
34
|
+
|
|
35
|
+
image: Optional[Schema14] = None
|
|
36
|
+
|
|
37
|
+
audio: Optional[Schema14] = None
|
|
38
|
+
|
|
39
|
+
request: Optional[Schema14] = None
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from typing import Any, Union
|
|
5
|
+
from typing_extensions import TypeAliasType
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Schema14TypedDict = TypeAliasType("Schema14TypedDict", Union[float, str, Any])
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
Schema14 = TypeAliasType("Schema14", Union[float, str, Any])
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from openrouter.types import BaseModel, UnrecognizedStr
|
|
5
|
+
from openrouter.utils import get_discriminator, validate_const, validate_open_enum
|
|
6
|
+
import pydantic
|
|
7
|
+
from pydantic import Discriminator, Tag
|
|
8
|
+
from pydantic.functional_validators import AfterValidator, PlainValidator
|
|
9
|
+
from typing import List, Literal, Optional, Union
|
|
10
|
+
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class Schema17ResponseHealingTypedDict(TypedDict):
|
|
14
|
+
id: Literal["response-healing"]
|
|
15
|
+
enabled: NotRequired[bool]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class Schema17ResponseHealing(BaseModel):
|
|
19
|
+
ID: Annotated[
|
|
20
|
+
Annotated[
|
|
21
|
+
Literal["response-healing"],
|
|
22
|
+
AfterValidator(validate_const("response-healing")),
|
|
23
|
+
],
|
|
24
|
+
pydantic.Field(alias="id"),
|
|
25
|
+
] = "response-healing"
|
|
26
|
+
|
|
27
|
+
enabled: Optional[bool] = None
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
PdfEngine = Union[
|
|
31
|
+
Literal[
|
|
32
|
+
"mistral-ocr",
|
|
33
|
+
"pdf-text",
|
|
34
|
+
"native",
|
|
35
|
+
],
|
|
36
|
+
UnrecognizedStr,
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class PdfTypedDict(TypedDict):
|
|
41
|
+
engine: NotRequired[PdfEngine]
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class Pdf(BaseModel):
|
|
45
|
+
engine: Annotated[
|
|
46
|
+
Optional[PdfEngine], PlainValidator(validate_open_enum(False))
|
|
47
|
+
] = None
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class Schema17FileParserTypedDict(TypedDict):
|
|
51
|
+
id: Literal["file-parser"]
|
|
52
|
+
enabled: NotRequired[bool]
|
|
53
|
+
pdf: NotRequired[PdfTypedDict]
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class Schema17FileParser(BaseModel):
|
|
57
|
+
ID: Annotated[
|
|
58
|
+
Annotated[
|
|
59
|
+
Literal["file-parser"], AfterValidator(validate_const("file-parser"))
|
|
60
|
+
],
|
|
61
|
+
pydantic.Field(alias="id"),
|
|
62
|
+
] = "file-parser"
|
|
63
|
+
|
|
64
|
+
enabled: Optional[bool] = None
|
|
65
|
+
|
|
66
|
+
pdf: Optional[Pdf] = None
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
Engine = Union[
|
|
70
|
+
Literal[
|
|
71
|
+
"native",
|
|
72
|
+
"exa",
|
|
73
|
+
],
|
|
74
|
+
UnrecognizedStr,
|
|
75
|
+
]
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class Schema17WebTypedDict(TypedDict):
|
|
79
|
+
id: Literal["web"]
|
|
80
|
+
enabled: NotRequired[bool]
|
|
81
|
+
max_results: NotRequired[float]
|
|
82
|
+
search_prompt: NotRequired[str]
|
|
83
|
+
engine: NotRequired[Engine]
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
class Schema17Web(BaseModel):
|
|
87
|
+
ID: Annotated[
|
|
88
|
+
Annotated[Literal["web"], AfterValidator(validate_const("web"))],
|
|
89
|
+
pydantic.Field(alias="id"),
|
|
90
|
+
] = "web"
|
|
91
|
+
|
|
92
|
+
enabled: Optional[bool] = None
|
|
93
|
+
|
|
94
|
+
max_results: Optional[float] = None
|
|
95
|
+
|
|
96
|
+
search_prompt: Optional[str] = None
|
|
97
|
+
|
|
98
|
+
engine: Annotated[Optional[Engine], PlainValidator(validate_open_enum(False))] = (
|
|
99
|
+
None
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
class Schema17ModerationTypedDict(TypedDict):
|
|
104
|
+
id: Literal["moderation"]
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
class Schema17Moderation(BaseModel):
|
|
108
|
+
ID: Annotated[
|
|
109
|
+
Annotated[Literal["moderation"], AfterValidator(validate_const("moderation"))],
|
|
110
|
+
pydantic.Field(alias="id"),
|
|
111
|
+
] = "moderation"
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
class Schema17AutoRouterTypedDict(TypedDict):
|
|
115
|
+
id: Literal["auto-router"]
|
|
116
|
+
enabled: NotRequired[bool]
|
|
117
|
+
allowed_models: NotRequired[List[str]]
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
class Schema17AutoRouter(BaseModel):
|
|
121
|
+
ID: Annotated[
|
|
122
|
+
Annotated[
|
|
123
|
+
Literal["auto-router"], AfterValidator(validate_const("auto-router"))
|
|
124
|
+
],
|
|
125
|
+
pydantic.Field(alias="id"),
|
|
126
|
+
] = "auto-router"
|
|
127
|
+
|
|
128
|
+
enabled: Optional[bool] = None
|
|
129
|
+
|
|
130
|
+
allowed_models: Optional[List[str]] = None
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
Schema17TypedDict = TypeAliasType(
|
|
134
|
+
"Schema17TypedDict",
|
|
135
|
+
Union[
|
|
136
|
+
Schema17ModerationTypedDict,
|
|
137
|
+
Schema17ResponseHealingTypedDict,
|
|
138
|
+
Schema17AutoRouterTypedDict,
|
|
139
|
+
Schema17FileParserTypedDict,
|
|
140
|
+
Schema17WebTypedDict,
|
|
141
|
+
],
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
Schema17 = Annotated[
|
|
146
|
+
Union[
|
|
147
|
+
Annotated[Schema17AutoRouter, Tag("auto-router")],
|
|
148
|
+
Annotated[Schema17Moderation, Tag("moderation")],
|
|
149
|
+
Annotated[Schema17Web, Tag("web")],
|
|
150
|
+
Annotated[Schema17FileParser, Tag("file-parser")],
|
|
151
|
+
Annotated[Schema17ResponseHealing, Tag("response-healing")],
|
|
152
|
+
],
|
|
153
|
+
Discriminator(lambda m: get_discriminator(m, "id", "id")),
|
|
154
|
+
]
|
|
@@ -17,7 +17,7 @@ from typing import Literal, Optional, Union
|
|
|
17
17
|
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
Schema21 = Union[
|
|
21
21
|
Literal[
|
|
22
22
|
"unknown",
|
|
23
23
|
"openai-responses-v1",
|
|
@@ -30,16 +30,16 @@ Schema5 = Union[
|
|
|
30
30
|
]
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
class
|
|
33
|
+
class Schema19ReasoningTextTypedDict(TypedDict):
|
|
34
34
|
type: Literal["reasoning.text"]
|
|
35
35
|
text: NotRequired[Nullable[str]]
|
|
36
36
|
signature: NotRequired[Nullable[str]]
|
|
37
37
|
id: NotRequired[Nullable[str]]
|
|
38
|
-
format_: NotRequired[Nullable[
|
|
38
|
+
format_: NotRequired[Nullable[Schema21]]
|
|
39
39
|
index: NotRequired[float]
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
class
|
|
42
|
+
class Schema19ReasoningText(BaseModel):
|
|
43
43
|
TYPE: Annotated[
|
|
44
44
|
Annotated[
|
|
45
45
|
Literal["reasoning.text"], AfterValidator(validate_const("reasoning.text"))
|
|
@@ -54,7 +54,9 @@ class Schema3ReasoningText(BaseModel):
|
|
|
54
54
|
id: OptionalNullable[str] = UNSET
|
|
55
55
|
|
|
56
56
|
format_: Annotated[
|
|
57
|
-
Annotated[
|
|
57
|
+
Annotated[
|
|
58
|
+
OptionalNullable[Schema21], PlainValidator(validate_open_enum(False))
|
|
59
|
+
],
|
|
58
60
|
pydantic.Field(alias="format"),
|
|
59
61
|
] = UNSET
|
|
60
62
|
|
|
@@ -91,15 +93,15 @@ class Schema3ReasoningText(BaseModel):
|
|
|
91
93
|
return m
|
|
92
94
|
|
|
93
95
|
|
|
94
|
-
class
|
|
96
|
+
class Schema19ReasoningEncryptedTypedDict(TypedDict):
|
|
95
97
|
data: str
|
|
96
98
|
type: Literal["reasoning.encrypted"]
|
|
97
99
|
id: NotRequired[Nullable[str]]
|
|
98
|
-
format_: NotRequired[Nullable[
|
|
100
|
+
format_: NotRequired[Nullable[Schema21]]
|
|
99
101
|
index: NotRequired[float]
|
|
100
102
|
|
|
101
103
|
|
|
102
|
-
class
|
|
104
|
+
class Schema19ReasoningEncrypted(BaseModel):
|
|
103
105
|
data: str
|
|
104
106
|
|
|
105
107
|
TYPE: Annotated[
|
|
@@ -113,7 +115,9 @@ class Schema3ReasoningEncrypted(BaseModel):
|
|
|
113
115
|
id: OptionalNullable[str] = UNSET
|
|
114
116
|
|
|
115
117
|
format_: Annotated[
|
|
116
|
-
Annotated[
|
|
118
|
+
Annotated[
|
|
119
|
+
OptionalNullable[Schema21], PlainValidator(validate_open_enum(False))
|
|
120
|
+
],
|
|
117
121
|
pydantic.Field(alias="format"),
|
|
118
122
|
] = UNSET
|
|
119
123
|
|
|
@@ -150,15 +154,15 @@ class Schema3ReasoningEncrypted(BaseModel):
|
|
|
150
154
|
return m
|
|
151
155
|
|
|
152
156
|
|
|
153
|
-
class
|
|
157
|
+
class Schema19ReasoningSummaryTypedDict(TypedDict):
|
|
154
158
|
summary: str
|
|
155
159
|
type: Literal["reasoning.summary"]
|
|
156
160
|
id: NotRequired[Nullable[str]]
|
|
157
|
-
format_: NotRequired[Nullable[
|
|
161
|
+
format_: NotRequired[Nullable[Schema21]]
|
|
158
162
|
index: NotRequired[float]
|
|
159
163
|
|
|
160
164
|
|
|
161
|
-
class
|
|
165
|
+
class Schema19ReasoningSummary(BaseModel):
|
|
162
166
|
summary: str
|
|
163
167
|
|
|
164
168
|
TYPE: Annotated[
|
|
@@ -172,7 +176,9 @@ class Schema3ReasoningSummary(BaseModel):
|
|
|
172
176
|
id: OptionalNullable[str] = UNSET
|
|
173
177
|
|
|
174
178
|
format_: Annotated[
|
|
175
|
-
Annotated[
|
|
179
|
+
Annotated[
|
|
180
|
+
OptionalNullable[Schema21], PlainValidator(validate_open_enum(False))
|
|
181
|
+
],
|
|
176
182
|
pydantic.Field(alias="format"),
|
|
177
183
|
] = UNSET
|
|
178
184
|
|
|
@@ -209,21 +215,21 @@ class Schema3ReasoningSummary(BaseModel):
|
|
|
209
215
|
return m
|
|
210
216
|
|
|
211
217
|
|
|
212
|
-
|
|
213
|
-
"
|
|
218
|
+
Schema19TypedDict = TypeAliasType(
|
|
219
|
+
"Schema19TypedDict",
|
|
214
220
|
Union[
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
221
|
+
Schema19ReasoningSummaryTypedDict,
|
|
222
|
+
Schema19ReasoningEncryptedTypedDict,
|
|
223
|
+
Schema19ReasoningTextTypedDict,
|
|
218
224
|
],
|
|
219
225
|
)
|
|
220
226
|
|
|
221
227
|
|
|
222
|
-
|
|
228
|
+
Schema19 = Annotated[
|
|
223
229
|
Union[
|
|
224
|
-
Annotated[
|
|
225
|
-
Annotated[
|
|
226
|
-
Annotated[
|
|
230
|
+
Annotated[Schema19ReasoningSummary, Tag("reasoning.summary")],
|
|
231
|
+
Annotated[Schema19ReasoningEncrypted, Tag("reasoning.encrypted")],
|
|
232
|
+
Annotated[Schema19ReasoningText, Tag("reasoning.text")],
|
|
227
233
|
],
|
|
228
234
|
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
|
229
235
|
]
|
|
@@ -8,11 +8,12 @@ from typing import Literal, Union
|
|
|
8
8
|
from typing_extensions import Annotated, TypeAliasType
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Schema5Enum = Union[
|
|
12
12
|
Literal[
|
|
13
13
|
"AI21",
|
|
14
14
|
"AionLabs",
|
|
15
15
|
"Alibaba",
|
|
16
|
+
"Ambient",
|
|
16
17
|
"Amazon Bedrock",
|
|
17
18
|
"Amazon Nova",
|
|
18
19
|
"Anthropic",
|
|
@@ -69,6 +70,7 @@ Schema0Enum = Union[
|
|
|
69
70
|
"Seed",
|
|
70
71
|
"SiliconFlow",
|
|
71
72
|
"Sourceful",
|
|
73
|
+
"StepFun",
|
|
72
74
|
"Stealth",
|
|
73
75
|
"StreamLake",
|
|
74
76
|
"Switchpoint",
|
|
@@ -85,10 +87,10 @@ Schema0Enum = Union[
|
|
|
85
87
|
]
|
|
86
88
|
|
|
87
89
|
|
|
88
|
-
|
|
90
|
+
Schema5TypedDict = TypeAliasType("Schema5TypedDict", Union[Schema5Enum, str])
|
|
89
91
|
|
|
90
92
|
|
|
91
|
-
|
|
92
|
-
"
|
|
93
|
-
Union[Annotated[
|
|
93
|
+
Schema5 = TypeAliasType(
|
|
94
|
+
"Schema5",
|
|
95
|
+
Union[Annotated[Schema5Enum, PlainValidator(validate_open_enum(False))], str],
|
|
94
96
|
)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
|
+
from ._schema19 import Schema19, Schema19TypedDict
|
|
4
5
|
from .chatmessagecontentitem import (
|
|
5
6
|
ChatMessageContentItem,
|
|
6
7
|
ChatMessageContentItemTypedDict,
|
|
@@ -32,6 +33,22 @@ AssistantMessageContent = TypeAliasType(
|
|
|
32
33
|
)
|
|
33
34
|
|
|
34
35
|
|
|
36
|
+
class AssistantMessageImageURLTypedDict(TypedDict):
|
|
37
|
+
url: str
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class AssistantMessageImageURL(BaseModel):
|
|
41
|
+
url: str
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class ImageTypedDict(TypedDict):
|
|
45
|
+
image_url: AssistantMessageImageURLTypedDict
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class Image(BaseModel):
|
|
49
|
+
image_url: AssistantMessageImageURL
|
|
50
|
+
|
|
51
|
+
|
|
35
52
|
class AssistantMessageTypedDict(TypedDict):
|
|
36
53
|
role: Literal["assistant"]
|
|
37
54
|
content: NotRequired[Nullable[AssistantMessageContentTypedDict]]
|
|
@@ -39,6 +56,8 @@ class AssistantMessageTypedDict(TypedDict):
|
|
|
39
56
|
tool_calls: NotRequired[List[ChatMessageToolCallTypedDict]]
|
|
40
57
|
refusal: NotRequired[Nullable[str]]
|
|
41
58
|
reasoning: NotRequired[Nullable[str]]
|
|
59
|
+
reasoning_details: NotRequired[List[Schema19TypedDict]]
|
|
60
|
+
images: NotRequired[List[ImageTypedDict]]
|
|
42
61
|
|
|
43
62
|
|
|
44
63
|
class AssistantMessage(BaseModel):
|
|
@@ -57,9 +76,21 @@ class AssistantMessage(BaseModel):
|
|
|
57
76
|
|
|
58
77
|
reasoning: OptionalNullable[str] = UNSET
|
|
59
78
|
|
|
79
|
+
reasoning_details: Optional[List[Schema19]] = None
|
|
80
|
+
|
|
81
|
+
images: Optional[List[Image]] = None
|
|
82
|
+
|
|
60
83
|
@model_serializer(mode="wrap")
|
|
61
84
|
def serialize_model(self, handler):
|
|
62
|
-
optional_fields = [
|
|
85
|
+
optional_fields = [
|
|
86
|
+
"content",
|
|
87
|
+
"name",
|
|
88
|
+
"tool_calls",
|
|
89
|
+
"refusal",
|
|
90
|
+
"reasoning",
|
|
91
|
+
"reasoning_details",
|
|
92
|
+
"images",
|
|
93
|
+
]
|
|
63
94
|
nullable_fields = ["content", "refusal", "reasoning"]
|
|
64
95
|
null_default_fields = []
|
|
65
96
|
|