orq-ai-sdk 4.2.0rc28__py3-none-any.whl → 4.2.6__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.
Files changed (167) hide show
  1. orq_ai_sdk/_hooks/globalhook.py +0 -1
  2. orq_ai_sdk/_version.py +3 -3
  3. orq_ai_sdk/audio.py +30 -0
  4. orq_ai_sdk/basesdk.py +20 -6
  5. orq_ai_sdk/chat.py +22 -0
  6. orq_ai_sdk/completions.py +332 -0
  7. orq_ai_sdk/contacts.py +43 -855
  8. orq_ai_sdk/deployments.py +61 -0
  9. orq_ai_sdk/edits.py +258 -0
  10. orq_ai_sdk/embeddings.py +238 -0
  11. orq_ai_sdk/generations.py +272 -0
  12. orq_ai_sdk/identities.py +1037 -0
  13. orq_ai_sdk/images.py +28 -0
  14. orq_ai_sdk/models/__init__.py +5341 -737
  15. orq_ai_sdk/models/actionreviewedstreamingevent.py +18 -1
  16. orq_ai_sdk/models/actionreviewrequestedstreamingevent.py +44 -1
  17. orq_ai_sdk/models/agenterroredstreamingevent.py +18 -1
  18. orq_ai_sdk/models/agentinactivestreamingevent.py +168 -70
  19. orq_ai_sdk/models/agentmessagecreatedstreamingevent.py +18 -2
  20. orq_ai_sdk/models/agentresponsemessage.py +18 -2
  21. orq_ai_sdk/models/agentstartedstreamingevent.py +127 -2
  22. orq_ai_sdk/models/agentthoughtstreamingevent.py +178 -211
  23. orq_ai_sdk/models/conversationresponse.py +31 -20
  24. orq_ai_sdk/models/conversationwithmessagesresponse.py +31 -20
  25. orq_ai_sdk/models/createagentrequestop.py +1922 -384
  26. orq_ai_sdk/models/createagentresponse.py +147 -91
  27. orq_ai_sdk/models/createagentresponserequestop.py +111 -2
  28. orq_ai_sdk/models/createchatcompletionop.py +1375 -861
  29. orq_ai_sdk/models/createchunkop.py +46 -19
  30. orq_ai_sdk/models/createcompletionop.py +1890 -0
  31. orq_ai_sdk/models/createcontactop.py +45 -56
  32. orq_ai_sdk/models/createconversationop.py +61 -39
  33. orq_ai_sdk/models/createconversationresponseop.py +68 -4
  34. orq_ai_sdk/models/createdatasetitemop.py +424 -80
  35. orq_ai_sdk/models/createdatasetop.py +19 -2
  36. orq_ai_sdk/models/createdatasourceop.py +92 -26
  37. orq_ai_sdk/models/createembeddingop.py +384 -0
  38. orq_ai_sdk/models/createevalop.py +552 -24
  39. orq_ai_sdk/models/createidentityop.py +176 -0
  40. orq_ai_sdk/models/createimageeditop.py +504 -0
  41. orq_ai_sdk/models/createimageop.py +208 -117
  42. orq_ai_sdk/models/createimagevariationop.py +486 -0
  43. orq_ai_sdk/models/createknowledgeop.py +186 -121
  44. orq_ai_sdk/models/creatememorydocumentop.py +50 -1
  45. orq_ai_sdk/models/creatememoryop.py +34 -21
  46. orq_ai_sdk/models/creatememorystoreop.py +34 -1
  47. orq_ai_sdk/models/createmoderationop.py +521 -0
  48. orq_ai_sdk/models/createpromptop.py +2748 -1252
  49. orq_ai_sdk/models/creatererankop.py +416 -0
  50. orq_ai_sdk/models/createresponseop.py +2567 -0
  51. orq_ai_sdk/models/createspeechop.py +316 -0
  52. orq_ai_sdk/models/createtoolop.py +537 -12
  53. orq_ai_sdk/models/createtranscriptionop.py +562 -0
  54. orq_ai_sdk/models/createtranslationop.py +540 -0
  55. orq_ai_sdk/models/datapart.py +18 -1
  56. orq_ai_sdk/models/deletechunksop.py +34 -1
  57. orq_ai_sdk/models/{deletecontactop.py → deleteidentityop.py} +9 -9
  58. orq_ai_sdk/models/deletepromptop.py +26 -0
  59. orq_ai_sdk/models/deploymentcreatemetricop.py +362 -76
  60. orq_ai_sdk/models/deploymentgetconfigop.py +635 -194
  61. orq_ai_sdk/models/deploymentinvokeop.py +168 -173
  62. orq_ai_sdk/models/deploymentsop.py +195 -58
  63. orq_ai_sdk/models/deploymentstreamop.py +652 -304
  64. orq_ai_sdk/models/errorpart.py +18 -1
  65. orq_ai_sdk/models/filecontentpartschema.py +18 -1
  66. orq_ai_sdk/models/filegetop.py +19 -2
  67. orq_ai_sdk/models/filelistop.py +35 -2
  68. orq_ai_sdk/models/filepart.py +50 -1
  69. orq_ai_sdk/models/fileuploadop.py +51 -2
  70. orq_ai_sdk/models/generateconversationnameop.py +31 -20
  71. orq_ai_sdk/models/get_v2_evaluators_id_versionsop.py +34 -1
  72. orq_ai_sdk/models/get_v2_tools_tool_id_versions_version_id_op.py +18 -1
  73. orq_ai_sdk/models/get_v2_tools_tool_id_versionsop.py +34 -1
  74. orq_ai_sdk/models/getallmemoriesop.py +34 -21
  75. orq_ai_sdk/models/getallmemorydocumentsop.py +42 -1
  76. orq_ai_sdk/models/getallmemorystoresop.py +34 -1
  77. orq_ai_sdk/models/getallpromptsop.py +1690 -230
  78. orq_ai_sdk/models/getalltoolsop.py +325 -8
  79. orq_ai_sdk/models/getchunkscountop.py +34 -1
  80. orq_ai_sdk/models/getevalsop.py +395 -43
  81. orq_ai_sdk/models/getonechunkop.py +14 -19
  82. orq_ai_sdk/models/getoneknowledgeop.py +116 -96
  83. orq_ai_sdk/models/getonepromptop.py +1673 -230
  84. orq_ai_sdk/models/getpromptversionop.py +1670 -216
  85. orq_ai_sdk/models/imagecontentpartschema.py +50 -1
  86. orq_ai_sdk/models/internal/globals.py +18 -1
  87. orq_ai_sdk/models/invokeagentop.py +140 -2
  88. orq_ai_sdk/models/invokedeploymentrequest.py +418 -80
  89. orq_ai_sdk/models/invokeevalop.py +160 -131
  90. orq_ai_sdk/models/listagentsop.py +793 -166
  91. orq_ai_sdk/models/listchunksop.py +32 -19
  92. orq_ai_sdk/models/listchunkspaginatedop.py +46 -19
  93. orq_ai_sdk/models/listconversationsop.py +18 -1
  94. orq_ai_sdk/models/listdatasetdatapointsop.py +252 -42
  95. orq_ai_sdk/models/listdatasetsop.py +35 -2
  96. orq_ai_sdk/models/listdatasourcesop.py +35 -26
  97. orq_ai_sdk/models/{listcontactsop.py → listidentitiesop.py} +89 -79
  98. orq_ai_sdk/models/listknowledgebasesop.py +132 -96
  99. orq_ai_sdk/models/listmodelsop.py +1 -0
  100. orq_ai_sdk/models/listpromptversionsop.py +1684 -216
  101. orq_ai_sdk/models/parseop.py +161 -17
  102. orq_ai_sdk/models/partdoneevent.py +19 -2
  103. orq_ai_sdk/models/post_v2_router_ocrop.py +408 -0
  104. orq_ai_sdk/models/publiccontact.py +27 -4
  105. orq_ai_sdk/models/publicidentity.py +62 -0
  106. orq_ai_sdk/models/reasoningpart.py +19 -2
  107. orq_ai_sdk/models/refusalpartschema.py +18 -1
  108. orq_ai_sdk/models/remoteconfigsgetconfigop.py +34 -1
  109. orq_ai_sdk/models/responsedoneevent.py +114 -84
  110. orq_ai_sdk/models/responsestartedevent.py +18 -1
  111. orq_ai_sdk/models/retrieveagentrequestop.py +787 -166
  112. orq_ai_sdk/models/retrievedatapointop.py +236 -42
  113. orq_ai_sdk/models/retrievedatasetop.py +19 -2
  114. orq_ai_sdk/models/retrievedatasourceop.py +17 -26
  115. orq_ai_sdk/models/{retrievecontactop.py → retrieveidentityop.py} +38 -41
  116. orq_ai_sdk/models/retrievememorydocumentop.py +18 -1
  117. orq_ai_sdk/models/retrievememoryop.py +18 -21
  118. orq_ai_sdk/models/retrievememorystoreop.py +18 -1
  119. orq_ai_sdk/models/retrievetoolop.py +309 -8
  120. orq_ai_sdk/models/runagentop.py +1451 -197
  121. orq_ai_sdk/models/searchknowledgeop.py +108 -1
  122. orq_ai_sdk/models/security.py +18 -1
  123. orq_ai_sdk/models/streamagentop.py +93 -2
  124. orq_ai_sdk/models/streamrunagentop.py +1428 -195
  125. orq_ai_sdk/models/textcontentpartschema.py +34 -1
  126. orq_ai_sdk/models/thinkingconfigenabledschema.py +18 -1
  127. orq_ai_sdk/models/toolcallpart.py +18 -1
  128. orq_ai_sdk/models/tooldoneevent.py +18 -1
  129. orq_ai_sdk/models/toolexecutionfailedstreamingevent.py +50 -1
  130. orq_ai_sdk/models/toolexecutionfinishedstreamingevent.py +34 -1
  131. orq_ai_sdk/models/toolexecutionstartedstreamingevent.py +34 -1
  132. orq_ai_sdk/models/toolresultpart.py +18 -1
  133. orq_ai_sdk/models/toolreviewrequestedevent.py +18 -1
  134. orq_ai_sdk/models/toolstartedevent.py +18 -1
  135. orq_ai_sdk/models/updateagentop.py +1951 -404
  136. orq_ai_sdk/models/updatechunkop.py +46 -19
  137. orq_ai_sdk/models/updateconversationop.py +61 -39
  138. orq_ai_sdk/models/updatedatapointop.py +424 -80
  139. orq_ai_sdk/models/updatedatasetop.py +51 -2
  140. orq_ai_sdk/models/updatedatasourceop.py +17 -26
  141. orq_ai_sdk/models/updateevalop.py +577 -16
  142. orq_ai_sdk/models/{updatecontactop.py → updateidentityop.py} +78 -68
  143. orq_ai_sdk/models/updateknowledgeop.py +234 -190
  144. orq_ai_sdk/models/updatememorydocumentop.py +50 -1
  145. orq_ai_sdk/models/updatememoryop.py +50 -21
  146. orq_ai_sdk/models/updatememorystoreop.py +66 -1
  147. orq_ai_sdk/models/updatepromptop.py +2844 -1450
  148. orq_ai_sdk/models/updatetoolop.py +592 -9
  149. orq_ai_sdk/models/usermessagerequest.py +18 -2
  150. orq_ai_sdk/moderations.py +218 -0
  151. orq_ai_sdk/orq_completions.py +660 -0
  152. orq_ai_sdk/orq_responses.py +398 -0
  153. orq_ai_sdk/prompts.py +28 -36
  154. orq_ai_sdk/rerank.py +232 -0
  155. orq_ai_sdk/router.py +89 -641
  156. orq_ai_sdk/sdk.py +3 -0
  157. orq_ai_sdk/speech.py +251 -0
  158. orq_ai_sdk/transcriptions.py +326 -0
  159. orq_ai_sdk/translations.py +298 -0
  160. orq_ai_sdk/utils/__init__.py +13 -1
  161. orq_ai_sdk/variations.py +254 -0
  162. orq_ai_sdk-4.2.6.dist-info/METADATA +888 -0
  163. orq_ai_sdk-4.2.6.dist-info/RECORD +263 -0
  164. {orq_ai_sdk-4.2.0rc28.dist-info → orq_ai_sdk-4.2.6.dist-info}/WHEEL +2 -1
  165. orq_ai_sdk-4.2.6.dist-info/top_level.txt +1 -0
  166. orq_ai_sdk-4.2.0rc28.dist-info/METADATA +0 -867
  167. orq_ai_sdk-4.2.0rc28.dist-info/RECORD +0 -233
@@ -0,0 +1,316 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from .publiccontact import PublicContact, PublicContactTypedDict
5
+ from .publicidentity import PublicIdentity, PublicIdentityTypedDict
6
+ from orq_ai_sdk.types import BaseModel, UNSET_SENTINEL
7
+ import pydantic
8
+ from pydantic import model_serializer
9
+ from typing import List, Literal, Optional
10
+ from typing_extensions import Annotated, NotRequired, TypedDict
11
+
12
+
13
+ CreateSpeechResponseFormat = Literal[
14
+ "mp3",
15
+ "opus",
16
+ "aac",
17
+ "flac",
18
+ "wav",
19
+ "pcm",
20
+ ]
21
+ r"""The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`, `wav`, and `pcm`. If a format is provided but not supported by the provider, the response will be in the default format. When the provided format is not supported by the provider, the response will be in the default format."""
22
+
23
+
24
+ class CreateSpeechRetryTypedDict(TypedDict):
25
+ r"""Retry configuration for the request"""
26
+
27
+ count: NotRequired[float]
28
+ r"""Number of retry attempts (1-5)"""
29
+ on_codes: NotRequired[List[float]]
30
+ r"""HTTP status codes that trigger retry logic"""
31
+
32
+
33
+ class CreateSpeechRetry(BaseModel):
34
+ r"""Retry configuration for the request"""
35
+
36
+ count: Optional[float] = 3
37
+ r"""Number of retry attempts (1-5)"""
38
+
39
+ on_codes: Optional[List[float]] = None
40
+ r"""HTTP status codes that trigger retry logic"""
41
+
42
+ @model_serializer(mode="wrap")
43
+ def serialize_model(self, handler):
44
+ optional_fields = set(["count", "on_codes"])
45
+ serialized = handler(self)
46
+ m = {}
47
+
48
+ for n, f in type(self).model_fields.items():
49
+ k = f.alias or n
50
+ val = serialized.get(k)
51
+
52
+ if val != UNSET_SENTINEL:
53
+ if val is not None or k not in optional_fields:
54
+ m[k] = val
55
+
56
+ return m
57
+
58
+
59
+ class CreateSpeechFallbacksTypedDict(TypedDict):
60
+ model: str
61
+ r"""Fallback model identifier"""
62
+
63
+
64
+ class CreateSpeechFallbacks(BaseModel):
65
+ model: str
66
+ r"""Fallback model identifier"""
67
+
68
+
69
+ class CreateSpeechThreadTypedDict(TypedDict):
70
+ r"""Thread information to group related requests"""
71
+
72
+ id: str
73
+ r"""Unique thread identifier to group related invocations."""
74
+ tags: NotRequired[List[str]]
75
+ r"""Optional tags to differentiate or categorize threads"""
76
+
77
+
78
+ class CreateSpeechThread(BaseModel):
79
+ r"""Thread information to group related requests"""
80
+
81
+ id: str
82
+ r"""Unique thread identifier to group related invocations."""
83
+
84
+ tags: Optional[List[str]] = None
85
+ r"""Optional tags to differentiate or categorize threads"""
86
+
87
+ @model_serializer(mode="wrap")
88
+ def serialize_model(self, handler):
89
+ optional_fields = set(["tags"])
90
+ serialized = handler(self)
91
+ m = {}
92
+
93
+ for n, f in type(self).model_fields.items():
94
+ k = f.alias or n
95
+ val = serialized.get(k)
96
+
97
+ if val != UNSET_SENTINEL:
98
+ if val is not None or k not in optional_fields:
99
+ m[k] = val
100
+
101
+ return m
102
+
103
+
104
+ CreateSpeechLoadBalancerType = Literal["weight_based",]
105
+
106
+
107
+ class CreateSpeechLoadBalancerModelsTypedDict(TypedDict):
108
+ model: str
109
+ r"""Model identifier for load balancing"""
110
+ weight: NotRequired[float]
111
+ r"""Weight assigned to this model for load balancing"""
112
+
113
+
114
+ class CreateSpeechLoadBalancerModels(BaseModel):
115
+ model: str
116
+ r"""Model identifier for load balancing"""
117
+
118
+ weight: Optional[float] = 0.5
119
+ r"""Weight assigned to this model for load balancing"""
120
+
121
+ @model_serializer(mode="wrap")
122
+ def serialize_model(self, handler):
123
+ optional_fields = set(["weight"])
124
+ serialized = handler(self)
125
+ m = {}
126
+
127
+ for n, f in type(self).model_fields.items():
128
+ k = f.alias or n
129
+ val = serialized.get(k)
130
+
131
+ if val != UNSET_SENTINEL:
132
+ if val is not None or k not in optional_fields:
133
+ m[k] = val
134
+
135
+ return m
136
+
137
+
138
+ class CreateSpeechLoadBalancer1TypedDict(TypedDict):
139
+ type: CreateSpeechLoadBalancerType
140
+ models: List[CreateSpeechLoadBalancerModelsTypedDict]
141
+
142
+
143
+ class CreateSpeechLoadBalancer1(BaseModel):
144
+ type: CreateSpeechLoadBalancerType
145
+
146
+ models: List[CreateSpeechLoadBalancerModels]
147
+
148
+
149
+ CreateSpeechLoadBalancerTypedDict = CreateSpeechLoadBalancer1TypedDict
150
+ r"""Array of models with weights for load balancing requests"""
151
+
152
+
153
+ CreateSpeechLoadBalancer = CreateSpeechLoadBalancer1
154
+ r"""Array of models with weights for load balancing requests"""
155
+
156
+
157
+ class CreateSpeechTimeoutTypedDict(TypedDict):
158
+ r"""Timeout configuration to apply to the request. If the request exceeds the timeout, it will be retried or fallback to the next model if configured."""
159
+
160
+ call_timeout: float
161
+ r"""Timeout value in milliseconds"""
162
+
163
+
164
+ class CreateSpeechTimeout(BaseModel):
165
+ r"""Timeout configuration to apply to the request. If the request exceeds the timeout, it will be retried or fallback to the next model if configured."""
166
+
167
+ call_timeout: float
168
+ r"""Timeout value in milliseconds"""
169
+
170
+
171
+ class CreateSpeechOrqTypedDict(TypedDict):
172
+ retry: NotRequired[CreateSpeechRetryTypedDict]
173
+ r"""Retry configuration for the request"""
174
+ fallbacks: NotRequired[List[CreateSpeechFallbacksTypedDict]]
175
+ r"""Array of fallback models to use if primary model fails"""
176
+ name: NotRequired[str]
177
+ r"""The name to display on the trace. If not specified, the default system name will be used."""
178
+ identity: NotRequired[PublicIdentityTypedDict]
179
+ r"""Information about the identity making the request. If the identity does not exist, it will be created automatically."""
180
+ contact: NotRequired[PublicContactTypedDict]
181
+ r"""@deprecated Use identity instead. Information about the contact making the request."""
182
+ thread: NotRequired[CreateSpeechThreadTypedDict]
183
+ r"""Thread information to group related requests"""
184
+ load_balancer: NotRequired[CreateSpeechLoadBalancerTypedDict]
185
+ r"""Array of models with weights for load balancing requests"""
186
+ timeout: NotRequired[CreateSpeechTimeoutTypedDict]
187
+ r"""Timeout configuration to apply to the request. If the request exceeds the timeout, it will be retried or fallback to the next model if configured."""
188
+
189
+
190
+ class CreateSpeechOrq(BaseModel):
191
+ retry: Optional[CreateSpeechRetry] = None
192
+ r"""Retry configuration for the request"""
193
+
194
+ fallbacks: Optional[List[CreateSpeechFallbacks]] = None
195
+ r"""Array of fallback models to use if primary model fails"""
196
+
197
+ name: Optional[str] = None
198
+ r"""The name to display on the trace. If not specified, the default system name will be used."""
199
+
200
+ identity: Optional[PublicIdentity] = None
201
+ r"""Information about the identity making the request. If the identity does not exist, it will be created automatically."""
202
+
203
+ contact: Annotated[
204
+ Optional[PublicContact],
205
+ pydantic.Field(
206
+ deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
207
+ ),
208
+ ] = None
209
+ r"""@deprecated Use identity instead. Information about the contact making the request."""
210
+
211
+ thread: Optional[CreateSpeechThread] = None
212
+ r"""Thread information to group related requests"""
213
+
214
+ load_balancer: Optional[CreateSpeechLoadBalancer] = None
215
+ r"""Array of models with weights for load balancing requests"""
216
+
217
+ timeout: Optional[CreateSpeechTimeout] = None
218
+ r"""Timeout configuration to apply to the request. If the request exceeds the timeout, it will be retried or fallback to the next model if configured."""
219
+
220
+ @model_serializer(mode="wrap")
221
+ def serialize_model(self, handler):
222
+ optional_fields = set(
223
+ [
224
+ "retry",
225
+ "fallbacks",
226
+ "name",
227
+ "identity",
228
+ "contact",
229
+ "thread",
230
+ "load_balancer",
231
+ "timeout",
232
+ ]
233
+ )
234
+ serialized = handler(self)
235
+ m = {}
236
+
237
+ for n, f in type(self).model_fields.items():
238
+ k = f.alias or n
239
+ val = serialized.get(k)
240
+
241
+ if val != UNSET_SENTINEL:
242
+ if val is not None or k not in optional_fields:
243
+ m[k] = val
244
+
245
+ return m
246
+
247
+
248
+ class CreateSpeechRequestBodyTypedDict(TypedDict):
249
+ r"""input"""
250
+
251
+ input: str
252
+ r"""The text to generate audio for. The maximum length is 4096 characters"""
253
+ model: str
254
+ r"""ID of the model to use"""
255
+ voice: str
256
+ r"""The voice to use.
257
+
258
+ Available voices for OpenAI
259
+
260
+ `alloy`, `echo`, `fable`, `onyx`, `nova`, and `shimmer`
261
+
262
+ Available voices for ElevenLabs
263
+
264
+ `aria`, `roger`, `sarah`, `laura`, `charlie`, `george`, `callum`, `river`, `liam`, `charlotte`, `alice`, `matilda`, `will`, `jessica`, `eric`, `chris`, `brian`, `daniel`, `lily`, `bill`
265
+ """
266
+ response_format: NotRequired[CreateSpeechResponseFormat]
267
+ r"""The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`, `wav`, and `pcm`. If a format is provided but not supported by the provider, the response will be in the default format. When the provided format is not supported by the provider, the response will be in the default format."""
268
+ speed: NotRequired[float]
269
+ r"""The speed of the generated audio."""
270
+ orq: NotRequired[CreateSpeechOrqTypedDict]
271
+
272
+
273
+ class CreateSpeechRequestBody(BaseModel):
274
+ r"""input"""
275
+
276
+ input: str
277
+ r"""The text to generate audio for. The maximum length is 4096 characters"""
278
+
279
+ model: str
280
+ r"""ID of the model to use"""
281
+
282
+ voice: str
283
+ r"""The voice to use.
284
+
285
+ Available voices for OpenAI
286
+
287
+ `alloy`, `echo`, `fable`, `onyx`, `nova`, and `shimmer`
288
+
289
+ Available voices for ElevenLabs
290
+
291
+ `aria`, `roger`, `sarah`, `laura`, `charlie`, `george`, `callum`, `river`, `liam`, `charlotte`, `alice`, `matilda`, `will`, `jessica`, `eric`, `chris`, `brian`, `daniel`, `lily`, `bill`
292
+ """
293
+
294
+ response_format: Optional[CreateSpeechResponseFormat] = "mp3"
295
+ r"""The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`, `wav`, and `pcm`. If a format is provided but not supported by the provider, the response will be in the default format. When the provided format is not supported by the provider, the response will be in the default format."""
296
+
297
+ speed: Optional[float] = 1
298
+ r"""The speed of the generated audio."""
299
+
300
+ orq: Optional[CreateSpeechOrq] = None
301
+
302
+ @model_serializer(mode="wrap")
303
+ def serialize_model(self, handler):
304
+ optional_fields = set(["response_format", "speed", "orq"])
305
+ serialized = handler(self)
306
+ m = {}
307
+
308
+ for n, f in type(self).model_fields.items():
309
+ k = f.alias or n
310
+ val = serialized.get(k)
311
+
312
+ if val != UNSET_SENTINEL:
313
+ if val is not None or k not in optional_fields:
314
+ m[k] = val
315
+
316
+ return m