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
@@ -17,6 +17,14 @@ from .redactedreasoningpartschema import (
17
17
  )
18
18
  from .refusalpartschema import RefusalPartSchema, RefusalPartSchemaTypedDict
19
19
  from .textcontentpartschema import TextContentPartSchema, TextContentPartSchemaTypedDict
20
+ from .thinkingconfigdisabledschema import (
21
+ ThinkingConfigDisabledSchema,
22
+ ThinkingConfigDisabledSchemaTypedDict,
23
+ )
24
+ from .thinkingconfigenabledschema import (
25
+ ThinkingConfigEnabledSchema,
26
+ ThinkingConfigEnabledSchemaTypedDict,
27
+ )
20
28
  from orq_ai_sdk.types import (
21
29
  BaseModel,
22
30
  Nullable,
@@ -89,1284 +97,1342 @@ class CreatePromptMetadata(BaseModel):
89
97
 
90
98
  @model_serializer(mode="wrap")
91
99
  def serialize_model(self, handler):
92
- optional_fields = ["use_cases", "language"]
93
- nullable_fields = ["language"]
94
- null_default_fields = []
95
-
100
+ optional_fields = set(["use_cases", "language"])
101
+ nullable_fields = set(["language"])
96
102
  serialized = handler(self)
97
-
98
103
  m = {}
99
104
 
100
105
  for n, f in type(self).model_fields.items():
101
106
  k = f.alias or n
102
107
  val = serialized.get(k)
103
- serialized.pop(k, None)
104
-
105
- optional_nullable = k in optional_fields and k in nullable_fields
106
- is_set = (
107
- self.__pydantic_fields_set__.intersection({n})
108
- or k in null_default_fields
109
- ) # pylint: disable=no-member
110
-
111
- if val is not None and val != UNSET_SENTINEL:
112
- m[k] = val
113
- elif val != UNSET_SENTINEL and (
114
- not k in optional_fields or (optional_nullable and is_set)
115
- ):
116
- m[k] = val
108
+ is_nullable_and_explicitly_set = (
109
+ k in nullable_fields
110
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
111
+ )
112
+
113
+ if val != UNSET_SENTINEL:
114
+ if (
115
+ val is not None
116
+ or k not in optional_fields
117
+ or is_nullable_and_explicitly_set
118
+ ):
119
+ m[k] = val
117
120
 
118
121
  return m
119
122
 
120
123
 
121
- CreatePromptRole = Literal[
122
- "system",
123
- "assistant",
124
- "user",
125
- "exception",
126
- "tool",
127
- "prompt",
128
- "correction",
129
- "expected_output",
130
- ]
131
- r"""The role of the prompt message"""
124
+ CreatePromptMessagesPromptsRequestRequestBodyRole = Literal["tool",]
125
+ r"""The role of the messages author, in this case tool."""
132
126
 
133
127
 
134
- CreatePrompt2PromptsRequestType = Literal["file",]
135
- r"""The type of the content part. Always `file`."""
128
+ CreatePromptContentPromptsRequest2TypedDict = TextContentPartSchemaTypedDict
136
129
 
137
130
 
138
- class CreatePrompt2FileTypedDict(TypedDict):
139
- file_data: NotRequired[str]
140
- r"""The file data as a data URI string in the format 'data:<mime-type>;base64,<base64-encoded-data>'. Example: 'data:image/png;base64,iVBORw0KGgoAAAANS...'"""
141
- uri: NotRequired[str]
142
- r"""URL to the file. Only supported by Anthropic Claude models for PDF files."""
143
- mime_type: NotRequired[str]
144
- r"""MIME type of the file (e.g., application/pdf, image/png)"""
145
- filename: NotRequired[str]
146
- r"""The name of the file, used when passing the file to the model as a string."""
131
+ CreatePromptContentPromptsRequest2 = TextContentPartSchema
147
132
 
148
133
 
149
- class CreatePrompt2File(BaseModel):
150
- file_data: Optional[str] = None
151
- r"""The file data as a data URI string in the format 'data:<mime-type>;base64,<base64-encoded-data>'. Example: 'data:image/png;base64,iVBORw0KGgoAAAANS...'"""
134
+ CreatePromptMessagesPromptsRequestRequestBodyContentTypedDict = TypeAliasType(
135
+ "CreatePromptMessagesPromptsRequestRequestBodyContentTypedDict",
136
+ Union[str, List[CreatePromptContentPromptsRequest2TypedDict]],
137
+ )
138
+ r"""The contents of the tool message."""
152
139
 
153
- uri: Optional[str] = None
154
- r"""URL to the file. Only supported by Anthropic Claude models for PDF files."""
155
140
 
156
- mime_type: Annotated[Optional[str], pydantic.Field(alias="mimeType")] = None
157
- r"""MIME type of the file (e.g., application/pdf, image/png)"""
141
+ CreatePromptMessagesPromptsRequestRequestBodyContent = TypeAliasType(
142
+ "CreatePromptMessagesPromptsRequestRequestBodyContent",
143
+ Union[str, List[CreatePromptContentPromptsRequest2]],
144
+ )
145
+ r"""The contents of the tool message."""
158
146
 
159
- filename: Optional[str] = None
160
- r"""The name of the file, used when passing the file to the model as a string."""
161
147
 
148
+ CreatePromptMessagesPromptsType = Literal["ephemeral",]
149
+ r"""Create a cache control breakpoint at this content block. Accepts only the value \"ephemeral\"."""
162
150
 
163
- class Two3TypedDict(TypedDict):
164
- type: CreatePrompt2PromptsRequestType
165
- r"""The type of the content part. Always `file`."""
166
- file: CreatePrompt2FileTypedDict
167
151
 
152
+ CreatePromptMessagesTTL = Literal[
153
+ "5m",
154
+ "1h",
155
+ ]
156
+ r"""The time-to-live for the cache control breakpoint. This may be one of the following values:
168
157
 
169
- class Two3(BaseModel):
170
- type: CreatePrompt2PromptsRequestType
171
- r"""The type of the content part. Always `file`."""
158
+ - `5m`: 5 minutes
159
+ - `1h`: 1 hour
172
160
 
173
- file: CreatePrompt2File
161
+ Defaults to `5m`. Only supported by `Anthropic` Claude models.
162
+ """
174
163
 
175
164
 
176
- CreatePrompt2PromptsType = Literal["image_url",]
165
+ class CreatePromptMessagesCacheControlTypedDict(TypedDict):
166
+ type: CreatePromptMessagesPromptsType
167
+ r"""Create a cache control breakpoint at this content block. Accepts only the value \"ephemeral\"."""
168
+ ttl: NotRequired[CreatePromptMessagesTTL]
169
+ r"""The time-to-live for the cache control breakpoint. This may be one of the following values:
177
170
 
171
+ - `5m`: 5 minutes
172
+ - `1h`: 1 hour
178
173
 
179
- class CreatePrompt2ImageURLTypedDict(TypedDict):
180
- url: str
181
- r"""Either a URL of the image or the base64 encoded data URI."""
182
- detail: NotRequired[str]
183
- r"""Specifies the detail level of the image. Currently only supported with OpenAI models"""
174
+ Defaults to `5m`. Only supported by `Anthropic` Claude models.
175
+ """
184
176
 
185
177
 
186
- class CreatePrompt2ImageURL(BaseModel):
187
- url: str
188
- r"""Either a URL of the image or the base64 encoded data URI."""
178
+ class CreatePromptMessagesCacheControl(BaseModel):
179
+ type: CreatePromptMessagesPromptsType
180
+ r"""Create a cache control breakpoint at this content block. Accepts only the value \"ephemeral\"."""
189
181
 
190
- detail: Optional[str] = None
191
- r"""Specifies the detail level of the image. Currently only supported with OpenAI models"""
182
+ ttl: Optional[CreatePromptMessagesTTL] = "5m"
183
+ r"""The time-to-live for the cache control breakpoint. This may be one of the following values:
192
184
 
185
+ - `5m`: 5 minutes
186
+ - `1h`: 1 hour
193
187
 
194
- class CreatePrompt22TypedDict(TypedDict):
195
- r"""The image part of the prompt message. Only supported with vision models."""
188
+ Defaults to `5m`. Only supported by `Anthropic` Claude models.
189
+ """
196
190
 
197
- type: CreatePrompt2PromptsType
198
- image_url: CreatePrompt2ImageURLTypedDict
191
+ @model_serializer(mode="wrap")
192
+ def serialize_model(self, handler):
193
+ optional_fields = set(["ttl"])
194
+ serialized = handler(self)
195
+ m = {}
199
196
 
197
+ for n, f in type(self).model_fields.items():
198
+ k = f.alias or n
199
+ val = serialized.get(k)
200
200
 
201
- class CreatePrompt22(BaseModel):
202
- r"""The image part of the prompt message. Only supported with vision models."""
201
+ if val != UNSET_SENTINEL:
202
+ if val is not None or k not in optional_fields:
203
+ m[k] = val
203
204
 
204
- type: CreatePrompt2PromptsType
205
+ return m
205
206
 
206
- image_url: CreatePrompt2ImageURL
207
207
 
208
+ class CreatePromptMessagesToolMessageTypedDict(TypedDict):
209
+ role: CreatePromptMessagesPromptsRequestRequestBodyRole
210
+ r"""The role of the messages author, in this case tool."""
211
+ content: CreatePromptMessagesPromptsRequestRequestBodyContentTypedDict
212
+ r"""The contents of the tool message."""
213
+ tool_call_id: Nullable[str]
214
+ r"""Tool call that this message is responding to."""
215
+ cache_control: NotRequired[CreatePromptMessagesCacheControlTypedDict]
208
216
 
209
- CreatePrompt2Type = Literal["text",]
210
217
 
218
+ class CreatePromptMessagesToolMessage(BaseModel):
219
+ role: CreatePromptMessagesPromptsRequestRequestBodyRole
220
+ r"""The role of the messages author, in this case tool."""
211
221
 
212
- class CreatePrompt21TypedDict(TypedDict):
213
- r"""Text content part of a prompt message"""
222
+ content: CreatePromptMessagesPromptsRequestRequestBodyContent
223
+ r"""The contents of the tool message."""
214
224
 
215
- type: CreatePrompt2Type
216
- text: str
225
+ tool_call_id: Nullable[str]
226
+ r"""Tool call that this message is responding to."""
217
227
 
228
+ cache_control: Optional[CreatePromptMessagesCacheControl] = None
218
229
 
219
- class CreatePrompt21(BaseModel):
220
- r"""Text content part of a prompt message"""
230
+ @model_serializer(mode="wrap")
231
+ def serialize_model(self, handler):
232
+ optional_fields = set(["cache_control"])
233
+ nullable_fields = set(["tool_call_id"])
234
+ serialized = handler(self)
235
+ m = {}
221
236
 
222
- type: CreatePrompt2Type
237
+ for n, f in type(self).model_fields.items():
238
+ k = f.alias or n
239
+ val = serialized.get(k)
240
+ is_nullable_and_explicitly_set = (
241
+ k in nullable_fields
242
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
243
+ )
244
+
245
+ if val != UNSET_SENTINEL:
246
+ if (
247
+ val is not None
248
+ or k not in optional_fields
249
+ or is_nullable_and_explicitly_set
250
+ ):
251
+ m[k] = val
223
252
 
224
- text: str
253
+ return m
225
254
 
226
255
 
227
- CreatePromptContent2TypedDict = TypeAliasType(
228
- "CreatePromptContent2TypedDict",
229
- Union[CreatePrompt21TypedDict, CreatePrompt22TypedDict, Two3TypedDict],
256
+ CreatePromptContentPrompts2TypedDict = TypeAliasType(
257
+ "CreatePromptContentPrompts2TypedDict",
258
+ Union[
259
+ RefusalPartSchemaTypedDict,
260
+ RedactedReasoningPartSchemaTypedDict,
261
+ TextContentPartSchemaTypedDict,
262
+ ReasoningPartSchemaTypedDict,
263
+ ],
230
264
  )
231
265
 
232
266
 
233
- CreatePromptContent2 = Annotated[
267
+ CreatePromptContentPrompts2 = Annotated[
234
268
  Union[
235
- Annotated[CreatePrompt21, Tag("text")],
236
- Annotated[CreatePrompt22, Tag("image_url")],
237
- Annotated[Two3, Tag("file")],
269
+ Annotated[TextContentPartSchema, Tag("text")],
270
+ Annotated[RefusalPartSchema, Tag("refusal")],
271
+ Annotated[ReasoningPartSchema, Tag("reasoning")],
272
+ Annotated[RedactedReasoningPartSchema, Tag("redacted_reasoning")],
238
273
  ],
239
274
  Discriminator(lambda m: get_discriminator(m, "type", "type")),
240
275
  ]
241
276
 
242
277
 
243
- CreatePromptContentTypedDict = TypeAliasType(
244
- "CreatePromptContentTypedDict", Union[str, List[CreatePromptContent2TypedDict]]
278
+ CreatePromptMessagesPromptsRequestContentTypedDict = TypeAliasType(
279
+ "CreatePromptMessagesPromptsRequestContentTypedDict",
280
+ Union[str, List[CreatePromptContentPrompts2TypedDict]],
245
281
  )
246
- r"""The contents of the user message. Either the text content of the message or an array of content parts with a defined type, each can be of type `text` or `image_url` when passing in images. You can pass multiple images by adding multiple `image_url` content parts. Can be null for tool messages in certain scenarios."""
282
+ r"""The contents of the assistant message. Required unless `tool_calls` or `function_call` is specified."""
247
283
 
248
284
 
249
- CreatePromptContent = TypeAliasType(
250
- "CreatePromptContent", Union[str, List[CreatePromptContent2]]
285
+ CreatePromptMessagesPromptsRequestContent = TypeAliasType(
286
+ "CreatePromptMessagesPromptsRequestContent",
287
+ Union[str, List[CreatePromptContentPrompts2]],
251
288
  )
252
- r"""The contents of the user message. Either the text content of the message or an array of content parts with a defined type, each can be of type `text` or `image_url` when passing in images. You can pass multiple images by adding multiple `image_url` content parts. Can be null for tool messages in certain scenarios."""
289
+ r"""The contents of the assistant message. Required unless `tool_calls` or `function_call` is specified."""
253
290
 
254
291
 
255
- CreatePromptType = Literal["function",]
292
+ CreatePromptMessagesPromptsRequestRole = Literal["assistant",]
293
+ r"""The role of the messages author, in this case `assistant`."""
256
294
 
257
295
 
258
- class CreatePromptFunctionTypedDict(TypedDict):
259
- name: str
260
- arguments: str
261
- r"""JSON string arguments for the functions"""
296
+ class CreatePromptMessagesAudioTypedDict(TypedDict):
297
+ r"""Data about a previous audio response from the model."""
262
298
 
299
+ id: str
300
+ r"""Unique identifier for a previous audio response from the model."""
263
301
 
264
- class CreatePromptFunction(BaseModel):
265
- name: str
266
302
 
267
- arguments: str
268
- r"""JSON string arguments for the functions"""
303
+ class CreatePromptMessagesAudio(BaseModel):
304
+ r"""Data about a previous audio response from the model."""
269
305
 
306
+ id: str
307
+ r"""Unique identifier for a previous audio response from the model."""
270
308
 
271
- class CreatePromptToolCallsTypedDict(TypedDict):
272
- type: CreatePromptType
273
- function: CreatePromptFunctionTypedDict
274
- id: NotRequired[str]
275
- index: NotRequired[float]
309
+
310
+ CreatePromptMessagesType = Literal["function",]
311
+ r"""The type of the tool. Currently, only `function` is supported."""
276
312
 
277
313
 
278
- class CreatePromptToolCalls(BaseModel):
279
- type: CreatePromptType
314
+ class CreatePromptMessagesFunctionTypedDict(TypedDict):
315
+ name: NotRequired[str]
316
+ r"""The name of the function to call."""
317
+ arguments: NotRequired[str]
318
+ r"""The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function."""
280
319
 
281
- function: CreatePromptFunction
282
320
 
283
- id: Optional[str] = None
321
+ class CreatePromptMessagesFunction(BaseModel):
322
+ name: Optional[str] = None
323
+ r"""The name of the function to call."""
284
324
 
285
- index: Optional[float] = None
325
+ arguments: Optional[str] = None
326
+ r"""The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function."""
286
327
 
328
+ @model_serializer(mode="wrap")
329
+ def serialize_model(self, handler):
330
+ optional_fields = set(["name", "arguments"])
331
+ serialized = handler(self)
332
+ m = {}
287
333
 
288
- class CreatePromptMessagesTypedDict(TypedDict):
289
- role: CreatePromptRole
290
- r"""The role of the prompt message"""
291
- content: Nullable[CreatePromptContentTypedDict]
292
- r"""The contents of the user message. Either the text content of the message or an array of content parts with a defined type, each can be of type `text` or `image_url` when passing in images. You can pass multiple images by adding multiple `image_url` content parts. Can be null for tool messages in certain scenarios."""
293
- tool_calls: NotRequired[List[CreatePromptToolCallsTypedDict]]
294
- tool_call_id: NotRequired[Nullable[str]]
334
+ for n, f in type(self).model_fields.items():
335
+ k = f.alias or n
336
+ val = serialized.get(k)
295
337
 
338
+ if val != UNSET_SENTINEL:
339
+ if val is not None or k not in optional_fields:
340
+ m[k] = val
296
341
 
297
- class CreatePromptMessages(BaseModel):
298
- role: CreatePromptRole
299
- r"""The role of the prompt message"""
342
+ return m
300
343
 
301
- content: Nullable[CreatePromptContent]
302
- r"""The contents of the user message. Either the text content of the message or an array of content parts with a defined type, each can be of type `text` or `image_url` when passing in images. You can pass multiple images by adding multiple `image_url` content parts. Can be null for tool messages in certain scenarios."""
303
344
 
304
- tool_calls: Optional[List[CreatePromptToolCalls]] = None
345
+ class CreatePromptMessagesToolCallsTypedDict(TypedDict):
346
+ id: str
347
+ r"""The ID of the tool call."""
348
+ type: CreatePromptMessagesType
349
+ r"""The type of the tool. Currently, only `function` is supported."""
350
+ function: CreatePromptMessagesFunctionTypedDict
351
+ thought_signature: NotRequired[str]
352
+ r"""Encrypted representation of the model internal reasoning state during function calling. Required by Gemini 3 models when continuing a conversation after a tool call."""
305
353
 
306
- tool_call_id: OptionalNullable[str] = UNSET
354
+
355
+ class CreatePromptMessagesToolCalls(BaseModel):
356
+ id: str
357
+ r"""The ID of the tool call."""
358
+
359
+ type: CreatePromptMessagesType
360
+ r"""The type of the tool. Currently, only `function` is supported."""
361
+
362
+ function: CreatePromptMessagesFunction
363
+
364
+ thought_signature: Optional[str] = None
365
+ r"""Encrypted representation of the model internal reasoning state during function calling. Required by Gemini 3 models when continuing a conversation after a tool call."""
307
366
 
308
367
  @model_serializer(mode="wrap")
309
368
  def serialize_model(self, handler):
310
- optional_fields = ["tool_calls", "tool_call_id"]
311
- nullable_fields = ["content", "tool_call_id"]
312
- null_default_fields = []
313
-
369
+ optional_fields = set(["thought_signature"])
314
370
  serialized = handler(self)
315
-
316
371
  m = {}
317
372
 
318
373
  for n, f in type(self).model_fields.items():
319
374
  k = f.alias or n
320
375
  val = serialized.get(k)
321
- serialized.pop(k, None)
322
-
323
- optional_nullable = k in optional_fields and k in nullable_fields
324
- is_set = (
325
- self.__pydantic_fields_set__.intersection({n})
326
- or k in null_default_fields
327
- ) # pylint: disable=no-member
328
376
 
329
- if val is not None and val != UNSET_SENTINEL:
330
- m[k] = val
331
- elif val != UNSET_SENTINEL and (
332
- not k in optional_fields or (optional_nullable and is_set)
333
- ):
334
- m[k] = val
377
+ if val != UNSET_SENTINEL:
378
+ if val is not None or k not in optional_fields:
379
+ m[k] = val
335
380
 
336
381
  return m
337
382
 
338
383
 
339
- CreatePromptFormat = Literal[
340
- "url",
341
- "b64_json",
342
- "text",
343
- "json_object",
344
- ]
345
- r"""Only supported on `image` models."""
384
+ class CreatePromptMessagesAssistantMessageTypedDict(TypedDict):
385
+ role: CreatePromptMessagesPromptsRequestRole
386
+ r"""The role of the messages author, in this case `assistant`."""
387
+ content: NotRequired[Nullable[CreatePromptMessagesPromptsRequestContentTypedDict]]
388
+ r"""The contents of the assistant message. Required unless `tool_calls` or `function_call` is specified."""
389
+ refusal: NotRequired[Nullable[str]]
390
+ r"""The refusal message by the assistant."""
391
+ name: NotRequired[str]
392
+ r"""An optional name for the participant. Provides the model information to differentiate between participants of the same role."""
393
+ audio: NotRequired[Nullable[CreatePromptMessagesAudioTypedDict]]
394
+ r"""Data about a previous audio response from the model."""
395
+ tool_calls: NotRequired[List[CreatePromptMessagesToolCallsTypedDict]]
396
+ r"""The tool calls generated by the model, such as function calls."""
346
397
 
347
398
 
348
- Six = Literal[
349
- "json",
350
- "text",
351
- "srt",
352
- "verbose_json",
353
- "vtt",
354
- ]
399
+ class CreatePromptMessagesAssistantMessage(BaseModel):
400
+ role: CreatePromptMessagesPromptsRequestRole
401
+ r"""The role of the messages author, in this case `assistant`."""
355
402
 
403
+ content: OptionalNullable[CreatePromptMessagesPromptsRequestContent] = UNSET
404
+ r"""The contents of the assistant message. Required unless `tool_calls` or `function_call` is specified."""
356
405
 
357
- Five = Literal[
358
- "url",
359
- "base64_json",
360
- ]
406
+ refusal: OptionalNullable[str] = UNSET
407
+ r"""The refusal message by the assistant."""
361
408
 
409
+ name: Optional[str] = None
410
+ r"""An optional name for the participant. Provides the model information to differentiate between participants of the same role."""
362
411
 
363
- ResponseFormat4 = Literal[
364
- "mp3",
365
- "opus",
366
- "aac",
367
- "flac",
368
- "wav",
369
- "pcm",
370
- ]
412
+ audio: OptionalNullable[CreatePromptMessagesAudio] = UNSET
413
+ r"""Data about a previous audio response from the model."""
371
414
 
415
+ tool_calls: Optional[List[CreatePromptMessagesToolCalls]] = None
416
+ r"""The tool calls generated by the model, such as function calls."""
372
417
 
373
- CreatePromptResponseFormatPromptsRequestType = Literal["text",]
418
+ @model_serializer(mode="wrap")
419
+ def serialize_model(self, handler):
420
+ optional_fields = set(["content", "refusal", "name", "audio", "tool_calls"])
421
+ nullable_fields = set(["content", "refusal", "audio"])
422
+ serialized = handler(self)
423
+ m = {}
374
424
 
425
+ for n, f in type(self).model_fields.items():
426
+ k = f.alias or n
427
+ val = serialized.get(k)
428
+ is_nullable_and_explicitly_set = (
429
+ k in nullable_fields
430
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
431
+ )
432
+
433
+ if val != UNSET_SENTINEL:
434
+ if (
435
+ val is not None
436
+ or k not in optional_fields
437
+ or is_nullable_and_explicitly_set
438
+ ):
439
+ m[k] = val
375
440
 
376
- class ResponseFormat3TypedDict(TypedDict):
377
- type: CreatePromptResponseFormatPromptsRequestType
441
+ return m
378
442
 
379
443
 
380
- class ResponseFormat3(BaseModel):
381
- type: CreatePromptResponseFormatPromptsRequestType
444
+ CreatePromptMessagesPromptsRole = Literal["user",]
445
+ r"""The role of the messages author, in this case `user`."""
382
446
 
383
447
 
384
- CreatePromptResponseFormatPromptsType = Literal["json_object",]
448
+ CreatePrompt2Type = Literal["file",]
449
+ r"""The type of the content part. Always `file`."""
385
450
 
386
451
 
387
- class ResponseFormat2TypedDict(TypedDict):
388
- type: CreatePromptResponseFormatPromptsType
452
+ CreatePrompt2PromptsType = Literal["ephemeral",]
453
+ r"""Create a cache control breakpoint at this content block. Accepts only the value \"ephemeral\"."""
389
454
 
390
455
 
391
- class ResponseFormat2(BaseModel):
392
- type: CreatePromptResponseFormatPromptsType
456
+ CreatePrompt2TTL = Literal[
457
+ "5m",
458
+ "1h",
459
+ ]
460
+ r"""The time-to-live for the cache control breakpoint. This may be one of the following values:
393
461
 
462
+ - `5m`: 5 minutes
463
+ - `1h`: 1 hour
394
464
 
395
- CreatePromptResponseFormatType = Literal["json_schema",]
465
+ Defaults to `5m`. Only supported by `Anthropic` Claude models.
466
+ """
396
467
 
397
468
 
398
- class CreatePromptResponseFormatJSONSchemaTypedDict(TypedDict):
399
- name: str
400
- schema_: Dict[str, Any]
401
- description: NotRequired[str]
402
- strict: NotRequired[bool]
469
+ class CreatePrompt2CacheControlTypedDict(TypedDict):
470
+ type: CreatePrompt2PromptsType
471
+ r"""Create a cache control breakpoint at this content block. Accepts only the value \"ephemeral\"."""
472
+ ttl: NotRequired[CreatePrompt2TTL]
473
+ r"""The time-to-live for the cache control breakpoint. This may be one of the following values:
403
474
 
475
+ - `5m`: 5 minutes
476
+ - `1h`: 1 hour
404
477
 
405
- class CreatePromptResponseFormatJSONSchema(BaseModel):
406
- name: str
478
+ Defaults to `5m`. Only supported by `Anthropic` Claude models.
479
+ """
407
480
 
408
- schema_: Annotated[Dict[str, Any], pydantic.Field(alias="schema")]
409
481
 
410
- description: Optional[str] = None
482
+ class CreatePrompt2CacheControl(BaseModel):
483
+ type: CreatePrompt2PromptsType
484
+ r"""Create a cache control breakpoint at this content block. Accepts only the value \"ephemeral\"."""
411
485
 
412
- strict: Optional[bool] = None
486
+ ttl: Optional[CreatePrompt2TTL] = "5m"
487
+ r"""The time-to-live for the cache control breakpoint. This may be one of the following values:
413
488
 
489
+ - `5m`: 5 minutes
490
+ - `1h`: 1 hour
414
491
 
415
- class ResponseFormat1TypedDict(TypedDict):
416
- type: CreatePromptResponseFormatType
417
- json_schema: CreatePromptResponseFormatJSONSchemaTypedDict
418
- display_name: NotRequired[str]
492
+ Defaults to `5m`. Only supported by `Anthropic` Claude models.
493
+ """
419
494
 
495
+ @model_serializer(mode="wrap")
496
+ def serialize_model(self, handler):
497
+ optional_fields = set(["ttl"])
498
+ serialized = handler(self)
499
+ m = {}
420
500
 
421
- class ResponseFormat1(BaseModel):
422
- type: CreatePromptResponseFormatType
501
+ for n, f in type(self).model_fields.items():
502
+ k = f.alias or n
503
+ val = serialized.get(k)
423
504
 
424
- json_schema: CreatePromptResponseFormatJSONSchema
505
+ if val != UNSET_SENTINEL:
506
+ if val is not None or k not in optional_fields:
507
+ m[k] = val
425
508
 
426
- display_name: Optional[str] = None
509
+ return m
427
510
 
428
511
 
429
- CreatePromptResponseFormatTypedDict = TypeAliasType(
430
- "CreatePromptResponseFormatTypedDict",
431
- Union[
432
- ResponseFormat2TypedDict,
433
- ResponseFormat3TypedDict,
434
- ResponseFormat1TypedDict,
435
- ResponseFormat4,
436
- Five,
437
- Six,
438
- ],
439
- )
440
- r"""An object specifying the format that the model must output.
512
+ class CreatePrompt24TypedDict(TypedDict):
513
+ type: CreatePrompt2Type
514
+ r"""The type of the content part. Always `file`."""
515
+ file: FileContentPartSchemaTypedDict
516
+ r"""File data for the content part. Must contain either file_data or uri, but not both."""
517
+ cache_control: NotRequired[CreatePrompt2CacheControlTypedDict]
441
518
 
442
- Setting to `{ \"type\": \"json_schema\", \"json_schema\": {...} }` enables Structured Outputs which ensures the model will match your supplied JSON schema
443
519
 
444
- Setting to `{ \"type\": \"json_object\" }` enables JSON mode, which ensures the message the model generates is valid JSON.
520
+ class CreatePrompt24(BaseModel):
521
+ type: CreatePrompt2Type
522
+ r"""The type of the content part. Always `file`."""
445
523
 
446
- Important: when using JSON mode, you must also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly \"stuck\" request. Also note that the message content may be partially cut off if finish_reason=\"length\", which indicates the generation exceeded max_tokens or the conversation exceeded the max context length.
447
- """
524
+ file: FileContentPartSchema
525
+ r"""File data for the content part. Must contain either file_data or uri, but not both."""
526
+
527
+ cache_control: Optional[CreatePrompt2CacheControl] = None
528
+
529
+ @model_serializer(mode="wrap")
530
+ def serialize_model(self, handler):
531
+ optional_fields = set(["cache_control"])
532
+ serialized = handler(self)
533
+ m = {}
534
+
535
+ for n, f in type(self).model_fields.items():
536
+ k = f.alias or n
537
+ val = serialized.get(k)
538
+
539
+ if val != UNSET_SENTINEL:
540
+ if val is not None or k not in optional_fields:
541
+ m[k] = val
542
+
543
+ return m
448
544
 
449
545
 
450
- CreatePromptResponseFormat = TypeAliasType(
451
- "CreatePromptResponseFormat",
546
+ CreatePromptContent2TypedDict = TypeAliasType(
547
+ "CreatePromptContent2TypedDict",
452
548
  Union[
453
- ResponseFormat2, ResponseFormat3, ResponseFormat1, ResponseFormat4, Five, Six
549
+ AudioContentPartSchemaTypedDict,
550
+ TextContentPartSchemaTypedDict,
551
+ ImageContentPartSchemaTypedDict,
552
+ CreatePrompt24TypedDict,
454
553
  ],
455
554
  )
456
- r"""An object specifying the format that the model must output.
457
555
 
458
- Setting to `{ \"type\": \"json_schema\", \"json_schema\": {...} }` enables Structured Outputs which ensures the model will match your supplied JSON schema
459
556
 
460
- Setting to `{ \"type\": \"json_object\" }` enables JSON mode, which ensures the message the model generates is valid JSON.
557
+ CreatePromptContent2 = Annotated[
558
+ Union[
559
+ Annotated[TextContentPartSchema, Tag("text")],
560
+ Annotated[ImageContentPartSchema, Tag("image_url")],
561
+ Annotated[AudioContentPartSchema, Tag("input_audio")],
562
+ Annotated[CreatePrompt24, Tag("file")],
563
+ ],
564
+ Discriminator(lambda m: get_discriminator(m, "type", "type")),
565
+ ]
461
566
 
462
- Important: when using JSON mode, you must also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly \"stuck\" request. Also note that the message content may be partially cut off if finish_reason=\"length\", which indicates the generation exceeded max_tokens or the conversation exceeded the max context length.
463
- """
464
567
 
568
+ CreatePromptMessagesPromptsContentTypedDict = TypeAliasType(
569
+ "CreatePromptMessagesPromptsContentTypedDict",
570
+ Union[str, List[CreatePromptContent2TypedDict]],
571
+ )
572
+ r"""The contents of the user message."""
465
573
 
466
- PhotoRealVersion = Literal[
467
- "v1",
468
- "v2",
469
- ]
470
- r"""The version of photoReal to use. Must be v1 or v2. Only available for `leonardoai` provider"""
471
574
 
575
+ CreatePromptMessagesPromptsContent = TypeAliasType(
576
+ "CreatePromptMessagesPromptsContent", Union[str, List[CreatePromptContent2]]
577
+ )
578
+ r"""The contents of the user message."""
472
579
 
473
- EncodingFormat = Literal[
474
- "float",
475
- "base64",
476
- ]
477
- r"""The format to return the embeddings"""
478
580
 
581
+ class CreatePromptMessagesUserMessageTypedDict(TypedDict):
582
+ role: CreatePromptMessagesPromptsRole
583
+ r"""The role of the messages author, in this case `user`."""
584
+ content: CreatePromptMessagesPromptsContentTypedDict
585
+ r"""The contents of the user message."""
586
+ name: NotRequired[str]
587
+ r"""An optional name for the participant. Provides the model information to differentiate between participants of the same role."""
479
588
 
480
- CreatePromptReasoningEffort = Literal[
481
- "none",
482
- "disable",
483
- "minimal",
484
- "low",
485
- "medium",
486
- "high",
487
- ]
488
- r"""Constrains effort on reasoning for reasoning models. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response."""
489
589
 
590
+ class CreatePromptMessagesUserMessage(BaseModel):
591
+ role: CreatePromptMessagesPromptsRole
592
+ r"""The role of the messages author, in this case `user`."""
490
593
 
491
- Verbosity = Literal[
492
- "low",
493
- "medium",
494
- "high",
495
- ]
496
- r"""Controls the verbosity of the model output."""
594
+ content: CreatePromptMessagesPromptsContent
595
+ r"""The contents of the user message."""
497
596
 
597
+ name: Optional[str] = None
598
+ r"""An optional name for the participant. Provides the model information to differentiate between participants of the same role."""
498
599
 
499
- CreatePromptThinkingLevel = Literal[
500
- "low",
501
- "high",
502
- ]
503
- r"""The level of thinking to use for the model. Only supported by `Google AI`"""
600
+ @model_serializer(mode="wrap")
601
+ def serialize_model(self, handler):
602
+ optional_fields = set(["name"])
603
+ serialized = handler(self)
604
+ m = {}
504
605
 
606
+ for n, f in type(self).model_fields.items():
607
+ k = f.alias or n
608
+ val = serialized.get(k)
505
609
 
506
- class ModelParametersTypedDict(TypedDict):
507
- r"""Optional model parameters like temperature and maxTokens."""
610
+ if val != UNSET_SENTINEL:
611
+ if val is not None or k not in optional_fields:
612
+ m[k] = val
508
613
 
509
- temperature: NotRequired[float]
510
- r"""Only supported on `chat` and `completion` models."""
511
- max_tokens: NotRequired[float]
512
- r"""Only supported on `chat` and `completion` models."""
513
- top_k: NotRequired[float]
514
- r"""Only supported on `chat` and `completion` models."""
515
- top_p: NotRequired[float]
516
- r"""Only supported on `chat` and `completion` models."""
517
- frequency_penalty: NotRequired[float]
518
- r"""Only supported on `chat` and `completion` models."""
519
- presence_penalty: NotRequired[float]
520
- r"""Only supported on `chat` and `completion` models."""
521
- num_images: NotRequired[float]
522
- r"""Only supported on `image` models."""
523
- seed: NotRequired[float]
524
- r"""Best effort deterministic seed for the model. Currently only OpenAI models support these"""
525
- format_: NotRequired[CreatePromptFormat]
526
- r"""Only supported on `image` models."""
527
- dimensions: NotRequired[str]
528
- r"""Only supported on `image` models."""
529
- quality: NotRequired[str]
530
- r"""Only supported on `image` models."""
531
- style: NotRequired[str]
532
- r"""Only supported on `image` models."""
533
- response_format: NotRequired[Nullable[CreatePromptResponseFormatTypedDict]]
534
- r"""An object specifying the format that the model must output.
614
+ return m
535
615
 
536
- Setting to `{ \"type\": \"json_schema\", \"json_schema\": {...} }` enables Structured Outputs which ensures the model will match your supplied JSON schema
537
616
 
538
- Setting to `{ \"type\": \"json_object\" }` enables JSON mode, which ensures the message the model generates is valid JSON.
617
+ CreatePromptMessagesRole = Literal["system",]
618
+ r"""The role of the messages author, in this case `system`."""
539
619
 
540
- Important: when using JSON mode, you must also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly \"stuck\" request. Also note that the message content may be partially cut off if finish_reason=\"length\", which indicates the generation exceeded max_tokens or the conversation exceeded the max context length.
541
- """
542
- photo_real_version: NotRequired[PhotoRealVersion]
543
- r"""The version of photoReal to use. Must be v1 or v2. Only available for `leonardoai` provider"""
544
- encoding_format: NotRequired[EncodingFormat]
545
- r"""The format to return the embeddings"""
546
- reasoning_effort: NotRequired[CreatePromptReasoningEffort]
547
- r"""Constrains effort on reasoning for reasoning models. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response."""
548
- budget_tokens: NotRequired[float]
549
- r"""Gives the model enhanced reasoning capabilities for complex tasks. A value of 0 disables thinking. The minimum budget tokens for thinking are 1024. The Budget Tokens should never exceed the Max Tokens parameter. Only supported by `Anthropic`"""
550
- verbosity: NotRequired[Verbosity]
551
- r"""Controls the verbosity of the model output."""
552
- thinking_level: NotRequired[CreatePromptThinkingLevel]
553
- r"""The level of thinking to use for the model. Only supported by `Google AI`"""
554
-
555
-
556
- class ModelParameters(BaseModel):
557
- r"""Optional model parameters like temperature and maxTokens."""
558
-
559
- temperature: Optional[float] = None
560
- r"""Only supported on `chat` and `completion` models."""
561
-
562
- max_tokens: Annotated[Optional[float], pydantic.Field(alias="maxTokens")] = None
563
- r"""Only supported on `chat` and `completion` models."""
564
-
565
- top_k: Annotated[Optional[float], pydantic.Field(alias="topK")] = None
566
- r"""Only supported on `chat` and `completion` models."""
567
-
568
- top_p: Annotated[Optional[float], pydantic.Field(alias="topP")] = None
569
- r"""Only supported on `chat` and `completion` models."""
570
-
571
- frequency_penalty: Annotated[
572
- Optional[float], pydantic.Field(alias="frequencyPenalty")
573
- ] = None
574
- r"""Only supported on `chat` and `completion` models."""
575
-
576
- presence_penalty: Annotated[
577
- Optional[float], pydantic.Field(alias="presencePenalty")
578
- ] = None
579
- r"""Only supported on `chat` and `completion` models."""
580
-
581
- num_images: Annotated[Optional[float], pydantic.Field(alias="numImages")] = None
582
- r"""Only supported on `image` models."""
583
-
584
- seed: Optional[float] = None
585
- r"""Best effort deterministic seed for the model. Currently only OpenAI models support these"""
586
-
587
- format_: Annotated[Optional[CreatePromptFormat], pydantic.Field(alias="format")] = (
588
- None
589
- )
590
- r"""Only supported on `image` models."""
591
-
592
- dimensions: Optional[str] = None
593
- r"""Only supported on `image` models."""
594
620
 
595
- quality: Optional[str] = None
596
- r"""Only supported on `image` models."""
597
-
598
- style: Optional[str] = None
599
- r"""Only supported on `image` models."""
621
+ CreatePromptMessagesContentTypedDict = TypeAliasType(
622
+ "CreatePromptMessagesContentTypedDict",
623
+ Union[str, List[TextContentPartSchemaTypedDict]],
624
+ )
625
+ r"""The contents of the system message."""
600
626
 
601
- response_format: Annotated[
602
- OptionalNullable[CreatePromptResponseFormat],
603
- pydantic.Field(alias="responseFormat"),
604
- ] = UNSET
605
- r"""An object specifying the format that the model must output.
606
627
 
607
- Setting to `{ \"type\": \"json_schema\", \"json_schema\": {...} }` enables Structured Outputs which ensures the model will match your supplied JSON schema
628
+ CreatePromptMessagesContent = TypeAliasType(
629
+ "CreatePromptMessagesContent", Union[str, List[TextContentPartSchema]]
630
+ )
631
+ r"""The contents of the system message."""
608
632
 
609
- Setting to `{ \"type\": \"json_object\" }` enables JSON mode, which ensures the message the model generates is valid JSON.
610
633
 
611
- Important: when using JSON mode, you must also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly \"stuck\" request. Also note that the message content may be partially cut off if finish_reason=\"length\", which indicates the generation exceeded max_tokens or the conversation exceeded the max context length.
612
- """
634
+ class CreatePromptMessagesSystemMessageTypedDict(TypedDict):
635
+ r"""Developer-provided instructions that the model should follow, regardless of messages sent by the user."""
613
636
 
614
- photo_real_version: Annotated[
615
- Optional[PhotoRealVersion], pydantic.Field(alias="photoRealVersion")
616
- ] = None
617
- r"""The version of photoReal to use. Must be v1 or v2. Only available for `leonardoai` provider"""
637
+ role: CreatePromptMessagesRole
638
+ r"""The role of the messages author, in this case `system`."""
639
+ content: CreatePromptMessagesContentTypedDict
640
+ r"""The contents of the system message."""
641
+ name: NotRequired[str]
642
+ r"""An optional name for the participant. Provides the model information to differentiate between participants of the same role."""
618
643
 
619
- encoding_format: Optional[EncodingFormat] = None
620
- r"""The format to return the embeddings"""
621
644
 
622
- reasoning_effort: Annotated[
623
- Optional[CreatePromptReasoningEffort], pydantic.Field(alias="reasoningEffort")
624
- ] = None
625
- r"""Constrains effort on reasoning for reasoning models. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response."""
645
+ class CreatePromptMessagesSystemMessage(BaseModel):
646
+ r"""Developer-provided instructions that the model should follow, regardless of messages sent by the user."""
626
647
 
627
- budget_tokens: Annotated[Optional[float], pydantic.Field(alias="budgetTokens")] = (
628
- None
629
- )
630
- r"""Gives the model enhanced reasoning capabilities for complex tasks. A value of 0 disables thinking. The minimum budget tokens for thinking are 1024. The Budget Tokens should never exceed the Max Tokens parameter. Only supported by `Anthropic`"""
648
+ role: CreatePromptMessagesRole
649
+ r"""The role of the messages author, in this case `system`."""
631
650
 
632
- verbosity: Optional[Verbosity] = None
633
- r"""Controls the verbosity of the model output."""
651
+ content: CreatePromptMessagesContent
652
+ r"""The contents of the system message."""
634
653
 
635
- thinking_level: Annotated[
636
- Optional[CreatePromptThinkingLevel], pydantic.Field(alias="thinkingLevel")
637
- ] = None
638
- r"""The level of thinking to use for the model. Only supported by `Google AI`"""
654
+ name: Optional[str] = None
655
+ r"""An optional name for the participant. Provides the model information to differentiate between participants of the same role."""
639
656
 
640
657
  @model_serializer(mode="wrap")
641
658
  def serialize_model(self, handler):
642
- optional_fields = [
643
- "temperature",
644
- "maxTokens",
645
- "topK",
646
- "topP",
647
- "frequencyPenalty",
648
- "presencePenalty",
649
- "numImages",
650
- "seed",
651
- "format",
652
- "dimensions",
653
- "quality",
654
- "style",
655
- "responseFormat",
656
- "photoRealVersion",
657
- "encoding_format",
658
- "reasoningEffort",
659
- "budgetTokens",
660
- "verbosity",
661
- "thinkingLevel",
662
- ]
663
- nullable_fields = ["responseFormat"]
664
- null_default_fields = []
665
-
659
+ optional_fields = set(["name"])
666
660
  serialized = handler(self)
667
-
668
661
  m = {}
669
662
 
670
663
  for n, f in type(self).model_fields.items():
671
664
  k = f.alias or n
672
665
  val = serialized.get(k)
673
- serialized.pop(k, None)
674
666
 
675
- optional_nullable = k in optional_fields and k in nullable_fields
676
- is_set = (
677
- self.__pydantic_fields_set__.intersection({n})
678
- or k in null_default_fields
679
- ) # pylint: disable=no-member
680
-
681
- if val is not None and val != UNSET_SENTINEL:
682
- m[k] = val
683
- elif val != UNSET_SENTINEL and (
684
- not k in optional_fields or (optional_nullable and is_set)
685
- ):
686
- m[k] = val
667
+ if val != UNSET_SENTINEL:
668
+ if val is not None or k not in optional_fields:
669
+ m[k] = val
687
670
 
688
671
  return m
689
672
 
690
673
 
691
- @deprecated(
692
- "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
674
+ CreatePromptMessagesTypedDict = TypeAliasType(
675
+ "CreatePromptMessagesTypedDict",
676
+ Union[
677
+ CreatePromptMessagesSystemMessageTypedDict,
678
+ CreatePromptMessagesUserMessageTypedDict,
679
+ CreatePromptMessagesToolMessageTypedDict,
680
+ CreatePromptMessagesAssistantMessageTypedDict,
681
+ ],
693
682
  )
694
- class PromptConfigurationTypedDict(TypedDict):
695
- r"""[DEPRECATED]. Please use the `prompt` property instead. The current `prompt_config` will keep working but it will be deprecated in future versions. Configuration for the prompt including model and messages."""
696
683
 
697
- messages: List[CreatePromptMessagesTypedDict]
698
- r"""Array of messages that make up the conversation."""
699
- model: NotRequired[str]
700
- r"""Model ID used to generate the response, like `openai/gpt-4o` or `google/gemini-2.5-pro`. The full list of models can be found at https://docs.orq.ai/docs/ai-gateway-supported-models. Only chat models are supported."""
701
- model_parameters: NotRequired[ModelParametersTypedDict]
702
- r"""Optional model parameters like temperature and maxTokens."""
703
684
 
685
+ CreatePromptMessages = Annotated[
686
+ Union[
687
+ Annotated[CreatePromptMessagesSystemMessage, Tag("system")],
688
+ Annotated[CreatePromptMessagesUserMessage, Tag("user")],
689
+ Annotated[CreatePromptMessagesAssistantMessage, Tag("assistant")],
690
+ Annotated[CreatePromptMessagesToolMessage, Tag("tool")],
691
+ ],
692
+ Discriminator(lambda m: get_discriminator(m, "role", "role")),
693
+ ]
704
694
 
705
- @deprecated(
706
- "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
707
- )
708
- class PromptConfiguration(BaseModel):
709
- r"""[DEPRECATED]. Please use the `prompt` property instead. The current `prompt_config` will keep working but it will be deprecated in future versions. Configuration for the prompt including model and messages."""
710
695
 
711
- messages: List[CreatePromptMessages]
712
- r"""Array of messages that make up the conversation."""
696
+ CreatePromptVoice = Literal[
697
+ "alloy",
698
+ "echo",
699
+ "fable",
700
+ "onyx",
701
+ "nova",
702
+ "shimmer",
703
+ ]
704
+ r"""The voice the model uses to respond. Supported voices are alloy, echo, fable, onyx, nova, and shimmer."""
713
705
 
714
- model: Optional[str] = None
715
- r"""Model ID used to generate the response, like `openai/gpt-4o` or `google/gemini-2.5-pro`. The full list of models can be found at https://docs.orq.ai/docs/ai-gateway-supported-models. Only chat models are supported."""
716
706
 
717
- model_parameters: Optional[ModelParameters] = None
718
- r"""Optional model parameters like temperature and maxTokens."""
707
+ CreatePromptFormat = Literal[
708
+ "wav",
709
+ "mp3",
710
+ "flac",
711
+ "opus",
712
+ "pcm16",
713
+ ]
714
+ r"""Specifies the output audio format. Must be one of wav, mp3, flac, opus, or pcm16."""
719
715
 
720
716
 
721
- CreatePromptMessagesPromptsRequestRequestBodyRole = Literal["tool",]
722
- r"""The role of the messages author, in this case tool."""
717
+ class CreatePromptAudioTypedDict(TypedDict):
718
+ r"""Parameters for audio output. Required when audio output is requested with modalities: [\"audio\"]. Learn more."""
723
719
 
720
+ voice: CreatePromptVoice
721
+ r"""The voice the model uses to respond. Supported voices are alloy, echo, fable, onyx, nova, and shimmer."""
722
+ format_: CreatePromptFormat
723
+ r"""Specifies the output audio format. Must be one of wav, mp3, flac, opus, or pcm16."""
724
724
 
725
- CreatePromptContentPromptsRequestRequestBody2TypedDict = TextContentPartSchemaTypedDict
726
725
 
726
+ class CreatePromptAudio(BaseModel):
727
+ r"""Parameters for audio output. Required when audio output is requested with modalities: [\"audio\"]. Learn more."""
727
728
 
728
- CreatePromptContentPromptsRequestRequestBody2 = TextContentPartSchema
729
+ voice: CreatePromptVoice
730
+ r"""The voice the model uses to respond. Supported voices are alloy, echo, fable, onyx, nova, and shimmer."""
729
731
 
732
+ format_: Annotated[CreatePromptFormat, pydantic.Field(alias="format")]
733
+ r"""Specifies the output audio format. Must be one of wav, mp3, flac, opus, or pcm16."""
730
734
 
731
- CreatePromptMessagesPromptsRequestRequestBodyContentTypedDict = TypeAliasType(
732
- "CreatePromptMessagesPromptsRequestRequestBodyContentTypedDict",
733
- Union[str, List[CreatePromptContentPromptsRequestRequestBody2TypedDict]],
734
- )
735
- r"""The contents of the tool message."""
736
735
 
736
+ CreatePromptResponseFormatPromptsRequestType = Literal["json_schema",]
737
737
 
738
- CreatePromptMessagesPromptsRequestRequestBodyContent = TypeAliasType(
739
- "CreatePromptMessagesPromptsRequestRequestBodyContent",
740
- Union[str, List[CreatePromptContentPromptsRequestRequestBody2]],
741
- )
742
- r"""The contents of the tool message."""
743
738
 
739
+ class CreatePromptResponseFormatPromptsJSONSchemaTypedDict(TypedDict):
740
+ name: str
741
+ r"""The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64."""
742
+ description: NotRequired[str]
743
+ r"""A description of what the response format is for, used by the model to determine how to respond in the format."""
744
+ schema_: NotRequired[Any]
745
+ r"""The schema for the response format, described as a JSON Schema object."""
746
+ strict: NotRequired[bool]
747
+ r"""Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the schema field. Only a subset of JSON Schema is supported when strict is true."""
744
748
 
745
- CreatePromptMessagesPromptsType = Literal["ephemeral",]
746
- r"""Create a cache control breakpoint at this content block. Accepts only the value \"ephemeral\"."""
747
749
 
750
+ class CreatePromptResponseFormatPromptsJSONSchema(BaseModel):
751
+ name: str
752
+ r"""The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64."""
748
753
 
749
- CreatePromptMessagesTTL = Literal[
750
- "5m",
751
- "1h",
752
- ]
753
- r"""The time-to-live for the cache control breakpoint. This may be one of the following values:
754
+ description: Optional[str] = None
755
+ r"""A description of what the response format is for, used by the model to determine how to respond in the format."""
754
756
 
755
- - `5m`: 5 minutes
756
- - `1h`: 1 hour
757
+ schema_: Annotated[Optional[Any], pydantic.Field(alias="schema")] = None
758
+ r"""The schema for the response format, described as a JSON Schema object."""
757
759
 
758
- Defaults to `5m`. Only supported by `Anthropic` Claude models.
759
- """
760
+ strict: Optional[bool] = False
761
+ r"""Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the schema field. Only a subset of JSON Schema is supported when strict is true."""
760
762
 
763
+ @model_serializer(mode="wrap")
764
+ def serialize_model(self, handler):
765
+ optional_fields = set(["description", "schema", "strict"])
766
+ serialized = handler(self)
767
+ m = {}
761
768
 
762
- class CreatePromptMessagesCacheControlTypedDict(TypedDict):
763
- type: CreatePromptMessagesPromptsType
764
- r"""Create a cache control breakpoint at this content block. Accepts only the value \"ephemeral\"."""
765
- ttl: NotRequired[CreatePromptMessagesTTL]
766
- r"""The time-to-live for the cache control breakpoint. This may be one of the following values:
769
+ for n, f in type(self).model_fields.items():
770
+ k = f.alias or n
771
+ val = serialized.get(k)
767
772
 
768
- - `5m`: 5 minutes
769
- - `1h`: 1 hour
773
+ if val != UNSET_SENTINEL:
774
+ if val is not None or k not in optional_fields:
775
+ m[k] = val
770
776
 
771
- Defaults to `5m`. Only supported by `Anthropic` Claude models.
772
- """
777
+ return m
773
778
 
774
779
 
775
- class CreatePromptMessagesCacheControl(BaseModel):
776
- type: CreatePromptMessagesPromptsType
777
- r"""Create a cache control breakpoint at this content block. Accepts only the value \"ephemeral\"."""
780
+ class CreatePromptResponseFormatJSONSchemaTypedDict(TypedDict):
781
+ r"""
778
782
 
779
- ttl: Optional[CreatePromptMessagesTTL] = "5m"
780
- r"""The time-to-live for the cache control breakpoint. This may be one of the following values:
783
+ JSON Schema response format. Used to generate structured JSON responses
784
+ """
781
785
 
782
- - `5m`: 5 minutes
783
- - `1h`: 1 hour
786
+ type: CreatePromptResponseFormatPromptsRequestType
787
+ json_schema: CreatePromptResponseFormatPromptsJSONSchemaTypedDict
784
788
 
785
- Defaults to `5m`. Only supported by `Anthropic` Claude models.
789
+
790
+ class CreatePromptResponseFormatJSONSchema(BaseModel):
791
+ r"""
792
+
793
+ JSON Schema response format. Used to generate structured JSON responses
786
794
  """
787
795
 
796
+ type: CreatePromptResponseFormatPromptsRequestType
788
797
 
789
- class CreatePromptMessagesToolMessageTypedDict(TypedDict):
790
- role: CreatePromptMessagesPromptsRequestRequestBodyRole
791
- r"""The role of the messages author, in this case tool."""
792
- content: CreatePromptMessagesPromptsRequestRequestBodyContentTypedDict
793
- r"""The contents of the tool message."""
794
- tool_call_id: Nullable[str]
795
- r"""Tool call that this message is responding to."""
796
- cache_control: NotRequired[CreatePromptMessagesCacheControlTypedDict]
798
+ json_schema: CreatePromptResponseFormatPromptsJSONSchema
797
799
 
798
800
 
799
- class CreatePromptMessagesToolMessage(BaseModel):
800
- role: CreatePromptMessagesPromptsRequestRequestBodyRole
801
- r"""The role of the messages author, in this case tool."""
801
+ CreatePromptResponseFormatPromptsType = Literal["json_object",]
802
802
 
803
- content: CreatePromptMessagesPromptsRequestRequestBodyContent
804
- r"""The contents of the tool message."""
805
803
 
806
- tool_call_id: Nullable[str]
807
- r"""Tool call that this message is responding to."""
804
+ class CreatePromptResponseFormatJSONObjectTypedDict(TypedDict):
805
+ r"""
808
806
 
809
- cache_control: Optional[CreatePromptMessagesCacheControl] = None
807
+ JSON object response format. An older method of generating JSON responses. Using `json_schema` is recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.
808
+ """
810
809
 
811
- @model_serializer(mode="wrap")
812
- def serialize_model(self, handler):
813
- optional_fields = ["cache_control"]
814
- nullable_fields = ["tool_call_id"]
815
- null_default_fields = []
810
+ type: CreatePromptResponseFormatPromptsType
816
811
 
817
- serialized = handler(self)
818
812
 
819
- m = {}
813
+ class CreatePromptResponseFormatJSONObject(BaseModel):
814
+ r"""
820
815
 
821
- for n, f in type(self).model_fields.items():
822
- k = f.alias or n
823
- val = serialized.get(k)
824
- serialized.pop(k, None)
816
+ JSON object response format. An older method of generating JSON responses. Using `json_schema` is recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.
817
+ """
825
818
 
826
- optional_nullable = k in optional_fields and k in nullable_fields
827
- is_set = (
828
- self.__pydantic_fields_set__.intersection({n})
829
- or k in null_default_fields
830
- ) # pylint: disable=no-member
819
+ type: CreatePromptResponseFormatPromptsType
831
820
 
832
- if val is not None and val != UNSET_SENTINEL:
833
- m[k] = val
834
- elif val != UNSET_SENTINEL and (
835
- not k in optional_fields or (optional_nullable and is_set)
836
- ):
837
- m[k] = val
838
821
 
839
- return m
822
+ CreatePromptResponseFormatType = Literal["text",]
840
823
 
841
824
 
842
- CreatePromptContentPromptsRequest2TypedDict = TypeAliasType(
843
- "CreatePromptContentPromptsRequest2TypedDict",
844
- Union[
845
- RefusalPartSchemaTypedDict,
846
- RedactedReasoningPartSchemaTypedDict,
847
- TextContentPartSchemaTypedDict,
848
- ReasoningPartSchemaTypedDict,
849
- ],
850
- )
825
+ class CreatePromptResponseFormatTextTypedDict(TypedDict):
826
+ r"""
851
827
 
828
+ Default response format. Used to generate text responses
829
+ """
852
830
 
853
- CreatePromptContentPromptsRequest2 = Annotated[
854
- Union[
855
- Annotated[TextContentPartSchema, Tag("text")],
856
- Annotated[RefusalPartSchema, Tag("refusal")],
857
- Annotated[ReasoningPartSchema, Tag("reasoning")],
858
- Annotated[RedactedReasoningPartSchema, Tag("redacted_reasoning")],
859
- ],
860
- Discriminator(lambda m: get_discriminator(m, "type", "type")),
861
- ]
831
+ type: CreatePromptResponseFormatType
862
832
 
863
833
 
864
- CreatePromptMessagesPromptsRequestContentTypedDict = TypeAliasType(
865
- "CreatePromptMessagesPromptsRequestContentTypedDict",
866
- Union[str, List[CreatePromptContentPromptsRequest2TypedDict]],
867
- )
868
- r"""The contents of the assistant message. Required unless `tool_calls` or `function_call` is specified."""
834
+ class CreatePromptResponseFormatText(BaseModel):
835
+ r"""
836
+
837
+ Default response format. Used to generate text responses
838
+ """
869
839
 
840
+ type: CreatePromptResponseFormatType
870
841
 
871
- CreatePromptMessagesPromptsRequestContent = TypeAliasType(
872
- "CreatePromptMessagesPromptsRequestContent",
873
- Union[str, List[CreatePromptContentPromptsRequest2]],
842
+
843
+ CreatePromptResponseFormatTypedDict = TypeAliasType(
844
+ "CreatePromptResponseFormatTypedDict",
845
+ Union[
846
+ CreatePromptResponseFormatTextTypedDict,
847
+ CreatePromptResponseFormatJSONObjectTypedDict,
848
+ CreatePromptResponseFormatJSONSchemaTypedDict,
849
+ ],
874
850
  )
875
- r"""The contents of the assistant message. Required unless `tool_calls` or `function_call` is specified."""
851
+ r"""An object specifying the format that the model must output"""
876
852
 
877
853
 
878
- CreatePromptMessagesPromptsRequestRole = Literal["assistant",]
879
- r"""The role of the messages author, in this case `assistant`."""
854
+ CreatePromptResponseFormat = Annotated[
855
+ Union[
856
+ Annotated[CreatePromptResponseFormatText, Tag("text")],
857
+ Annotated[CreatePromptResponseFormatJSONObject, Tag("json_object")],
858
+ Annotated[CreatePromptResponseFormatJSONSchema, Tag("json_schema")],
859
+ ],
860
+ Discriminator(lambda m: get_discriminator(m, "type", "type")),
861
+ ]
862
+ r"""An object specifying the format that the model must output"""
880
863
 
881
864
 
882
- class CreatePromptMessagesAudioTypedDict(TypedDict):
883
- r"""Data about a previous audio response from the model."""
865
+ CreatePromptReasoningEffort = Literal[
866
+ "none",
867
+ "minimal",
868
+ "low",
869
+ "medium",
870
+ "high",
871
+ "xhigh",
872
+ ]
873
+ r"""Constrains effort on reasoning for [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.
884
874
 
885
- id: str
886
- r"""Unique identifier for a previous audio response from the model."""
875
+ - `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool calls are supported for all reasoning values in gpt-5.1.
876
+ - All models before `gpt-5.1` default to `medium` reasoning effort, and do not support `none`.
877
+ - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
878
+ - `xhigh` is currently only supported for `gpt-5.1-codex-max`.
887
879
 
880
+ Any of \"none\", \"minimal\", \"low\", \"medium\", \"high\", \"xhigh\".
881
+ """
888
882
 
889
- class CreatePromptMessagesAudio(BaseModel):
890
- r"""Data about a previous audio response from the model."""
891
883
 
892
- id: str
893
- r"""Unique identifier for a previous audio response from the model."""
884
+ CreatePromptStopTypedDict = TypeAliasType(
885
+ "CreatePromptStopTypedDict", Union[str, List[str]]
886
+ )
887
+ r"""Up to 4 sequences where the API will stop generating further tokens."""
894
888
 
895
889
 
896
- CreatePromptMessagesType = Literal["function",]
897
- r"""The type of the tool. Currently, only `function` is supported."""
890
+ CreatePromptStop = TypeAliasType("CreatePromptStop", Union[str, List[str]])
891
+ r"""Up to 4 sequences where the API will stop generating further tokens."""
898
892
 
899
893
 
900
- class CreatePromptMessagesFunctionTypedDict(TypedDict):
901
- name: NotRequired[str]
902
- r"""The name of the function to call."""
903
- arguments: NotRequired[str]
904
- r"""The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function."""
894
+ class CreatePromptStreamOptionsTypedDict(TypedDict):
895
+ r"""Options for streaming response. Only set this when you set stream: true."""
905
896
 
897
+ include_usage: NotRequired[bool]
898
+ r"""If set, an additional chunk will be streamed before the data: [DONE] message. The usage field on this chunk shows the token usage statistics for the entire request, and the choices field will always be an empty array. All other chunks will also include a usage field, but with a null value."""
906
899
 
907
- class CreatePromptMessagesFunction(BaseModel):
908
- name: Optional[str] = None
909
- r"""The name of the function to call."""
910
900
 
911
- arguments: Optional[str] = None
912
- r"""The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function."""
901
+ class CreatePromptStreamOptions(BaseModel):
902
+ r"""Options for streaming response. Only set this when you set stream: true."""
913
903
 
904
+ include_usage: Optional[bool] = None
905
+ r"""If set, an additional chunk will be streamed before the data: [DONE] message. The usage field on this chunk shows the token usage statistics for the entire request, and the choices field will always be an empty array. All other chunks will also include a usage field, but with a null value."""
914
906
 
915
- class CreatePromptMessagesToolCallsTypedDict(TypedDict):
916
- id: str
917
- r"""The ID of the tool call."""
918
- type: CreatePromptMessagesType
919
- r"""The type of the tool. Currently, only `function` is supported."""
920
- function: CreatePromptMessagesFunctionTypedDict
921
- thought_signature: NotRequired[str]
922
- r"""Encrypted representation of the model internal reasoning state during function calling. Required by Gemini 3 models when continuing a conversation after a tool call."""
907
+ @model_serializer(mode="wrap")
908
+ def serialize_model(self, handler):
909
+ optional_fields = set(["include_usage"])
910
+ serialized = handler(self)
911
+ m = {}
923
912
 
913
+ for n, f in type(self).model_fields.items():
914
+ k = f.alias or n
915
+ val = serialized.get(k)
924
916
 
925
- class CreatePromptMessagesToolCalls(BaseModel):
926
- id: str
927
- r"""The ID of the tool call."""
917
+ if val != UNSET_SENTINEL:
918
+ if val is not None or k not in optional_fields:
919
+ m[k] = val
928
920
 
929
- type: CreatePromptMessagesType
930
- r"""The type of the tool. Currently, only `function` is supported."""
921
+ return m
931
922
 
932
- function: CreatePromptMessagesFunction
933
923
 
934
- thought_signature: Optional[str] = None
935
- r"""Encrypted representation of the model internal reasoning state during function calling. Required by Gemini 3 models when continuing a conversation after a tool call."""
924
+ CreatePromptThinkingTypedDict = TypeAliasType(
925
+ "CreatePromptThinkingTypedDict",
926
+ Union[ThinkingConfigDisabledSchemaTypedDict, ThinkingConfigEnabledSchemaTypedDict],
927
+ )
936
928
 
937
929
 
938
- class CreatePromptMessagesAssistantMessageTypedDict(TypedDict):
939
- role: CreatePromptMessagesPromptsRequestRole
940
- r"""The role of the messages author, in this case `assistant`."""
941
- content: NotRequired[Nullable[CreatePromptMessagesPromptsRequestContentTypedDict]]
942
- r"""The contents of the assistant message. Required unless `tool_calls` or `function_call` is specified."""
943
- refusal: NotRequired[Nullable[str]]
944
- r"""The refusal message by the assistant."""
945
- name: NotRequired[str]
946
- r"""An optional name for the participant. Provides the model information to differentiate between participants of the same role."""
947
- audio: NotRequired[Nullable[CreatePromptMessagesAudioTypedDict]]
948
- r"""Data about a previous audio response from the model."""
949
- tool_calls: NotRequired[List[CreatePromptMessagesToolCallsTypedDict]]
950
- r"""The tool calls generated by the model, such as function calls."""
930
+ CreatePromptThinking = Annotated[
931
+ Union[
932
+ Annotated[ThinkingConfigDisabledSchema, Tag("disabled")],
933
+ Annotated[ThinkingConfigEnabledSchema, Tag("enabled")],
934
+ ],
935
+ Discriminator(lambda m: get_discriminator(m, "type", "type")),
936
+ ]
951
937
 
952
938
 
953
- class CreatePromptMessagesAssistantMessage(BaseModel):
954
- role: CreatePromptMessagesPromptsRequestRole
955
- r"""The role of the messages author, in this case `assistant`."""
939
+ CreatePromptToolChoiceType = Literal["function",]
940
+ r"""The type of the tool. Currently, only function is supported."""
956
941
 
957
- content: OptionalNullable[CreatePromptMessagesPromptsRequestContent] = UNSET
958
- r"""The contents of the assistant message. Required unless `tool_calls` or `function_call` is specified."""
959
942
 
960
- refusal: OptionalNullable[str] = UNSET
961
- r"""The refusal message by the assistant."""
943
+ class CreatePromptToolChoiceFunctionTypedDict(TypedDict):
944
+ name: str
945
+ r"""The name of the function to call."""
962
946
 
963
- name: Optional[str] = None
964
- r"""An optional name for the participant. Provides the model information to differentiate between participants of the same role."""
965
947
 
966
- audio: OptionalNullable[CreatePromptMessagesAudio] = UNSET
967
- r"""Data about a previous audio response from the model."""
948
+ class CreatePromptToolChoiceFunction(BaseModel):
949
+ name: str
950
+ r"""The name of the function to call."""
968
951
 
969
- tool_calls: Optional[List[CreatePromptMessagesToolCalls]] = None
970
- r"""The tool calls generated by the model, such as function calls."""
952
+
953
+ class CreatePromptToolChoice2TypedDict(TypedDict):
954
+ function: CreatePromptToolChoiceFunctionTypedDict
955
+ type: NotRequired[CreatePromptToolChoiceType]
956
+ r"""The type of the tool. Currently, only function is supported."""
957
+
958
+
959
+ class CreatePromptToolChoice2(BaseModel):
960
+ function: CreatePromptToolChoiceFunction
961
+
962
+ type: Optional[CreatePromptToolChoiceType] = None
963
+ r"""The type of the tool. Currently, only function is supported."""
971
964
 
972
965
  @model_serializer(mode="wrap")
973
966
  def serialize_model(self, handler):
974
- optional_fields = ["content", "refusal", "name", "audio", "tool_calls"]
975
- nullable_fields = ["content", "refusal", "audio"]
976
- null_default_fields = []
977
-
967
+ optional_fields = set(["type"])
978
968
  serialized = handler(self)
979
-
980
969
  m = {}
981
970
 
982
971
  for n, f in type(self).model_fields.items():
983
972
  k = f.alias or n
984
973
  val = serialized.get(k)
985
- serialized.pop(k, None)
986
-
987
- optional_nullable = k in optional_fields and k in nullable_fields
988
- is_set = (
989
- self.__pydantic_fields_set__.intersection({n})
990
- or k in null_default_fields
991
- ) # pylint: disable=no-member
992
974
 
993
- if val is not None and val != UNSET_SENTINEL:
994
- m[k] = val
995
- elif val != UNSET_SENTINEL and (
996
- not k in optional_fields or (optional_nullable and is_set)
997
- ):
998
- m[k] = val
975
+ if val != UNSET_SENTINEL:
976
+ if val is not None or k not in optional_fields:
977
+ m[k] = val
999
978
 
1000
979
  return m
1001
980
 
1002
981
 
1003
- CreatePromptMessagesPromptsRole = Literal["user",]
1004
- r"""The role of the messages author, in this case `user`."""
982
+ CreatePromptToolChoice1 = Literal[
983
+ "none",
984
+ "auto",
985
+ "required",
986
+ ]
1005
987
 
1006
988
 
1007
- CreatePrompt2PromptsRequestRequestBodyType = Literal["file",]
1008
- r"""The type of the content part. Always `file`."""
989
+ CreatePromptToolChoiceTypedDict = TypeAliasType(
990
+ "CreatePromptToolChoiceTypedDict",
991
+ Union[CreatePromptToolChoice2TypedDict, CreatePromptToolChoice1],
992
+ )
993
+ r"""Controls which (if any) tool is called by the model."""
1009
994
 
1010
995
 
1011
- CreatePrompt2PromptsRequestRequestBodyPromptType = Literal["ephemeral",]
1012
- r"""Create a cache control breakpoint at this content block. Accepts only the value \"ephemeral\"."""
996
+ CreatePromptToolChoice = TypeAliasType(
997
+ "CreatePromptToolChoice", Union[CreatePromptToolChoice2, CreatePromptToolChoice1]
998
+ )
999
+ r"""Controls which (if any) tool is called by the model."""
1013
1000
 
1014
1001
 
1015
- CreatePrompt2TTL = Literal[
1016
- "5m",
1017
- "1h",
1002
+ CreatePromptModalities = Literal[
1003
+ "text",
1004
+ "audio",
1018
1005
  ]
1019
- r"""The time-to-live for the cache control breakpoint. This may be one of the following values:
1020
1006
 
1021
- - `5m`: 5 minutes
1022
- - `1h`: 1 hour
1023
1007
 
1024
- Defaults to `5m`. Only supported by `Anthropic` Claude models.
1025
- """
1008
+ CreatePromptID1 = Literal[
1009
+ "orq_pii_detection",
1010
+ "orq_sexual_moderation",
1011
+ "orq_harmful_moderation",
1012
+ ]
1013
+ r"""The key of the guardrail."""
1026
1014
 
1027
1015
 
1028
- class CreatePrompt2CacheControlTypedDict(TypedDict):
1029
- type: CreatePrompt2PromptsRequestRequestBodyPromptType
1030
- r"""Create a cache control breakpoint at this content block. Accepts only the value \"ephemeral\"."""
1031
- ttl: NotRequired[CreatePrompt2TTL]
1032
- r"""The time-to-live for the cache control breakpoint. This may be one of the following values:
1016
+ CreatePromptIDTypedDict = TypeAliasType(
1017
+ "CreatePromptIDTypedDict", Union[CreatePromptID1, str]
1018
+ )
1033
1019
 
1034
- - `5m`: 5 minutes
1035
- - `1h`: 1 hour
1036
1020
 
1037
- Defaults to `5m`. Only supported by `Anthropic` Claude models.
1038
- """
1021
+ CreatePromptID = TypeAliasType("CreatePromptID", Union[CreatePromptID1, str])
1039
1022
 
1040
1023
 
1041
- class CreatePrompt2CacheControl(BaseModel):
1042
- type: CreatePrompt2PromptsRequestRequestBodyPromptType
1043
- r"""Create a cache control breakpoint at this content block. Accepts only the value \"ephemeral\"."""
1024
+ CreatePromptExecuteOn = Literal[
1025
+ "input",
1026
+ "output",
1027
+ ]
1028
+ r"""Determines whether the guardrail runs on the input (user message) or output (model response)."""
1044
1029
 
1045
- ttl: Optional[CreatePrompt2TTL] = "5m"
1046
- r"""The time-to-live for the cache control breakpoint. This may be one of the following values:
1047
1030
 
1048
- - `5m`: 5 minutes
1049
- - `1h`: 1 hour
1031
+ class CreatePromptGuardrailsTypedDict(TypedDict):
1032
+ id: CreatePromptIDTypedDict
1033
+ execute_on: CreatePromptExecuteOn
1034
+ r"""Determines whether the guardrail runs on the input (user message) or output (model response)."""
1050
1035
 
1051
- Defaults to `5m`. Only supported by `Anthropic` Claude models.
1052
- """
1053
1036
 
1037
+ class CreatePromptGuardrails(BaseModel):
1038
+ id: CreatePromptID
1054
1039
 
1055
- class CreatePrompt24TypedDict(TypedDict):
1056
- type: CreatePrompt2PromptsRequestRequestBodyType
1057
- r"""The type of the content part. Always `file`."""
1058
- file: FileContentPartSchemaTypedDict
1059
- r"""File data for the content part. Must contain either file_data or uri, but not both."""
1060
- cache_control: NotRequired[CreatePrompt2CacheControlTypedDict]
1040
+ execute_on: CreatePromptExecuteOn
1041
+ r"""Determines whether the guardrail runs on the input (user message) or output (model response)."""
1061
1042
 
1062
1043
 
1063
- class CreatePrompt24(BaseModel):
1064
- type: CreatePrompt2PromptsRequestRequestBodyType
1065
- r"""The type of the content part. Always `file`."""
1044
+ class CreatePromptFallbacksTypedDict(TypedDict):
1045
+ model: str
1046
+ r"""Fallback model identifier"""
1066
1047
 
1067
- file: FileContentPartSchema
1068
- r"""File data for the content part. Must contain either file_data or uri, but not both."""
1069
1048
 
1070
- cache_control: Optional[CreatePrompt2CacheControl] = None
1049
+ class CreatePromptFallbacks(BaseModel):
1050
+ model: str
1051
+ r"""Fallback model identifier"""
1071
1052
 
1072
1053
 
1073
- CreatePromptContentPrompts2TypedDict = TypeAliasType(
1074
- "CreatePromptContentPrompts2TypedDict",
1075
- Union[
1076
- AudioContentPartSchemaTypedDict,
1077
- TextContentPartSchemaTypedDict,
1078
- ImageContentPartSchemaTypedDict,
1079
- CreatePrompt24TypedDict,
1080
- ],
1081
- )
1054
+ class CreatePromptRetryTypedDict(TypedDict):
1055
+ r"""Retry configuration for the request"""
1082
1056
 
1057
+ count: NotRequired[float]
1058
+ r"""Number of retry attempts (1-5)"""
1059
+ on_codes: NotRequired[List[float]]
1060
+ r"""HTTP status codes that trigger retry logic"""
1083
1061
 
1084
- CreatePromptContentPrompts2 = Annotated[
1085
- Union[
1086
- Annotated[TextContentPartSchema, Tag("text")],
1087
- Annotated[ImageContentPartSchema, Tag("image_url")],
1088
- Annotated[AudioContentPartSchema, Tag("input_audio")],
1089
- Annotated[CreatePrompt24, Tag("file")],
1090
- ],
1091
- Discriminator(lambda m: get_discriminator(m, "type", "type")),
1092
- ]
1093
1062
 
1063
+ class CreatePromptRetry(BaseModel):
1064
+ r"""Retry configuration for the request"""
1094
1065
 
1095
- CreatePromptMessagesPromptsContentTypedDict = TypeAliasType(
1096
- "CreatePromptMessagesPromptsContentTypedDict",
1097
- Union[str, List[CreatePromptContentPrompts2TypedDict]],
1098
- )
1099
- r"""The contents of the user message."""
1066
+ count: Optional[float] = 3
1067
+ r"""Number of retry attempts (1-5)"""
1100
1068
 
1069
+ on_codes: Optional[List[float]] = None
1070
+ r"""HTTP status codes that trigger retry logic"""
1101
1071
 
1102
- CreatePromptMessagesPromptsContent = TypeAliasType(
1103
- "CreatePromptMessagesPromptsContent", Union[str, List[CreatePromptContentPrompts2]]
1104
- )
1105
- r"""The contents of the user message."""
1072
+ @model_serializer(mode="wrap")
1073
+ def serialize_model(self, handler):
1074
+ optional_fields = set(["count", "on_codes"])
1075
+ serialized = handler(self)
1076
+ m = {}
1106
1077
 
1078
+ for n, f in type(self).model_fields.items():
1079
+ k = f.alias or n
1080
+ val = serialized.get(k)
1107
1081
 
1108
- class CreatePromptMessagesUserMessageTypedDict(TypedDict):
1109
- role: CreatePromptMessagesPromptsRole
1110
- r"""The role of the messages author, in this case `user`."""
1111
- content: CreatePromptMessagesPromptsContentTypedDict
1112
- r"""The contents of the user message."""
1113
- name: NotRequired[str]
1114
- r"""An optional name for the participant. Provides the model information to differentiate between participants of the same role."""
1082
+ if val != UNSET_SENTINEL:
1083
+ if val is not None or k not in optional_fields:
1084
+ m[k] = val
1115
1085
 
1086
+ return m
1116
1087
 
1117
- class CreatePromptMessagesUserMessage(BaseModel):
1118
- role: CreatePromptMessagesPromptsRole
1119
- r"""The role of the messages author, in this case `user`."""
1120
1088
 
1121
- content: CreatePromptMessagesPromptsContent
1122
- r"""The contents of the user message."""
1089
+ CreatePromptType = Literal["exact_match",]
1123
1090
 
1124
- name: Optional[str] = None
1125
- r"""An optional name for the participant. Provides the model information to differentiate between participants of the same role."""
1126
1091
 
1092
+ class CreatePromptCacheTypedDict(TypedDict):
1093
+ r"""Cache configuration for the request."""
1127
1094
 
1128
- CreatePromptMessagesRole = Literal["system",]
1129
- r"""The role of the messages author, in this case `system`."""
1095
+ type: CreatePromptType
1096
+ ttl: NotRequired[float]
1097
+ r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
1130
1098
 
1131
1099
 
1132
- CreatePromptMessagesContentTypedDict = TypeAliasType(
1133
- "CreatePromptMessagesContentTypedDict",
1134
- Union[str, List[TextContentPartSchemaTypedDict]],
1135
- )
1136
- r"""The contents of the system message."""
1100
+ class CreatePromptCache(BaseModel):
1101
+ r"""Cache configuration for the request."""
1137
1102
 
1103
+ type: CreatePromptType
1138
1104
 
1139
- CreatePromptMessagesContent = TypeAliasType(
1140
- "CreatePromptMessagesContent", Union[str, List[TextContentPartSchema]]
1141
- )
1142
- r"""The contents of the system message."""
1105
+ ttl: Optional[float] = 1800
1106
+ r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
1143
1107
 
1108
+ @model_serializer(mode="wrap")
1109
+ def serialize_model(self, handler):
1110
+ optional_fields = set(["ttl"])
1111
+ serialized = handler(self)
1112
+ m = {}
1144
1113
 
1145
- class CreatePromptMessagesSystemMessageTypedDict(TypedDict):
1146
- r"""Developer-provided instructions that the model should follow, regardless of messages sent by the user."""
1114
+ for n, f in type(self).model_fields.items():
1115
+ k = f.alias or n
1116
+ val = serialized.get(k)
1147
1117
 
1148
- role: CreatePromptMessagesRole
1149
- r"""The role of the messages author, in this case `system`."""
1150
- content: CreatePromptMessagesContentTypedDict
1151
- r"""The contents of the system message."""
1152
- name: NotRequired[str]
1153
- r"""An optional name for the participant. Provides the model information to differentiate between participants of the same role."""
1118
+ if val != UNSET_SENTINEL:
1119
+ if val is not None or k not in optional_fields:
1120
+ m[k] = val
1154
1121
 
1122
+ return m
1155
1123
 
1156
- class CreatePromptMessagesSystemMessage(BaseModel):
1157
- r"""Developer-provided instructions that the model should follow, regardless of messages sent by the user."""
1158
-
1159
- role: CreatePromptMessagesRole
1160
- r"""The role of the messages author, in this case `system`."""
1161
1124
 
1162
- content: CreatePromptMessagesContent
1163
- r"""The contents of the system message."""
1125
+ CreatePromptLoadBalancerType = Literal["weight_based",]
1164
1126
 
1165
- name: Optional[str] = None
1166
- r"""An optional name for the participant. Provides the model information to differentiate between participants of the same role."""
1167
1127
 
1128
+ class CreatePromptLoadBalancerModelsTypedDict(TypedDict):
1129
+ model: str
1130
+ r"""Model identifier for load balancing"""
1131
+ weight: NotRequired[float]
1132
+ r"""Weight assigned to this model for load balancing"""
1168
1133
 
1169
- CreatePromptPromptsMessagesTypedDict = TypeAliasType(
1170
- "CreatePromptPromptsMessagesTypedDict",
1171
- Union[
1172
- CreatePromptMessagesSystemMessageTypedDict,
1173
- CreatePromptMessagesUserMessageTypedDict,
1174
- CreatePromptMessagesToolMessageTypedDict,
1175
- CreatePromptMessagesAssistantMessageTypedDict,
1176
- ],
1177
- )
1178
1134
 
1135
+ class CreatePromptLoadBalancerModels(BaseModel):
1136
+ model: str
1137
+ r"""Model identifier for load balancing"""
1179
1138
 
1180
- CreatePromptPromptsMessages = Annotated[
1181
- Union[
1182
- Annotated[CreatePromptMessagesSystemMessage, Tag("system")],
1183
- Annotated[CreatePromptMessagesUserMessage, Tag("user")],
1184
- Annotated[CreatePromptMessagesAssistantMessage, Tag("assistant")],
1185
- Annotated[CreatePromptMessagesToolMessage, Tag("tool")],
1186
- ],
1187
- Discriminator(lambda m: get_discriminator(m, "role", "role")),
1188
- ]
1139
+ weight: Optional[float] = 0.5
1140
+ r"""Weight assigned to this model for load balancing"""
1189
1141
 
1142
+ @model_serializer(mode="wrap")
1143
+ def serialize_model(self, handler):
1144
+ optional_fields = set(["weight"])
1145
+ serialized = handler(self)
1146
+ m = {}
1190
1147
 
1191
- CreatePromptResponseFormatPromptsRequestRequestBodyPrompt3Type = Literal["json_schema",]
1148
+ for n, f in type(self).model_fields.items():
1149
+ k = f.alias or n
1150
+ val = serialized.get(k)
1192
1151
 
1152
+ if val != UNSET_SENTINEL:
1153
+ if val is not None or k not in optional_fields:
1154
+ m[k] = val
1193
1155
 
1194
- class CreatePromptResponseFormatPromptsRequestJSONSchemaTypedDict(TypedDict):
1195
- name: str
1196
- r"""The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64."""
1197
- description: NotRequired[str]
1198
- r"""A description of what the response format is for, used by the model to determine how to respond in the format."""
1199
- schema_: NotRequired[Any]
1200
- r"""The schema for the response format, described as a JSON Schema object."""
1201
- strict: NotRequired[bool]
1202
- r"""Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the schema field. Only a subset of JSON Schema is supported when strict is true."""
1156
+ return m
1203
1157
 
1204
1158
 
1205
- class CreatePromptResponseFormatPromptsRequestJSONSchema(BaseModel):
1206
- name: str
1207
- r"""The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64."""
1159
+ class CreatePromptLoadBalancer1TypedDict(TypedDict):
1160
+ type: CreatePromptLoadBalancerType
1161
+ models: List[CreatePromptLoadBalancerModelsTypedDict]
1208
1162
 
1209
- description: Optional[str] = None
1210
- r"""A description of what the response format is for, used by the model to determine how to respond in the format."""
1211
1163
 
1212
- schema_: Annotated[Optional[Any], pydantic.Field(alias="schema")] = None
1213
- r"""The schema for the response format, described as a JSON Schema object."""
1164
+ class CreatePromptLoadBalancer1(BaseModel):
1165
+ type: CreatePromptLoadBalancerType
1214
1166
 
1215
- strict: Optional[bool] = False
1216
- r"""Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the schema field. Only a subset of JSON Schema is supported when strict is true."""
1167
+ models: List[CreatePromptLoadBalancerModels]
1217
1168
 
1218
1169
 
1219
- class CreatePromptResponseFormatPromptsJSONSchemaTypedDict(TypedDict):
1220
- r"""
1170
+ CreatePromptLoadBalancerTypedDict = CreatePromptLoadBalancer1TypedDict
1171
+ r"""Load balancer configuration for the request."""
1221
1172
 
1222
- JSON Schema response format. Used to generate structured JSON responses
1223
- """
1224
1173
 
1225
- type: CreatePromptResponseFormatPromptsRequestRequestBodyPrompt3Type
1226
- json_schema: CreatePromptResponseFormatPromptsRequestJSONSchemaTypedDict
1174
+ CreatePromptLoadBalancer = CreatePromptLoadBalancer1
1175
+ r"""Load balancer configuration for the request."""
1227
1176
 
1228
1177
 
1229
- class CreatePromptResponseFormatPromptsJSONSchema(BaseModel):
1230
- r"""
1178
+ class CreatePromptTimeoutTypedDict(TypedDict):
1179
+ 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."""
1231
1180
 
1232
- JSON Schema response format. Used to generate structured JSON responses
1233
- """
1181
+ call_timeout: float
1182
+ r"""Timeout value in milliseconds"""
1234
1183
 
1235
- type: CreatePromptResponseFormatPromptsRequestRequestBodyPrompt3Type
1236
1184
 
1237
- json_schema: CreatePromptResponseFormatPromptsRequestJSONSchema
1185
+ class CreatePromptTimeout(BaseModel):
1186
+ 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."""
1238
1187
 
1188
+ call_timeout: float
1189
+ r"""Timeout value in milliseconds"""
1239
1190
 
1240
- CreatePromptResponseFormatPromptsRequestRequestBodyPromptType = Literal["json_object",]
1241
1191
 
1192
+ class PromptInputTypedDict(TypedDict):
1193
+ r"""Prompt configuration with model and messages."""
1242
1194
 
1243
- class CreatePromptResponseFormatJSONObjectTypedDict(TypedDict):
1244
- r"""
1195
+ messages: List[CreatePromptMessagesTypedDict]
1196
+ r"""Array of messages that make up the conversation. Each message has a role (system, user, assistant, or tool) and content."""
1197
+ model: NotRequired[str]
1198
+ r"""Model ID used to generate the response, like `openai/gpt-4o` or `anthropic/claude-3-5-sonnet-20241022`. For private models, use format: `{workspaceKey}@{provider}/{model}`. The full list of models can be found at https://docs.orq.ai/docs/ai-gateway-supported-models. Only chat models are supported."""
1199
+ audio: NotRequired[Nullable[CreatePromptAudioTypedDict]]
1200
+ r"""Parameters for audio output. Required when audio output is requested with modalities: [\"audio\"]. Learn more."""
1201
+ frequency_penalty: NotRequired[Nullable[float]]
1202
+ r"""Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim."""
1203
+ max_tokens: NotRequired[Nullable[int]]
1204
+ r"""`[Deprecated]`. The maximum number of tokens that can be generated in the chat completion. This value can be used to control costs for text generated via API.
1245
1205
 
1246
- JSON object response format. An older method of generating JSON responses. Using `json_schema` is recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.
1206
+ This value is now `deprecated` in favor of `max_completion_tokens`, and is not compatible with o1 series models.
1247
1207
  """
1208
+ max_completion_tokens: NotRequired[Nullable[int]]
1209
+ r"""An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning tokens"""
1210
+ logprobs: NotRequired[Nullable[bool]]
1211
+ r"""Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the content of message."""
1212
+ top_logprobs: NotRequired[Nullable[int]]
1213
+ r"""An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability. logprobs must be set to true if this parameter is used."""
1214
+ n: NotRequired[Nullable[int]]
1215
+ r"""How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep n as 1 to minimize costs."""
1216
+ presence_penalty: NotRequired[Nullable[float]]
1217
+ r"""Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics."""
1218
+ response_format: NotRequired[CreatePromptResponseFormatTypedDict]
1219
+ r"""An object specifying the format that the model must output"""
1220
+ reasoning_effort: NotRequired[CreatePromptReasoningEffort]
1221
+ r"""Constrains effort on reasoning for [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.
1248
1222
 
1249
- type: CreatePromptResponseFormatPromptsRequestRequestBodyPromptType
1223
+ - `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool calls are supported for all reasoning values in gpt-5.1.
1224
+ - All models before `gpt-5.1` default to `medium` reasoning effort, and do not support `none`.
1225
+ - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
1226
+ - `xhigh` is currently only supported for `gpt-5.1-codex-max`.
1250
1227
 
1228
+ Any of \"none\", \"minimal\", \"low\", \"medium\", \"high\", \"xhigh\".
1229
+ """
1230
+ verbosity: NotRequired[str]
1231
+ r"""Adjusts response verbosity. Lower levels yield shorter answers."""
1232
+ seed: NotRequired[Nullable[float]]
1233
+ r"""If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result."""
1234
+ stop: NotRequired[Nullable[CreatePromptStopTypedDict]]
1235
+ r"""Up to 4 sequences where the API will stop generating further tokens."""
1236
+ stream_options: NotRequired[Nullable[CreatePromptStreamOptionsTypedDict]]
1237
+ r"""Options for streaming response. Only set this when you set stream: true."""
1238
+ thinking: NotRequired[CreatePromptThinkingTypedDict]
1239
+ temperature: NotRequired[Nullable[float]]
1240
+ r"""What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic."""
1241
+ top_p: NotRequired[Nullable[float]]
1242
+ r"""An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass."""
1243
+ top_k: NotRequired[Nullable[float]]
1244
+ r"""Limits the model to consider only the top k most likely tokens at each step."""
1245
+ tool_choice: NotRequired[CreatePromptToolChoiceTypedDict]
1246
+ r"""Controls which (if any) tool is called by the model."""
1247
+ parallel_tool_calls: NotRequired[bool]
1248
+ r"""Whether to enable parallel function calling during tool use."""
1249
+ modalities: NotRequired[Nullable[List[CreatePromptModalities]]]
1250
+ r"""Output types that you would like the model to generate. Most models are capable of generating text, which is the default: [\"text\"]. The gpt-4o-audio-preview model can also be used to generate audio. To request that this model generate both text and audio responses, you can use: [\"text\", \"audio\"]."""
1251
+ guardrails: NotRequired[List[CreatePromptGuardrailsTypedDict]]
1252
+ r"""A list of guardrails to apply to the request."""
1253
+ fallbacks: NotRequired[List[CreatePromptFallbacksTypedDict]]
1254
+ r"""Array of fallback models to use if primary model fails"""
1255
+ retry: NotRequired[CreatePromptRetryTypedDict]
1256
+ r"""Retry configuration for the request"""
1257
+ cache: NotRequired[CreatePromptCacheTypedDict]
1258
+ r"""Cache configuration for the request."""
1259
+ load_balancer: NotRequired[CreatePromptLoadBalancerTypedDict]
1260
+ r"""Load balancer configuration for the request."""
1261
+ timeout: NotRequired[CreatePromptTimeoutTypedDict]
1262
+ 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."""
1251
1263
 
1252
- class CreatePromptResponseFormatJSONObject(BaseModel):
1253
- r"""
1254
1264
 
1255
- JSON object response format. An older method of generating JSON responses. Using `json_schema` is recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.
1256
- """
1265
+ class PromptInput(BaseModel):
1266
+ r"""Prompt configuration with model and messages."""
1257
1267
 
1258
- type: CreatePromptResponseFormatPromptsRequestRequestBodyPromptType
1268
+ messages: List[CreatePromptMessages]
1269
+ r"""Array of messages that make up the conversation. Each message has a role (system, user, assistant, or tool) and content."""
1259
1270
 
1271
+ model: Optional[str] = None
1272
+ r"""Model ID used to generate the response, like `openai/gpt-4o` or `anthropic/claude-3-5-sonnet-20241022`. For private models, use format: `{workspaceKey}@{provider}/{model}`. The full list of models can be found at https://docs.orq.ai/docs/ai-gateway-supported-models. Only chat models are supported."""
1260
1273
 
1261
- CreatePromptResponseFormatPromptsRequestRequestBodyType = Literal["text",]
1274
+ audio: OptionalNullable[CreatePromptAudio] = UNSET
1275
+ r"""Parameters for audio output. Required when audio output is requested with modalities: [\"audio\"]. Learn more."""
1262
1276
 
1277
+ frequency_penalty: OptionalNullable[float] = UNSET
1278
+ r"""Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim."""
1263
1279
 
1264
- class CreatePromptResponseFormatTextTypedDict(TypedDict):
1265
- r"""
1280
+ max_tokens: OptionalNullable[int] = UNSET
1281
+ r"""`[Deprecated]`. The maximum number of tokens that can be generated in the chat completion. This value can be used to control costs for text generated via API.
1266
1282
 
1267
- Default response format. Used to generate text responses
1283
+ This value is now `deprecated` in favor of `max_completion_tokens`, and is not compatible with o1 series models.
1268
1284
  """
1269
1285
 
1270
- type: CreatePromptResponseFormatPromptsRequestRequestBodyType
1286
+ max_completion_tokens: OptionalNullable[int] = UNSET
1287
+ r"""An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning tokens"""
1271
1288
 
1289
+ logprobs: OptionalNullable[bool] = UNSET
1290
+ r"""Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the content of message."""
1272
1291
 
1273
- class CreatePromptResponseFormatText(BaseModel):
1274
- r"""
1292
+ top_logprobs: OptionalNullable[int] = UNSET
1293
+ r"""An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability. logprobs must be set to true if this parameter is used."""
1275
1294
 
1276
- Default response format. Used to generate text responses
1277
- """
1295
+ n: OptionalNullable[int] = UNSET
1296
+ r"""How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep n as 1 to minimize costs."""
1278
1297
 
1279
- type: CreatePromptResponseFormatPromptsRequestRequestBodyType
1298
+ presence_penalty: OptionalNullable[float] = UNSET
1299
+ r"""Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics."""
1280
1300
 
1301
+ response_format: Optional[CreatePromptResponseFormat] = None
1302
+ r"""An object specifying the format that the model must output"""
1281
1303
 
1282
- CreatePromptPromptsResponseFormatTypedDict = TypeAliasType(
1283
- "CreatePromptPromptsResponseFormatTypedDict",
1284
- Union[
1285
- CreatePromptResponseFormatTextTypedDict,
1286
- CreatePromptResponseFormatJSONObjectTypedDict,
1287
- CreatePromptResponseFormatPromptsJSONSchemaTypedDict,
1288
- ],
1289
- )
1290
- r"""An object specifying the format that the model must output"""
1304
+ reasoning_effort: Optional[CreatePromptReasoningEffort] = None
1305
+ r"""Constrains effort on reasoning for [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.
1291
1306
 
1307
+ - `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool calls are supported for all reasoning values in gpt-5.1.
1308
+ - All models before `gpt-5.1` default to `medium` reasoning effort, and do not support `none`.
1309
+ - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
1310
+ - `xhigh` is currently only supported for `gpt-5.1-codex-max`.
1292
1311
 
1293
- CreatePromptPromptsResponseFormat = Annotated[
1294
- Union[
1295
- Annotated[CreatePromptResponseFormatText, Tag("text")],
1296
- Annotated[CreatePromptResponseFormatJSONObject, Tag("json_object")],
1297
- Annotated[CreatePromptResponseFormatPromptsJSONSchema, Tag("json_schema")],
1298
- ],
1299
- Discriminator(lambda m: get_discriminator(m, "type", "type")),
1300
- ]
1301
- r"""An object specifying the format that the model must output"""
1312
+ Any of \"none\", \"minimal\", \"low\", \"medium\", \"high\", \"xhigh\".
1313
+ """
1302
1314
 
1315
+ verbosity: Optional[str] = None
1316
+ r"""Adjusts response verbosity. Lower levels yield shorter answers."""
1303
1317
 
1304
- class PromptInputTypedDict(TypedDict):
1305
- r"""Prompt configuration with model and messages. Either this field or `prompt_config` must be provided."""
1318
+ seed: OptionalNullable[float] = UNSET
1319
+ r"""If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result."""
1306
1320
 
1307
- messages: List[CreatePromptPromptsMessagesTypedDict]
1308
- r"""Array of messages that make up the conversation. Each message has a role (system, user, assistant, or tool) and content."""
1309
- model: NotRequired[str]
1310
- r"""Model ID used to generate the response, like `openai/gpt-4o` or `anthropic/claude-3-5-sonnet-20241022`. The full list of models can be found at https://docs.orq.ai/docs/ai-gateway-supported-models. Only chat models are supported."""
1311
- temperature: NotRequired[Nullable[float]]
1321
+ stop: OptionalNullable[CreatePromptStop] = UNSET
1322
+ r"""Up to 4 sequences where the API will stop generating further tokens."""
1323
+
1324
+ stream_options: OptionalNullable[CreatePromptStreamOptions] = UNSET
1325
+ r"""Options for streaming response. Only set this when you set stream: true."""
1326
+
1327
+ thinking: Optional[CreatePromptThinking] = None
1328
+
1329
+ temperature: OptionalNullable[float] = UNSET
1312
1330
  r"""What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic."""
1313
- max_tokens: NotRequired[Nullable[int]]
1314
- r"""`[Deprecated]`. The maximum number of tokens that can be generated in the chat completion. This value can be used to control costs for text generated via API.
1315
1331
 
1316
- This value is now `deprecated` in favor of `max_completion_tokens`, and is not compatible with o1 series models.
1317
- """
1318
- response_format: NotRequired[CreatePromptPromptsResponseFormatTypedDict]
1319
- r"""An object specifying the format that the model must output"""
1332
+ top_p: OptionalNullable[float] = UNSET
1333
+ r"""An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass."""
1320
1334
 
1335
+ top_k: OptionalNullable[float] = UNSET
1336
+ r"""Limits the model to consider only the top k most likely tokens at each step."""
1321
1337
 
1322
- class PromptInput(BaseModel):
1323
- r"""Prompt configuration with model and messages. Either this field or `prompt_config` must be provided."""
1338
+ tool_choice: Optional[CreatePromptToolChoice] = None
1339
+ r"""Controls which (if any) tool is called by the model."""
1324
1340
 
1325
- messages: List[CreatePromptPromptsMessages]
1326
- r"""Array of messages that make up the conversation. Each message has a role (system, user, assistant, or tool) and content."""
1341
+ parallel_tool_calls: Optional[bool] = None
1342
+ r"""Whether to enable parallel function calling during tool use."""
1327
1343
 
1328
- model: Optional[str] = None
1329
- r"""Model ID used to generate the response, like `openai/gpt-4o` or `anthropic/claude-3-5-sonnet-20241022`. The full list of models can be found at https://docs.orq.ai/docs/ai-gateway-supported-models. Only chat models are supported."""
1344
+ modalities: OptionalNullable[List[CreatePromptModalities]] = UNSET
1345
+ r"""Output types that you would like the model to generate. Most models are capable of generating text, which is the default: [\"text\"]. The gpt-4o-audio-preview model can also be used to generate audio. To request that this model generate both text and audio responses, you can use: [\"text\", \"audio\"]."""
1330
1346
 
1331
- temperature: OptionalNullable[float] = UNSET
1332
- r"""What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic."""
1347
+ guardrails: Optional[List[CreatePromptGuardrails]] = None
1348
+ r"""A list of guardrails to apply to the request."""
1333
1349
 
1334
- max_tokens: OptionalNullable[int] = UNSET
1335
- r"""`[Deprecated]`. The maximum number of tokens that can be generated in the chat completion. This value can be used to control costs for text generated via API.
1350
+ fallbacks: Optional[List[CreatePromptFallbacks]] = None
1351
+ r"""Array of fallback models to use if primary model fails"""
1336
1352
 
1337
- This value is now `deprecated` in favor of `max_completion_tokens`, and is not compatible with o1 series models.
1338
- """
1353
+ retry: Optional[CreatePromptRetry] = None
1354
+ r"""Retry configuration for the request"""
1339
1355
 
1340
- response_format: Optional[CreatePromptPromptsResponseFormat] = None
1341
- r"""An object specifying the format that the model must output"""
1356
+ cache: Optional[CreatePromptCache] = None
1357
+ r"""Cache configuration for the request."""
1358
+
1359
+ load_balancer: Optional[CreatePromptLoadBalancer] = None
1360
+ r"""Load balancer configuration for the request."""
1361
+
1362
+ timeout: Optional[CreatePromptTimeout] = None
1363
+ 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."""
1342
1364
 
1343
1365
  @model_serializer(mode="wrap")
1344
1366
  def serialize_model(self, handler):
1345
- optional_fields = ["model", "temperature", "max_tokens", "response_format"]
1346
- nullable_fields = ["temperature", "max_tokens"]
1347
- null_default_fields = []
1348
-
1367
+ optional_fields = set(
1368
+ [
1369
+ "model",
1370
+ "audio",
1371
+ "frequency_penalty",
1372
+ "max_tokens",
1373
+ "max_completion_tokens",
1374
+ "logprobs",
1375
+ "top_logprobs",
1376
+ "n",
1377
+ "presence_penalty",
1378
+ "response_format",
1379
+ "reasoning_effort",
1380
+ "verbosity",
1381
+ "seed",
1382
+ "stop",
1383
+ "stream_options",
1384
+ "thinking",
1385
+ "temperature",
1386
+ "top_p",
1387
+ "top_k",
1388
+ "tool_choice",
1389
+ "parallel_tool_calls",
1390
+ "modalities",
1391
+ "guardrails",
1392
+ "fallbacks",
1393
+ "retry",
1394
+ "cache",
1395
+ "load_balancer",
1396
+ "timeout",
1397
+ ]
1398
+ )
1399
+ nullable_fields = set(
1400
+ [
1401
+ "audio",
1402
+ "frequency_penalty",
1403
+ "max_tokens",
1404
+ "max_completion_tokens",
1405
+ "logprobs",
1406
+ "top_logprobs",
1407
+ "n",
1408
+ "presence_penalty",
1409
+ "seed",
1410
+ "stop",
1411
+ "stream_options",
1412
+ "temperature",
1413
+ "top_p",
1414
+ "top_k",
1415
+ "modalities",
1416
+ ]
1417
+ )
1349
1418
  serialized = handler(self)
1350
-
1351
1419
  m = {}
1352
1420
 
1353
1421
  for n, f in type(self).model_fields.items():
1354
1422
  k = f.alias or n
1355
1423
  val = serialized.get(k)
1356
- serialized.pop(k, None)
1357
-
1358
- optional_nullable = k in optional_fields and k in nullable_fields
1359
- is_set = (
1360
- self.__pydantic_fields_set__.intersection({n})
1361
- or k in null_default_fields
1362
- ) # pylint: disable=no-member
1363
-
1364
- if val is not None and val != UNSET_SENTINEL:
1365
- m[k] = val
1366
- elif val != UNSET_SENTINEL and (
1367
- not k in optional_fields or (optional_nullable and is_set)
1368
- ):
1369
- m[k] = val
1424
+ is_nullable_and_explicitly_set = (
1425
+ k in nullable_fields
1426
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
1427
+ )
1428
+
1429
+ if val != UNSET_SENTINEL:
1430
+ if (
1431
+ val is not None
1432
+ or k not in optional_fields
1433
+ or is_nullable_and_explicitly_set
1434
+ ):
1435
+ m[k] = val
1370
1436
 
1371
1437
  return m
1372
1438
 
@@ -1384,10 +1450,8 @@ class CreatePromptRequestBodyTypedDict(TypedDict):
1384
1450
  description: NotRequired[Nullable[str]]
1385
1451
  r"""The prompt’s description, meant to be displayable in the UI. Use this field to optionally store a long form explanation of the prompt for your own purpose"""
1386
1452
  metadata: NotRequired[CreatePromptMetadataTypedDict]
1387
- prompt_config: NotRequired[PromptConfigurationTypedDict]
1388
- r"""[DEPRECATED]. Please use the `prompt` property instead. The current `prompt_config` will keep working but it will be deprecated in future versions. Configuration for the prompt including model and messages."""
1389
1453
  prompt: NotRequired[PromptInputTypedDict]
1390
- r"""Prompt configuration with model and messages. Either this field or `prompt_config` must be provided."""
1454
+ r"""Prompt configuration with model and messages."""
1391
1455
 
1392
1456
 
1393
1457
  class CreatePromptRequestBody(BaseModel):
@@ -1407,44 +1471,31 @@ class CreatePromptRequestBody(BaseModel):
1407
1471
 
1408
1472
  metadata: Optional[CreatePromptMetadata] = None
1409
1473
 
1410
- prompt_config: Annotated[
1411
- Optional[PromptConfiguration],
1412
- pydantic.Field(
1413
- deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
1414
- ),
1415
- ] = None
1416
- r"""[DEPRECATED]. Please use the `prompt` property instead. The current `prompt_config` will keep working but it will be deprecated in future versions. Configuration for the prompt including model and messages."""
1417
-
1418
1474
  prompt: Optional[PromptInput] = None
1419
- r"""Prompt configuration with model and messages. Either this field or `prompt_config` must be provided."""
1475
+ r"""Prompt configuration with model and messages."""
1420
1476
 
1421
1477
  @model_serializer(mode="wrap")
1422
1478
  def serialize_model(self, handler):
1423
- optional_fields = ["description", "metadata", "prompt_config", "prompt"]
1424
- nullable_fields = ["description"]
1425
- null_default_fields = []
1426
-
1479
+ optional_fields = set(["description", "metadata", "prompt"])
1480
+ nullable_fields = set(["description"])
1427
1481
  serialized = handler(self)
1428
-
1429
1482
  m = {}
1430
1483
 
1431
1484
  for n, f in type(self).model_fields.items():
1432
1485
  k = f.alias or n
1433
1486
  val = serialized.get(k)
1434
- serialized.pop(k, None)
1435
-
1436
- optional_nullable = k in optional_fields and k in nullable_fields
1437
- is_set = (
1438
- self.__pydantic_fields_set__.intersection({n})
1439
- or k in null_default_fields
1440
- ) # pylint: disable=no-member
1441
-
1442
- if val is not None and val != UNSET_SENTINEL:
1443
- m[k] = val
1444
- elif val != UNSET_SENTINEL and (
1445
- not k in optional_fields or (optional_nullable and is_set)
1446
- ):
1447
- m[k] = val
1487
+ is_nullable_and_explicitly_set = (
1488
+ k in nullable_fields
1489
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
1490
+ )
1491
+
1492
+ if val != UNSET_SENTINEL:
1493
+ if (
1494
+ val is not None
1495
+ or k not in optional_fields
1496
+ or is_nullable_and_explicitly_set
1497
+ ):
1498
+ m[k] = val
1448
1499
 
1449
1500
  return m
1450
1501
 
@@ -1452,7 +1503,7 @@ class CreatePromptRequestBody(BaseModel):
1452
1503
  CreatePromptPromptsType = Literal["prompt",]
1453
1504
 
1454
1505
 
1455
- CreatePromptModelType = Literal[
1506
+ ModelType = Literal[
1456
1507
  "chat",
1457
1508
  "completion",
1458
1509
  "embedding",
@@ -1460,6 +1511,7 @@ CreatePromptModelType = Literal[
1460
1511
  "tts",
1461
1512
  "stt",
1462
1513
  "rerank",
1514
+ "ocr",
1463
1515
  "moderation",
1464
1516
  "vision",
1465
1517
  ]
@@ -1500,39 +1552,47 @@ CreatePromptResponseFormat4 = Literal[
1500
1552
  ]
1501
1553
 
1502
1554
 
1503
- CreatePromptResponseFormatPromptsResponse200ApplicationJSONType = Literal["text",]
1555
+ CreatePromptResponseFormatPromptsResponse200ApplicationJSONResponseBodyPromptConfigModelParametersType = Literal[
1556
+ "text",
1557
+ ]
1504
1558
 
1505
1559
 
1506
1560
  class CreatePromptResponseFormat3TypedDict(TypedDict):
1507
- type: CreatePromptResponseFormatPromptsResponse200ApplicationJSONType
1561
+ type: CreatePromptResponseFormatPromptsResponse200ApplicationJSONResponseBodyPromptConfigModelParametersType
1508
1562
 
1509
1563
 
1510
1564
  class CreatePromptResponseFormat3(BaseModel):
1511
- type: CreatePromptResponseFormatPromptsResponse200ApplicationJSONType
1565
+ type: CreatePromptResponseFormatPromptsResponse200ApplicationJSONResponseBodyPromptConfigModelParametersType
1512
1566
 
1513
1567
 
1514
- CreatePromptResponseFormatPromptsResponse200Type = Literal["json_object",]
1568
+ CreatePromptResponseFormatPromptsResponse200ApplicationJSONResponseBodyPromptConfigType = Literal[
1569
+ "json_object",
1570
+ ]
1515
1571
 
1516
1572
 
1517
1573
  class CreatePromptResponseFormat2TypedDict(TypedDict):
1518
- type: CreatePromptResponseFormatPromptsResponse200Type
1574
+ type: CreatePromptResponseFormatPromptsResponse200ApplicationJSONResponseBodyPromptConfigType
1519
1575
 
1520
1576
 
1521
1577
  class CreatePromptResponseFormat2(BaseModel):
1522
- type: CreatePromptResponseFormatPromptsResponse200Type
1578
+ type: CreatePromptResponseFormatPromptsResponse200ApplicationJSONResponseBodyPromptConfigType
1523
1579
 
1524
1580
 
1525
- CreatePromptResponseFormatPromptsResponseType = Literal["json_schema",]
1581
+ CreatePromptResponseFormatPromptsResponse200ApplicationJSONResponseBodyType = Literal[
1582
+ "json_schema",
1583
+ ]
1526
1584
 
1527
1585
 
1528
- class CreatePromptResponseFormatPromptsResponseJSONSchemaTypedDict(TypedDict):
1586
+ class CreatePromptResponseFormatPromptsResponse200ApplicationJSONJSONSchemaTypedDict(
1587
+ TypedDict
1588
+ ):
1529
1589
  name: str
1530
1590
  schema_: Dict[str, Any]
1531
1591
  description: NotRequired[str]
1532
1592
  strict: NotRequired[bool]
1533
1593
 
1534
1594
 
1535
- class CreatePromptResponseFormatPromptsResponseJSONSchema(BaseModel):
1595
+ class CreatePromptResponseFormatPromptsResponse200ApplicationJSONJSONSchema(BaseModel):
1536
1596
  name: str
1537
1597
 
1538
1598
  schema_: Annotated[Dict[str, Any], pydantic.Field(alias="schema")]
@@ -1541,20 +1601,54 @@ class CreatePromptResponseFormatPromptsResponseJSONSchema(BaseModel):
1541
1601
 
1542
1602
  strict: Optional[bool] = None
1543
1603
 
1604
+ @model_serializer(mode="wrap")
1605
+ def serialize_model(self, handler):
1606
+ optional_fields = set(["description", "strict"])
1607
+ serialized = handler(self)
1608
+ m = {}
1609
+
1610
+ for n, f in type(self).model_fields.items():
1611
+ k = f.alias or n
1612
+ val = serialized.get(k)
1613
+
1614
+ if val != UNSET_SENTINEL:
1615
+ if val is not None or k not in optional_fields:
1616
+ m[k] = val
1617
+
1618
+ return m
1619
+
1544
1620
 
1545
1621
  class CreatePromptResponseFormat1TypedDict(TypedDict):
1546
- type: CreatePromptResponseFormatPromptsResponseType
1547
- json_schema: CreatePromptResponseFormatPromptsResponseJSONSchemaTypedDict
1622
+ type: CreatePromptResponseFormatPromptsResponse200ApplicationJSONResponseBodyType
1623
+ json_schema: (
1624
+ CreatePromptResponseFormatPromptsResponse200ApplicationJSONJSONSchemaTypedDict
1625
+ )
1548
1626
  display_name: NotRequired[str]
1549
1627
 
1550
1628
 
1551
1629
  class CreatePromptResponseFormat1(BaseModel):
1552
- type: CreatePromptResponseFormatPromptsResponseType
1630
+ type: CreatePromptResponseFormatPromptsResponse200ApplicationJSONResponseBodyType
1553
1631
 
1554
- json_schema: CreatePromptResponseFormatPromptsResponseJSONSchema
1632
+ json_schema: CreatePromptResponseFormatPromptsResponse200ApplicationJSONJSONSchema
1555
1633
 
1556
1634
  display_name: Optional[str] = None
1557
1635
 
1636
+ @model_serializer(mode="wrap")
1637
+ def serialize_model(self, handler):
1638
+ optional_fields = set(["display_name"])
1639
+ serialized = handler(self)
1640
+ m = {}
1641
+
1642
+ for n, f in type(self).model_fields.items():
1643
+ k = f.alias or n
1644
+ val = serialized.get(k)
1645
+
1646
+ if val != UNSET_SENTINEL:
1647
+ if val is not None or k not in optional_fields:
1648
+ m[k] = val
1649
+
1650
+ return m
1651
+
1558
1652
 
1559
1653
  CreatePromptPromptsResponseResponseFormatTypedDict = TypeAliasType(
1560
1654
  "CreatePromptPromptsResponseResponseFormatTypedDict",
@@ -1612,7 +1706,7 @@ CreatePromptEncodingFormat = Literal[
1612
1706
  r"""The format to return the embeddings"""
1613
1707
 
1614
1708
 
1615
- CreatePromptPromptsReasoningEffort = Literal[
1709
+ CreatePromptPromptsResponseReasoningEffort = Literal[
1616
1710
  "none",
1617
1711
  "disable",
1618
1712
  "minimal",
@@ -1631,14 +1725,14 @@ CreatePromptVerbosity = Literal[
1631
1725
  r"""Controls the verbosity of the model output."""
1632
1726
 
1633
1727
 
1634
- CreatePromptPromptsThinkingLevel = Literal[
1728
+ CreatePromptThinkingLevel = Literal[
1635
1729
  "low",
1636
1730
  "high",
1637
1731
  ]
1638
1732
  r"""The level of thinking to use for the model. Only supported by `Google AI`"""
1639
1733
 
1640
1734
 
1641
- class CreatePromptModelParametersTypedDict(TypedDict):
1735
+ class ModelParametersTypedDict(TypedDict):
1642
1736
  r"""Model Parameters: Not all parameters apply to every model"""
1643
1737
 
1644
1738
  temperature: NotRequired[float]
@@ -1680,17 +1774,17 @@ class CreatePromptModelParametersTypedDict(TypedDict):
1680
1774
  r"""The version of photoReal to use. Must be v1 or v2. Only available for `leonardoai` provider"""
1681
1775
  encoding_format: NotRequired[CreatePromptEncodingFormat]
1682
1776
  r"""The format to return the embeddings"""
1683
- reasoning_effort: NotRequired[CreatePromptPromptsReasoningEffort]
1777
+ reasoning_effort: NotRequired[CreatePromptPromptsResponseReasoningEffort]
1684
1778
  r"""Constrains effort on reasoning for reasoning models. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response."""
1685
1779
  budget_tokens: NotRequired[float]
1686
1780
  r"""Gives the model enhanced reasoning capabilities for complex tasks. A value of 0 disables thinking. The minimum budget tokens for thinking are 1024. The Budget Tokens should never exceed the Max Tokens parameter. Only supported by `Anthropic`"""
1687
1781
  verbosity: NotRequired[CreatePromptVerbosity]
1688
1782
  r"""Controls the verbosity of the model output."""
1689
- thinking_level: NotRequired[CreatePromptPromptsThinkingLevel]
1783
+ thinking_level: NotRequired[CreatePromptThinkingLevel]
1690
1784
  r"""The level of thinking to use for the model. Only supported by `Google AI`"""
1691
1785
 
1692
1786
 
1693
- class CreatePromptModelParameters(BaseModel):
1787
+ class ModelParameters(BaseModel):
1694
1788
  r"""Model Parameters: Not all parameters apply to every model"""
1695
1789
 
1696
1790
  temperature: Optional[float] = None
@@ -1757,7 +1851,7 @@ class CreatePromptModelParameters(BaseModel):
1757
1851
  r"""The format to return the embeddings"""
1758
1852
 
1759
1853
  reasoning_effort: Annotated[
1760
- Optional[CreatePromptPromptsReasoningEffort],
1854
+ Optional[CreatePromptPromptsResponseReasoningEffort],
1761
1855
  pydantic.Field(alias="reasoningEffort"),
1762
1856
  ] = None
1763
1857
  r"""Constrains effort on reasoning for reasoning models. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response."""
@@ -1767,403 +1861,1797 @@ class CreatePromptModelParameters(BaseModel):
1767
1861
  )
1768
1862
  r"""Gives the model enhanced reasoning capabilities for complex tasks. A value of 0 disables thinking. The minimum budget tokens for thinking are 1024. The Budget Tokens should never exceed the Max Tokens parameter. Only supported by `Anthropic`"""
1769
1863
 
1770
- verbosity: Optional[CreatePromptVerbosity] = None
1771
- r"""Controls the verbosity of the model output."""
1864
+ verbosity: Optional[CreatePromptVerbosity] = None
1865
+ r"""Controls the verbosity of the model output."""
1866
+
1867
+ thinking_level: Annotated[
1868
+ Optional[CreatePromptThinkingLevel], pydantic.Field(alias="thinkingLevel")
1869
+ ] = None
1870
+ r"""The level of thinking to use for the model. Only supported by `Google AI`"""
1871
+
1872
+ @model_serializer(mode="wrap")
1873
+ def serialize_model(self, handler):
1874
+ optional_fields = set(
1875
+ [
1876
+ "temperature",
1877
+ "maxTokens",
1878
+ "topK",
1879
+ "topP",
1880
+ "frequencyPenalty",
1881
+ "presencePenalty",
1882
+ "numImages",
1883
+ "seed",
1884
+ "format",
1885
+ "dimensions",
1886
+ "quality",
1887
+ "style",
1888
+ "responseFormat",
1889
+ "photoRealVersion",
1890
+ "encoding_format",
1891
+ "reasoningEffort",
1892
+ "budgetTokens",
1893
+ "verbosity",
1894
+ "thinkingLevel",
1895
+ ]
1896
+ )
1897
+ nullable_fields = set(["responseFormat"])
1898
+ serialized = handler(self)
1899
+ m = {}
1900
+
1901
+ for n, f in type(self).model_fields.items():
1902
+ k = f.alias or n
1903
+ val = serialized.get(k)
1904
+ is_nullable_and_explicitly_set = (
1905
+ k in nullable_fields
1906
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
1907
+ )
1908
+
1909
+ if val != UNSET_SENTINEL:
1910
+ if (
1911
+ val is not None
1912
+ or k not in optional_fields
1913
+ or is_nullable_and_explicitly_set
1914
+ ):
1915
+ m[k] = val
1916
+
1917
+ return m
1918
+
1919
+
1920
+ CreatePromptProvider = Literal[
1921
+ "openai",
1922
+ "groq",
1923
+ "cohere",
1924
+ "azure",
1925
+ "aws",
1926
+ "google",
1927
+ "google-ai",
1928
+ "huggingface",
1929
+ "togetherai",
1930
+ "perplexity",
1931
+ "anthropic",
1932
+ "leonardoai",
1933
+ "fal",
1934
+ "nvidia",
1935
+ "jina",
1936
+ "elevenlabs",
1937
+ "litellm",
1938
+ "cerebras",
1939
+ "openailike",
1940
+ "bytedance",
1941
+ "mistral",
1942
+ "deepseek",
1943
+ "contextualai",
1944
+ "moonshotai",
1945
+ "zai",
1946
+ "slack",
1947
+ ]
1948
+
1949
+
1950
+ CreatePromptRole = Literal[
1951
+ "system",
1952
+ "assistant",
1953
+ "user",
1954
+ "exception",
1955
+ "tool",
1956
+ "prompt",
1957
+ "correction",
1958
+ "expected_output",
1959
+ ]
1960
+ r"""The role of the prompt message"""
1961
+
1962
+
1963
+ CreatePrompt2PromptsResponse200ApplicationJSONType = Literal["file",]
1964
+ r"""The type of the content part. Always `file`."""
1965
+
1966
+
1967
+ class CreatePrompt2FileTypedDict(TypedDict):
1968
+ file_data: NotRequired[str]
1969
+ r"""The file data as a data URI string in the format 'data:<mime-type>;base64,<base64-encoded-data>'. Example: 'data:image/png;base64,iVBORw0KGgoAAAANS...'"""
1970
+ uri: NotRequired[str]
1971
+ r"""URL to the file. Only supported by Anthropic Claude models for PDF files."""
1972
+ mime_type: NotRequired[str]
1973
+ r"""MIME type of the file (e.g., application/pdf, image/png)"""
1974
+ filename: NotRequired[str]
1975
+ r"""The name of the file, used when passing the file to the model as a string."""
1976
+
1977
+
1978
+ class CreatePrompt2File(BaseModel):
1979
+ file_data: Optional[str] = None
1980
+ r"""The file data as a data URI string in the format 'data:<mime-type>;base64,<base64-encoded-data>'. Example: 'data:image/png;base64,iVBORw0KGgoAAAANS...'"""
1981
+
1982
+ uri: Optional[str] = None
1983
+ r"""URL to the file. Only supported by Anthropic Claude models for PDF files."""
1984
+
1985
+ mime_type: Annotated[Optional[str], pydantic.Field(alias="mimeType")] = None
1986
+ r"""MIME type of the file (e.g., application/pdf, image/png)"""
1987
+
1988
+ filename: Optional[str] = None
1989
+ r"""The name of the file, used when passing the file to the model as a string."""
1990
+
1991
+ @model_serializer(mode="wrap")
1992
+ def serialize_model(self, handler):
1993
+ optional_fields = set(["file_data", "uri", "mimeType", "filename"])
1994
+ serialized = handler(self)
1995
+ m = {}
1996
+
1997
+ for n, f in type(self).model_fields.items():
1998
+ k = f.alias or n
1999
+ val = serialized.get(k)
2000
+
2001
+ if val != UNSET_SENTINEL:
2002
+ if val is not None or k not in optional_fields:
2003
+ m[k] = val
2004
+
2005
+ return m
2006
+
2007
+
2008
+ class CreatePrompt23TypedDict(TypedDict):
2009
+ type: CreatePrompt2PromptsResponse200ApplicationJSONType
2010
+ r"""The type of the content part. Always `file`."""
2011
+ file: CreatePrompt2FileTypedDict
2012
+
2013
+
2014
+ class CreatePrompt23(BaseModel):
2015
+ type: CreatePrompt2PromptsResponse200ApplicationJSONType
2016
+ r"""The type of the content part. Always `file`."""
2017
+
2018
+ file: CreatePrompt2File
2019
+
2020
+
2021
+ CreatePrompt2PromptsResponse200Type = Literal["image_url",]
2022
+
2023
+
2024
+ class CreatePrompt2ImageURLTypedDict(TypedDict):
2025
+ url: str
2026
+ r"""Either a URL of the image or the base64 encoded data URI."""
2027
+ id: NotRequired[str]
2028
+ r"""The orq.ai id of the image"""
2029
+ detail: NotRequired[str]
2030
+ r"""Specifies the detail level of the image. Currently only supported with OpenAI models"""
2031
+
2032
+
2033
+ class CreatePrompt2ImageURL(BaseModel):
2034
+ url: str
2035
+ r"""Either a URL of the image or the base64 encoded data URI."""
2036
+
2037
+ id: Optional[str] = None
2038
+ r"""The orq.ai id of the image"""
2039
+
2040
+ detail: Optional[str] = None
2041
+ r"""Specifies the detail level of the image. Currently only supported with OpenAI models"""
2042
+
2043
+ @model_serializer(mode="wrap")
2044
+ def serialize_model(self, handler):
2045
+ optional_fields = set(["id", "detail"])
2046
+ serialized = handler(self)
2047
+ m = {}
2048
+
2049
+ for n, f in type(self).model_fields.items():
2050
+ k = f.alias or n
2051
+ val = serialized.get(k)
2052
+
2053
+ if val != UNSET_SENTINEL:
2054
+ if val is not None or k not in optional_fields:
2055
+ m[k] = val
2056
+
2057
+ return m
2058
+
2059
+
2060
+ class CreatePrompt22TypedDict(TypedDict):
2061
+ r"""The image part of the prompt message. Only supported with vision models."""
2062
+
2063
+ type: CreatePrompt2PromptsResponse200Type
2064
+ image_url: CreatePrompt2ImageURLTypedDict
2065
+
2066
+
2067
+ class CreatePrompt22(BaseModel):
2068
+ r"""The image part of the prompt message. Only supported with vision models."""
2069
+
2070
+ type: CreatePrompt2PromptsResponse200Type
2071
+
2072
+ image_url: CreatePrompt2ImageURL
2073
+
2074
+
2075
+ CreatePrompt2PromptsResponseType = Literal["text",]
2076
+
2077
+
2078
+ class CreatePrompt21TypedDict(TypedDict):
2079
+ r"""Text content part of a prompt message"""
2080
+
2081
+ type: CreatePrompt2PromptsResponseType
2082
+ text: str
2083
+
2084
+
2085
+ class CreatePrompt21(BaseModel):
2086
+ r"""Text content part of a prompt message"""
2087
+
2088
+ type: CreatePrompt2PromptsResponseType
2089
+
2090
+ text: str
2091
+
2092
+
2093
+ CreatePromptContentPromptsResponse2TypedDict = TypeAliasType(
2094
+ "CreatePromptContentPromptsResponse2TypedDict",
2095
+ Union[CreatePrompt21TypedDict, CreatePrompt22TypedDict, CreatePrompt23TypedDict],
2096
+ )
2097
+
2098
+
2099
+ CreatePromptContentPromptsResponse2 = Annotated[
2100
+ Union[
2101
+ Annotated[CreatePrompt21, Tag("text")],
2102
+ Annotated[CreatePrompt22, Tag("image_url")],
2103
+ Annotated[CreatePrompt23, Tag("file")],
2104
+ ],
2105
+ Discriminator(lambda m: get_discriminator(m, "type", "type")),
2106
+ ]
2107
+
2108
+
2109
+ CreatePromptContentTypedDict = TypeAliasType(
2110
+ "CreatePromptContentTypedDict",
2111
+ Union[str, List[CreatePromptContentPromptsResponse2TypedDict]],
2112
+ )
2113
+ r"""The contents of the user message. Either the text content of the message or an array of content parts with a defined type, each can be of type `text` or `image_url` when passing in images. You can pass multiple images by adding multiple `image_url` content parts. Can be null for tool messages in certain scenarios."""
2114
+
2115
+
2116
+ CreatePromptContent = TypeAliasType(
2117
+ "CreatePromptContent", Union[str, List[CreatePromptContentPromptsResponse2]]
2118
+ )
2119
+ r"""The contents of the user message. Either the text content of the message or an array of content parts with a defined type, each can be of type `text` or `image_url` when passing in images. You can pass multiple images by adding multiple `image_url` content parts. Can be null for tool messages in certain scenarios."""
2120
+
2121
+
2122
+ CreatePromptPromptsResponse200Type = Literal["function",]
2123
+
2124
+
2125
+ class CreatePromptFunctionTypedDict(TypedDict):
2126
+ name: str
2127
+ arguments: str
2128
+ r"""JSON string arguments for the functions"""
2129
+
2130
+
2131
+ class CreatePromptFunction(BaseModel):
2132
+ name: str
2133
+
2134
+ arguments: str
2135
+ r"""JSON string arguments for the functions"""
2136
+
2137
+
2138
+ class CreatePromptToolCallsTypedDict(TypedDict):
2139
+ type: CreatePromptPromptsResponse200Type
2140
+ function: CreatePromptFunctionTypedDict
2141
+ id: NotRequired[str]
2142
+ index: NotRequired[float]
2143
+
2144
+
2145
+ class CreatePromptToolCalls(BaseModel):
2146
+ type: CreatePromptPromptsResponse200Type
2147
+
2148
+ function: CreatePromptFunction
2149
+
2150
+ id: Optional[str] = None
2151
+
2152
+ index: Optional[float] = None
2153
+
2154
+ @model_serializer(mode="wrap")
2155
+ def serialize_model(self, handler):
2156
+ optional_fields = set(["id", "index"])
2157
+ serialized = handler(self)
2158
+ m = {}
2159
+
2160
+ for n, f in type(self).model_fields.items():
2161
+ k = f.alias or n
2162
+ val = serialized.get(k)
2163
+
2164
+ if val != UNSET_SENTINEL:
2165
+ if val is not None or k not in optional_fields:
2166
+ m[k] = val
2167
+
2168
+ return m
2169
+
2170
+
2171
+ class CreatePromptPromptsMessagesTypedDict(TypedDict):
2172
+ role: CreatePromptRole
2173
+ r"""The role of the prompt message"""
2174
+ content: Nullable[CreatePromptContentTypedDict]
2175
+ r"""The contents of the user message. Either the text content of the message or an array of content parts with a defined type, each can be of type `text` or `image_url` when passing in images. You can pass multiple images by adding multiple `image_url` content parts. Can be null for tool messages in certain scenarios."""
2176
+ tool_calls: NotRequired[List[CreatePromptToolCallsTypedDict]]
2177
+ tool_call_id: NotRequired[Nullable[str]]
2178
+
2179
+
2180
+ class CreatePromptPromptsMessages(BaseModel):
2181
+ role: CreatePromptRole
2182
+ r"""The role of the prompt message"""
2183
+
2184
+ content: Nullable[CreatePromptContent]
2185
+ r"""The contents of the user message. Either the text content of the message or an array of content parts with a defined type, each can be of type `text` or `image_url` when passing in images. You can pass multiple images by adding multiple `image_url` content parts. Can be null for tool messages in certain scenarios."""
2186
+
2187
+ tool_calls: Optional[List[CreatePromptToolCalls]] = None
2188
+
2189
+ tool_call_id: OptionalNullable[str] = UNSET
2190
+
2191
+ @model_serializer(mode="wrap")
2192
+ def serialize_model(self, handler):
2193
+ optional_fields = set(["tool_calls", "tool_call_id"])
2194
+ nullable_fields = set(["content", "tool_call_id"])
2195
+ serialized = handler(self)
2196
+ m = {}
2197
+
2198
+ for n, f in type(self).model_fields.items():
2199
+ k = f.alias or n
2200
+ val = serialized.get(k)
2201
+ is_nullable_and_explicitly_set = (
2202
+ k in nullable_fields
2203
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
2204
+ )
2205
+
2206
+ if val != UNSET_SENTINEL:
2207
+ if (
2208
+ val is not None
2209
+ or k not in optional_fields
2210
+ or is_nullable_and_explicitly_set
2211
+ ):
2212
+ m[k] = val
2213
+
2214
+ return m
2215
+
2216
+
2217
+ @deprecated(
2218
+ "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
2219
+ )
2220
+ class PromptConfigTypedDict(TypedDict):
2221
+ r"""[DEPRECATED] Use the `prompt` property instead. A list of messages compatible with the openAI schema."""
2222
+
2223
+ messages: List[CreatePromptPromptsMessagesTypedDict]
2224
+ stream: NotRequired[bool]
2225
+ model: NotRequired[Nullable[str]]
2226
+ model_db_id: NotRequired[Nullable[str]]
2227
+ r"""The id of the resource"""
2228
+ model_type: NotRequired[Nullable[ModelType]]
2229
+ r"""The modality of the model"""
2230
+ model_parameters: NotRequired[ModelParametersTypedDict]
2231
+ r"""Model Parameters: Not all parameters apply to every model"""
2232
+ provider: NotRequired[Nullable[CreatePromptProvider]]
2233
+ integration_id: NotRequired[Nullable[str]]
2234
+ r"""The ID of the integration to use"""
2235
+ version: NotRequired[str]
2236
+
2237
+
2238
+ @deprecated(
2239
+ "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
2240
+ )
2241
+ class PromptConfig(BaseModel):
2242
+ r"""[DEPRECATED] Use the `prompt` property instead. A list of messages compatible with the openAI schema."""
2243
+
2244
+ messages: List[CreatePromptPromptsMessages]
2245
+
2246
+ stream: Optional[bool] = None
2247
+
2248
+ model: OptionalNullable[str] = UNSET
2249
+
2250
+ model_db_id: OptionalNullable[str] = UNSET
2251
+ r"""The id of the resource"""
2252
+
2253
+ model_type: OptionalNullable[ModelType] = UNSET
2254
+ r"""The modality of the model"""
2255
+
2256
+ model_parameters: Optional[ModelParameters] = None
2257
+ r"""Model Parameters: Not all parameters apply to every model"""
2258
+
2259
+ provider: OptionalNullable[CreatePromptProvider] = UNSET
2260
+
2261
+ integration_id: OptionalNullable[str] = UNSET
2262
+ r"""The ID of the integration to use"""
2263
+
2264
+ version: Optional[str] = None
2265
+
2266
+ @model_serializer(mode="wrap")
2267
+ def serialize_model(self, handler):
2268
+ optional_fields = set(
2269
+ [
2270
+ "stream",
2271
+ "model",
2272
+ "model_db_id",
2273
+ "model_type",
2274
+ "model_parameters",
2275
+ "provider",
2276
+ "integration_id",
2277
+ "version",
2278
+ ]
2279
+ )
2280
+ nullable_fields = set(
2281
+ ["model", "model_db_id", "model_type", "provider", "integration_id"]
2282
+ )
2283
+ serialized = handler(self)
2284
+ m = {}
2285
+
2286
+ for n, f in type(self).model_fields.items():
2287
+ k = f.alias or n
2288
+ val = serialized.get(k)
2289
+ is_nullable_and_explicitly_set = (
2290
+ k in nullable_fields
2291
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
2292
+ )
2293
+
2294
+ if val != UNSET_SENTINEL:
2295
+ if (
2296
+ val is not None
2297
+ or k not in optional_fields
2298
+ or is_nullable_and_explicitly_set
2299
+ ):
2300
+ m[k] = val
2301
+
2302
+ return m
2303
+
2304
+
2305
+ CreatePromptPromptsVoice = Literal[
2306
+ "alloy",
2307
+ "echo",
2308
+ "fable",
2309
+ "onyx",
2310
+ "nova",
2311
+ "shimmer",
2312
+ ]
2313
+ r"""The voice the model uses to respond. Supported voices are alloy, echo, fable, onyx, nova, and shimmer."""
2314
+
2315
+
2316
+ CreatePromptPromptsResponse200Format = Literal[
2317
+ "wav",
2318
+ "mp3",
2319
+ "flac",
2320
+ "opus",
2321
+ "pcm16",
2322
+ ]
2323
+ r"""Specifies the output audio format. Must be one of wav, mp3, flac, opus, or pcm16."""
2324
+
2325
+
2326
+ class CreatePromptPromptsAudioTypedDict(TypedDict):
2327
+ r"""Parameters for audio output. Required when audio output is requested with modalities: [\"audio\"]. Learn more."""
2328
+
2329
+ voice: CreatePromptPromptsVoice
2330
+ r"""The voice the model uses to respond. Supported voices are alloy, echo, fable, onyx, nova, and shimmer."""
2331
+ format_: CreatePromptPromptsResponse200Format
2332
+ r"""Specifies the output audio format. Must be one of wav, mp3, flac, opus, or pcm16."""
2333
+
2334
+
2335
+ class CreatePromptPromptsAudio(BaseModel):
2336
+ r"""Parameters for audio output. Required when audio output is requested with modalities: [\"audio\"]. Learn more."""
2337
+
2338
+ voice: CreatePromptPromptsVoice
2339
+ r"""The voice the model uses to respond. Supported voices are alloy, echo, fable, onyx, nova, and shimmer."""
2340
+
2341
+ format_: Annotated[
2342
+ CreatePromptPromptsResponse200Format, pydantic.Field(alias="format")
2343
+ ]
2344
+ r"""Specifies the output audio format. Must be one of wav, mp3, flac, opus, or pcm16."""
2345
+
2346
+
2347
+ CreatePromptResponseFormatPromptsResponse200ApplicationJSONType = Literal[
2348
+ "json_schema",
2349
+ ]
2350
+
2351
+
2352
+ class CreatePromptResponseFormatPromptsResponseJSONSchemaTypedDict(TypedDict):
2353
+ name: str
2354
+ r"""The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64."""
2355
+ description: NotRequired[str]
2356
+ r"""A description of what the response format is for, used by the model to determine how to respond in the format."""
2357
+ schema_: NotRequired[Any]
2358
+ r"""The schema for the response format, described as a JSON Schema object."""
2359
+ strict: NotRequired[bool]
2360
+ r"""Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the schema field. Only a subset of JSON Schema is supported when strict is true."""
2361
+
2362
+
2363
+ class CreatePromptResponseFormatPromptsResponseJSONSchema(BaseModel):
2364
+ name: str
2365
+ r"""The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64."""
2366
+
2367
+ description: Optional[str] = None
2368
+ r"""A description of what the response format is for, used by the model to determine how to respond in the format."""
2369
+
2370
+ schema_: Annotated[Optional[Any], pydantic.Field(alias="schema")] = None
2371
+ r"""The schema for the response format, described as a JSON Schema object."""
2372
+
2373
+ strict: Optional[bool] = False
2374
+ r"""Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the schema field. Only a subset of JSON Schema is supported when strict is true."""
2375
+
2376
+ @model_serializer(mode="wrap")
2377
+ def serialize_model(self, handler):
2378
+ optional_fields = set(["description", "schema", "strict"])
2379
+ serialized = handler(self)
2380
+ m = {}
2381
+
2382
+ for n, f in type(self).model_fields.items():
2383
+ k = f.alias or n
2384
+ val = serialized.get(k)
2385
+
2386
+ if val != UNSET_SENTINEL:
2387
+ if val is not None or k not in optional_fields:
2388
+ m[k] = val
2389
+
2390
+ return m
2391
+
2392
+
2393
+ class CreatePromptResponseFormatPromptsResponse200JSONSchemaTypedDict(TypedDict):
2394
+ r"""
2395
+
2396
+ JSON Schema response format. Used to generate structured JSON responses
2397
+ """
2398
+
2399
+ type: CreatePromptResponseFormatPromptsResponse200ApplicationJSONType
2400
+ json_schema: CreatePromptResponseFormatPromptsResponseJSONSchemaTypedDict
2401
+
2402
+
2403
+ class CreatePromptResponseFormatPromptsResponse200JSONSchema(BaseModel):
2404
+ r"""
2405
+
2406
+ JSON Schema response format. Used to generate structured JSON responses
2407
+ """
2408
+
2409
+ type: CreatePromptResponseFormatPromptsResponse200ApplicationJSONType
2410
+
2411
+ json_schema: CreatePromptResponseFormatPromptsResponseJSONSchema
2412
+
2413
+
2414
+ CreatePromptResponseFormatPromptsResponse200Type = Literal["json_object",]
2415
+
2416
+
2417
+ class CreatePromptResponseFormatPromptsJSONObjectTypedDict(TypedDict):
2418
+ r"""
2419
+
2420
+ JSON object response format. An older method of generating JSON responses. Using `json_schema` is recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.
2421
+ """
2422
+
2423
+ type: CreatePromptResponseFormatPromptsResponse200Type
2424
+
2425
+
2426
+ class CreatePromptResponseFormatPromptsJSONObject(BaseModel):
2427
+ r"""
2428
+
2429
+ JSON object response format. An older method of generating JSON responses. Using `json_schema` is recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.
2430
+ """
2431
+
2432
+ type: CreatePromptResponseFormatPromptsResponse200Type
2433
+
2434
+
2435
+ CreatePromptResponseFormatPromptsResponseType = Literal["text",]
2436
+
2437
+
2438
+ class CreatePromptResponseFormatPromptsTextTypedDict(TypedDict):
2439
+ r"""
2440
+
2441
+ Default response format. Used to generate text responses
2442
+ """
2443
+
2444
+ type: CreatePromptResponseFormatPromptsResponseType
2445
+
2446
+
2447
+ class CreatePromptResponseFormatPromptsText(BaseModel):
2448
+ r"""
2449
+
2450
+ Default response format. Used to generate text responses
2451
+ """
2452
+
2453
+ type: CreatePromptResponseFormatPromptsResponseType
2454
+
2455
+
2456
+ CreatePromptPromptsResponseFormatTypedDict = TypeAliasType(
2457
+ "CreatePromptPromptsResponseFormatTypedDict",
2458
+ Union[
2459
+ CreatePromptResponseFormatPromptsTextTypedDict,
2460
+ CreatePromptResponseFormatPromptsJSONObjectTypedDict,
2461
+ CreatePromptResponseFormatPromptsResponse200JSONSchemaTypedDict,
2462
+ ],
2463
+ )
2464
+ r"""An object specifying the format that the model must output"""
2465
+
2466
+
2467
+ CreatePromptPromptsResponseFormat = Annotated[
2468
+ Union[
2469
+ Annotated[CreatePromptResponseFormatPromptsText, Tag("text")],
2470
+ Annotated[CreatePromptResponseFormatPromptsJSONObject, Tag("json_object")],
2471
+ Annotated[
2472
+ CreatePromptResponseFormatPromptsResponse200JSONSchema, Tag("json_schema")
2473
+ ],
2474
+ ],
2475
+ Discriminator(lambda m: get_discriminator(m, "type", "type")),
2476
+ ]
2477
+ r"""An object specifying the format that the model must output"""
2478
+
2479
+
2480
+ CreatePromptPromptsReasoningEffort = Literal[
2481
+ "none",
2482
+ "minimal",
2483
+ "low",
2484
+ "medium",
2485
+ "high",
2486
+ "xhigh",
2487
+ ]
2488
+ r"""Constrains effort on reasoning for [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.
2489
+
2490
+ - `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool calls are supported for all reasoning values in gpt-5.1.
2491
+ - All models before `gpt-5.1` default to `medium` reasoning effort, and do not support `none`.
2492
+ - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
2493
+ - `xhigh` is currently only supported for `gpt-5.1-codex-max`.
2494
+
2495
+ Any of \"none\", \"minimal\", \"low\", \"medium\", \"high\", \"xhigh\".
2496
+ """
2497
+
2498
+
2499
+ CreatePromptPromptsStopTypedDict = TypeAliasType(
2500
+ "CreatePromptPromptsStopTypedDict", Union[str, List[str]]
2501
+ )
2502
+ r"""Up to 4 sequences where the API will stop generating further tokens."""
2503
+
2504
+
2505
+ CreatePromptPromptsStop = TypeAliasType(
2506
+ "CreatePromptPromptsStop", Union[str, List[str]]
2507
+ )
2508
+ r"""Up to 4 sequences where the API will stop generating further tokens."""
2509
+
2510
+
2511
+ class CreatePromptPromptsStreamOptionsTypedDict(TypedDict):
2512
+ r"""Options for streaming response. Only set this when you set stream: true."""
2513
+
2514
+ include_usage: NotRequired[bool]
2515
+ r"""If set, an additional chunk will be streamed before the data: [DONE] message. The usage field on this chunk shows the token usage statistics for the entire request, and the choices field will always be an empty array. All other chunks will also include a usage field, but with a null value."""
2516
+
2517
+
2518
+ class CreatePromptPromptsStreamOptions(BaseModel):
2519
+ r"""Options for streaming response. Only set this when you set stream: true."""
2520
+
2521
+ include_usage: Optional[bool] = None
2522
+ r"""If set, an additional chunk will be streamed before the data: [DONE] message. The usage field on this chunk shows the token usage statistics for the entire request, and the choices field will always be an empty array. All other chunks will also include a usage field, but with a null value."""
2523
+
2524
+ @model_serializer(mode="wrap")
2525
+ def serialize_model(self, handler):
2526
+ optional_fields = set(["include_usage"])
2527
+ serialized = handler(self)
2528
+ m = {}
2529
+
2530
+ for n, f in type(self).model_fields.items():
2531
+ k = f.alias or n
2532
+ val = serialized.get(k)
2533
+
2534
+ if val != UNSET_SENTINEL:
2535
+ if val is not None or k not in optional_fields:
2536
+ m[k] = val
2537
+
2538
+ return m
2539
+
2540
+
2541
+ CreatePromptPromptsThinkingTypedDict = TypeAliasType(
2542
+ "CreatePromptPromptsThinkingTypedDict",
2543
+ Union[ThinkingConfigDisabledSchemaTypedDict, ThinkingConfigEnabledSchemaTypedDict],
2544
+ )
2545
+
2546
+
2547
+ CreatePromptPromptsThinking = Annotated[
2548
+ Union[
2549
+ Annotated[ThinkingConfigDisabledSchema, Tag("disabled")],
2550
+ Annotated[ThinkingConfigEnabledSchema, Tag("enabled")],
2551
+ ],
2552
+ Discriminator(lambda m: get_discriminator(m, "type", "type")),
2553
+ ]
2554
+
2555
+
2556
+ CreatePromptToolChoicePromptsType = Literal["function",]
2557
+ r"""The type of the tool. Currently, only function is supported."""
2558
+
2559
+
2560
+ class CreatePromptToolChoicePromptsFunctionTypedDict(TypedDict):
2561
+ name: str
2562
+ r"""The name of the function to call."""
2563
+
2564
+
2565
+ class CreatePromptToolChoicePromptsFunction(BaseModel):
2566
+ name: str
2567
+ r"""The name of the function to call."""
2568
+
2569
+
2570
+ class CreatePromptToolChoicePrompts2TypedDict(TypedDict):
2571
+ function: CreatePromptToolChoicePromptsFunctionTypedDict
2572
+ type: NotRequired[CreatePromptToolChoicePromptsType]
2573
+ r"""The type of the tool. Currently, only function is supported."""
2574
+
2575
+
2576
+ class CreatePromptToolChoicePrompts2(BaseModel):
2577
+ function: CreatePromptToolChoicePromptsFunction
2578
+
2579
+ type: Optional[CreatePromptToolChoicePromptsType] = None
2580
+ r"""The type of the tool. Currently, only function is supported."""
2581
+
2582
+ @model_serializer(mode="wrap")
2583
+ def serialize_model(self, handler):
2584
+ optional_fields = set(["type"])
2585
+ serialized = handler(self)
2586
+ m = {}
2587
+
2588
+ for n, f in type(self).model_fields.items():
2589
+ k = f.alias or n
2590
+ val = serialized.get(k)
2591
+
2592
+ if val != UNSET_SENTINEL:
2593
+ if val is not None or k not in optional_fields:
2594
+ m[k] = val
2595
+
2596
+ return m
2597
+
2598
+
2599
+ CreatePromptToolChoicePrompts1 = Literal[
2600
+ "none",
2601
+ "auto",
2602
+ "required",
2603
+ ]
2604
+
2605
+
2606
+ CreatePromptPromptsToolChoiceTypedDict = TypeAliasType(
2607
+ "CreatePromptPromptsToolChoiceTypedDict",
2608
+ Union[CreatePromptToolChoicePrompts2TypedDict, CreatePromptToolChoicePrompts1],
2609
+ )
2610
+ r"""Controls which (if any) tool is called by the model."""
2611
+
2612
+
2613
+ CreatePromptPromptsToolChoice = TypeAliasType(
2614
+ "CreatePromptPromptsToolChoice",
2615
+ Union[CreatePromptToolChoicePrompts2, CreatePromptToolChoicePrompts1],
2616
+ )
2617
+ r"""Controls which (if any) tool is called by the model."""
2618
+
2619
+
2620
+ CreatePromptPromptsModalities = Literal[
2621
+ "text",
2622
+ "audio",
2623
+ ]
2624
+
2625
+
2626
+ CreatePromptIDPrompts1 = Literal[
2627
+ "orq_pii_detection",
2628
+ "orq_sexual_moderation",
2629
+ "orq_harmful_moderation",
2630
+ ]
2631
+ r"""The key of the guardrail."""
2632
+
2633
+
2634
+ CreatePromptPromptsIDTypedDict = TypeAliasType(
2635
+ "CreatePromptPromptsIDTypedDict", Union[CreatePromptIDPrompts1, str]
2636
+ )
2637
+
2638
+
2639
+ CreatePromptPromptsID = TypeAliasType(
2640
+ "CreatePromptPromptsID", Union[CreatePromptIDPrompts1, str]
2641
+ )
2642
+
2643
+
2644
+ CreatePromptPromptsExecuteOn = Literal[
2645
+ "input",
2646
+ "output",
2647
+ ]
2648
+ r"""Determines whether the guardrail runs on the input (user message) or output (model response)."""
2649
+
2650
+
2651
+ class CreatePromptPromptsGuardrailsTypedDict(TypedDict):
2652
+ id: CreatePromptPromptsIDTypedDict
2653
+ execute_on: CreatePromptPromptsExecuteOn
2654
+ r"""Determines whether the guardrail runs on the input (user message) or output (model response)."""
2655
+
2656
+
2657
+ class CreatePromptPromptsGuardrails(BaseModel):
2658
+ id: CreatePromptPromptsID
2659
+
2660
+ execute_on: CreatePromptPromptsExecuteOn
2661
+ r"""Determines whether the guardrail runs on the input (user message) or output (model response)."""
2662
+
2663
+
2664
+ class CreatePromptPromptsFallbacksTypedDict(TypedDict):
2665
+ model: str
2666
+ r"""Fallback model identifier"""
2667
+
2668
+
2669
+ class CreatePromptPromptsFallbacks(BaseModel):
2670
+ model: str
2671
+ r"""Fallback model identifier"""
2672
+
2673
+
2674
+ class CreatePromptPromptsRetryTypedDict(TypedDict):
2675
+ r"""Retry configuration for the request"""
2676
+
2677
+ count: NotRequired[float]
2678
+ r"""Number of retry attempts (1-5)"""
2679
+ on_codes: NotRequired[List[float]]
2680
+ r"""HTTP status codes that trigger retry logic"""
2681
+
2682
+
2683
+ class CreatePromptPromptsRetry(BaseModel):
2684
+ r"""Retry configuration for the request"""
2685
+
2686
+ count: Optional[float] = 3
2687
+ r"""Number of retry attempts (1-5)"""
2688
+
2689
+ on_codes: Optional[List[float]] = None
2690
+ r"""HTTP status codes that trigger retry logic"""
2691
+
2692
+ @model_serializer(mode="wrap")
2693
+ def serialize_model(self, handler):
2694
+ optional_fields = set(["count", "on_codes"])
2695
+ serialized = handler(self)
2696
+ m = {}
2697
+
2698
+ for n, f in type(self).model_fields.items():
2699
+ k = f.alias or n
2700
+ val = serialized.get(k)
2701
+
2702
+ if val != UNSET_SENTINEL:
2703
+ if val is not None or k not in optional_fields:
2704
+ m[k] = val
2705
+
2706
+ return m
2707
+
2708
+
2709
+ CreatePromptPromptsResponseType = Literal["exact_match",]
2710
+
2711
+
2712
+ class CreatePromptPromptsCacheTypedDict(TypedDict):
2713
+ r"""Cache configuration for the request."""
2714
+
2715
+ type: CreatePromptPromptsResponseType
2716
+ ttl: NotRequired[float]
2717
+ r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
2718
+
2719
+
2720
+ class CreatePromptPromptsCache(BaseModel):
2721
+ r"""Cache configuration for the request."""
2722
+
2723
+ type: CreatePromptPromptsResponseType
2724
+
2725
+ ttl: Optional[float] = 1800
2726
+ r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
2727
+
2728
+ @model_serializer(mode="wrap")
2729
+ def serialize_model(self, handler):
2730
+ optional_fields = set(["ttl"])
2731
+ serialized = handler(self)
2732
+ m = {}
2733
+
2734
+ for n, f in type(self).model_fields.items():
2735
+ k = f.alias or n
2736
+ val = serialized.get(k)
2737
+
2738
+ if val != UNSET_SENTINEL:
2739
+ if val is not None or k not in optional_fields:
2740
+ m[k] = val
2741
+
2742
+ return m
2743
+
2744
+
2745
+ CreatePromptLoadBalancerPromptsType = Literal["weight_based",]
2746
+
2747
+
2748
+ class CreatePromptLoadBalancerPromptsModelsTypedDict(TypedDict):
2749
+ model: str
2750
+ r"""Model identifier for load balancing"""
2751
+ weight: NotRequired[float]
2752
+ r"""Weight assigned to this model for load balancing"""
2753
+
2754
+
2755
+ class CreatePromptLoadBalancerPromptsModels(BaseModel):
2756
+ model: str
2757
+ r"""Model identifier for load balancing"""
2758
+
2759
+ weight: Optional[float] = 0.5
2760
+ r"""Weight assigned to this model for load balancing"""
2761
+
2762
+ @model_serializer(mode="wrap")
2763
+ def serialize_model(self, handler):
2764
+ optional_fields = set(["weight"])
2765
+ serialized = handler(self)
2766
+ m = {}
2767
+
2768
+ for n, f in type(self).model_fields.items():
2769
+ k = f.alias or n
2770
+ val = serialized.get(k)
2771
+
2772
+ if val != UNSET_SENTINEL:
2773
+ if val is not None or k not in optional_fields:
2774
+ m[k] = val
2775
+
2776
+ return m
2777
+
2778
+
2779
+ class CreatePromptLoadBalancerPrompts1TypedDict(TypedDict):
2780
+ type: CreatePromptLoadBalancerPromptsType
2781
+ models: List[CreatePromptLoadBalancerPromptsModelsTypedDict]
2782
+
2783
+
2784
+ class CreatePromptLoadBalancerPrompts1(BaseModel):
2785
+ type: CreatePromptLoadBalancerPromptsType
2786
+
2787
+ models: List[CreatePromptLoadBalancerPromptsModels]
2788
+
2789
+
2790
+ CreatePromptPromptsLoadBalancerTypedDict = CreatePromptLoadBalancerPrompts1TypedDict
2791
+ r"""Load balancer configuration for the request."""
2792
+
2793
+
2794
+ CreatePromptPromptsLoadBalancer = CreatePromptLoadBalancerPrompts1
2795
+ r"""Load balancer configuration for the request."""
2796
+
2797
+
2798
+ class CreatePromptPromptsTimeoutTypedDict(TypedDict):
2799
+ 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."""
2800
+
2801
+ call_timeout: float
2802
+ r"""Timeout value in milliseconds"""
2803
+
2804
+
2805
+ class CreatePromptPromptsTimeout(BaseModel):
2806
+ 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."""
2807
+
2808
+ call_timeout: float
2809
+ r"""Timeout value in milliseconds"""
2810
+
2811
+
2812
+ CreatePromptMessagesPromptsResponse200ApplicationJSONResponseBodyRole = Literal["tool",]
2813
+ r"""The role of the messages author, in this case tool."""
2814
+
2815
+
2816
+ CreatePromptContentPromptsResponse200ApplicationJSONResponseBody2TypedDict = (
2817
+ TextContentPartSchemaTypedDict
2818
+ )
2819
+
2820
+
2821
+ CreatePromptContentPromptsResponse200ApplicationJSONResponseBody2 = (
2822
+ TextContentPartSchema
2823
+ )
2824
+
2825
+
2826
+ CreatePromptMessagesPromptsResponse200ApplicationJSONResponseBodyContentTypedDict = TypeAliasType(
2827
+ "CreatePromptMessagesPromptsResponse200ApplicationJSONResponseBodyContentTypedDict",
2828
+ Union[
2829
+ str,
2830
+ List[
2831
+ CreatePromptContentPromptsResponse200ApplicationJSONResponseBody2TypedDict
2832
+ ],
2833
+ ],
2834
+ )
2835
+ r"""The contents of the tool message."""
2836
+
2837
+
2838
+ CreatePromptMessagesPromptsResponse200ApplicationJSONResponseBodyContent = (
2839
+ TypeAliasType(
2840
+ "CreatePromptMessagesPromptsResponse200ApplicationJSONResponseBodyContent",
2841
+ Union[
2842
+ str, List[CreatePromptContentPromptsResponse200ApplicationJSONResponseBody2]
2843
+ ],
2844
+ )
2845
+ )
2846
+ r"""The contents of the tool message."""
2847
+
2848
+
2849
+ CreatePromptMessagesPromptsResponse200Type = Literal["ephemeral",]
2850
+ r"""Create a cache control breakpoint at this content block. Accepts only the value \"ephemeral\"."""
2851
+
2852
+
2853
+ CreatePromptMessagesPromptsTTL = Literal[
2854
+ "5m",
2855
+ "1h",
2856
+ ]
2857
+ r"""The time-to-live for the cache control breakpoint. This may be one of the following values:
2858
+
2859
+ - `5m`: 5 minutes
2860
+ - `1h`: 1 hour
2861
+
2862
+ Defaults to `5m`. Only supported by `Anthropic` Claude models.
2863
+ """
2864
+
2865
+
2866
+ class CreatePromptMessagesPromptsCacheControlTypedDict(TypedDict):
2867
+ type: CreatePromptMessagesPromptsResponse200Type
2868
+ r"""Create a cache control breakpoint at this content block. Accepts only the value \"ephemeral\"."""
2869
+ ttl: NotRequired[CreatePromptMessagesPromptsTTL]
2870
+ r"""The time-to-live for the cache control breakpoint. This may be one of the following values:
2871
+
2872
+ - `5m`: 5 minutes
2873
+ - `1h`: 1 hour
2874
+
2875
+ Defaults to `5m`. Only supported by `Anthropic` Claude models.
2876
+ """
2877
+
2878
+
2879
+ class CreatePromptMessagesPromptsCacheControl(BaseModel):
2880
+ type: CreatePromptMessagesPromptsResponse200Type
2881
+ r"""Create a cache control breakpoint at this content block. Accepts only the value \"ephemeral\"."""
2882
+
2883
+ ttl: Optional[CreatePromptMessagesPromptsTTL] = "5m"
2884
+ r"""The time-to-live for the cache control breakpoint. This may be one of the following values:
2885
+
2886
+ - `5m`: 5 minutes
2887
+ - `1h`: 1 hour
2888
+
2889
+ Defaults to `5m`. Only supported by `Anthropic` Claude models.
2890
+ """
2891
+
2892
+ @model_serializer(mode="wrap")
2893
+ def serialize_model(self, handler):
2894
+ optional_fields = set(["ttl"])
2895
+ serialized = handler(self)
2896
+ m = {}
2897
+
2898
+ for n, f in type(self).model_fields.items():
2899
+ k = f.alias or n
2900
+ val = serialized.get(k)
2901
+
2902
+ if val != UNSET_SENTINEL:
2903
+ if val is not None or k not in optional_fields:
2904
+ m[k] = val
2905
+
2906
+ return m
2907
+
2908
+
2909
+ class CreatePromptMessagesPromptsToolMessageTypedDict(TypedDict):
2910
+ role: CreatePromptMessagesPromptsResponse200ApplicationJSONResponseBodyRole
2911
+ r"""The role of the messages author, in this case tool."""
2912
+ content: CreatePromptMessagesPromptsResponse200ApplicationJSONResponseBodyContentTypedDict
2913
+ r"""The contents of the tool message."""
2914
+ tool_call_id: Nullable[str]
2915
+ r"""Tool call that this message is responding to."""
2916
+ cache_control: NotRequired[CreatePromptMessagesPromptsCacheControlTypedDict]
2917
+
2918
+
2919
+ class CreatePromptMessagesPromptsToolMessage(BaseModel):
2920
+ role: CreatePromptMessagesPromptsResponse200ApplicationJSONResponseBodyRole
2921
+ r"""The role of the messages author, in this case tool."""
2922
+
2923
+ content: CreatePromptMessagesPromptsResponse200ApplicationJSONResponseBodyContent
2924
+ r"""The contents of the tool message."""
2925
+
2926
+ tool_call_id: Nullable[str]
2927
+ r"""Tool call that this message is responding to."""
2928
+
2929
+ cache_control: Optional[CreatePromptMessagesPromptsCacheControl] = None
2930
+
2931
+ @model_serializer(mode="wrap")
2932
+ def serialize_model(self, handler):
2933
+ optional_fields = set(["cache_control"])
2934
+ nullable_fields = set(["tool_call_id"])
2935
+ serialized = handler(self)
2936
+ m = {}
2937
+
2938
+ for n, f in type(self).model_fields.items():
2939
+ k = f.alias or n
2940
+ val = serialized.get(k)
2941
+ is_nullable_and_explicitly_set = (
2942
+ k in nullable_fields
2943
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
2944
+ )
2945
+
2946
+ if val != UNSET_SENTINEL:
2947
+ if (
2948
+ val is not None
2949
+ or k not in optional_fields
2950
+ or is_nullable_and_explicitly_set
2951
+ ):
2952
+ m[k] = val
2953
+
2954
+ return m
2955
+
2956
+
2957
+ CreatePromptContentPromptsResponse200ApplicationJSON2TypedDict = TypeAliasType(
2958
+ "CreatePromptContentPromptsResponse200ApplicationJSON2TypedDict",
2959
+ Union[
2960
+ RefusalPartSchemaTypedDict,
2961
+ RedactedReasoningPartSchemaTypedDict,
2962
+ TextContentPartSchemaTypedDict,
2963
+ ReasoningPartSchemaTypedDict,
2964
+ ],
2965
+ )
2966
+
2967
+
2968
+ CreatePromptContentPromptsResponse200ApplicationJSON2 = Annotated[
2969
+ Union[
2970
+ Annotated[TextContentPartSchema, Tag("text")],
2971
+ Annotated[RefusalPartSchema, Tag("refusal")],
2972
+ Annotated[ReasoningPartSchema, Tag("reasoning")],
2973
+ Annotated[RedactedReasoningPartSchema, Tag("redacted_reasoning")],
2974
+ ],
2975
+ Discriminator(lambda m: get_discriminator(m, "type", "type")),
2976
+ ]
2977
+
2978
+
2979
+ CreatePromptMessagesPromptsResponse200ApplicationJSONContentTypedDict = TypeAliasType(
2980
+ "CreatePromptMessagesPromptsResponse200ApplicationJSONContentTypedDict",
2981
+ Union[str, List[CreatePromptContentPromptsResponse200ApplicationJSON2TypedDict]],
2982
+ )
2983
+ r"""The contents of the assistant message. Required unless `tool_calls` or `function_call` is specified."""
2984
+
2985
+
2986
+ CreatePromptMessagesPromptsResponse200ApplicationJSONContent = TypeAliasType(
2987
+ "CreatePromptMessagesPromptsResponse200ApplicationJSONContent",
2988
+ Union[str, List[CreatePromptContentPromptsResponse200ApplicationJSON2]],
2989
+ )
2990
+ r"""The contents of the assistant message. Required unless `tool_calls` or `function_call` is specified."""
2991
+
2992
+
2993
+ CreatePromptMessagesPromptsResponse200ApplicationJSONRole = Literal["assistant",]
2994
+ r"""The role of the messages author, in this case `assistant`."""
2995
+
2996
+
2997
+ class CreatePromptMessagesPromptsAudioTypedDict(TypedDict):
2998
+ r"""Data about a previous audio response from the model."""
2999
+
3000
+ id: str
3001
+ r"""Unique identifier for a previous audio response from the model."""
3002
+
3003
+
3004
+ class CreatePromptMessagesPromptsAudio(BaseModel):
3005
+ r"""Data about a previous audio response from the model."""
3006
+
3007
+ id: str
3008
+ r"""Unique identifier for a previous audio response from the model."""
3009
+
3010
+
3011
+ CreatePromptMessagesPromptsResponseType = Literal["function",]
3012
+ r"""The type of the tool. Currently, only `function` is supported."""
3013
+
3014
+
3015
+ class CreatePromptMessagesPromptsFunctionTypedDict(TypedDict):
3016
+ name: NotRequired[str]
3017
+ r"""The name of the function to call."""
3018
+ arguments: NotRequired[str]
3019
+ r"""The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function."""
3020
+
3021
+
3022
+ class CreatePromptMessagesPromptsFunction(BaseModel):
3023
+ name: Optional[str] = None
3024
+ r"""The name of the function to call."""
3025
+
3026
+ arguments: Optional[str] = None
3027
+ r"""The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function."""
3028
+
3029
+ @model_serializer(mode="wrap")
3030
+ def serialize_model(self, handler):
3031
+ optional_fields = set(["name", "arguments"])
3032
+ serialized = handler(self)
3033
+ m = {}
3034
+
3035
+ for n, f in type(self).model_fields.items():
3036
+ k = f.alias or n
3037
+ val = serialized.get(k)
3038
+
3039
+ if val != UNSET_SENTINEL:
3040
+ if val is not None or k not in optional_fields:
3041
+ m[k] = val
3042
+
3043
+ return m
3044
+
3045
+
3046
+ class CreatePromptMessagesPromptsToolCallsTypedDict(TypedDict):
3047
+ id: str
3048
+ r"""The ID of the tool call."""
3049
+ type: CreatePromptMessagesPromptsResponseType
3050
+ r"""The type of the tool. Currently, only `function` is supported."""
3051
+ function: CreatePromptMessagesPromptsFunctionTypedDict
3052
+ thought_signature: NotRequired[str]
3053
+ r"""Encrypted representation of the model internal reasoning state during function calling. Required by Gemini 3 models when continuing a conversation after a tool call."""
3054
+
3055
+
3056
+ class CreatePromptMessagesPromptsToolCalls(BaseModel):
3057
+ id: str
3058
+ r"""The ID of the tool call."""
3059
+
3060
+ type: CreatePromptMessagesPromptsResponseType
3061
+ r"""The type of the tool. Currently, only `function` is supported."""
3062
+
3063
+ function: CreatePromptMessagesPromptsFunction
3064
+
3065
+ thought_signature: Optional[str] = None
3066
+ r"""Encrypted representation of the model internal reasoning state during function calling. Required by Gemini 3 models when continuing a conversation after a tool call."""
3067
+
3068
+ @model_serializer(mode="wrap")
3069
+ def serialize_model(self, handler):
3070
+ optional_fields = set(["thought_signature"])
3071
+ serialized = handler(self)
3072
+ m = {}
3073
+
3074
+ for n, f in type(self).model_fields.items():
3075
+ k = f.alias or n
3076
+ val = serialized.get(k)
3077
+
3078
+ if val != UNSET_SENTINEL:
3079
+ if val is not None or k not in optional_fields:
3080
+ m[k] = val
3081
+
3082
+ return m
3083
+
3084
+
3085
+ class CreatePromptMessagesPromptsAssistantMessageTypedDict(TypedDict):
3086
+ role: CreatePromptMessagesPromptsResponse200ApplicationJSONRole
3087
+ r"""The role of the messages author, in this case `assistant`."""
3088
+ content: NotRequired[
3089
+ Nullable[CreatePromptMessagesPromptsResponse200ApplicationJSONContentTypedDict]
3090
+ ]
3091
+ r"""The contents of the assistant message. Required unless `tool_calls` or `function_call` is specified."""
3092
+ refusal: NotRequired[Nullable[str]]
3093
+ r"""The refusal message by the assistant."""
3094
+ name: NotRequired[str]
3095
+ r"""An optional name for the participant. Provides the model information to differentiate between participants of the same role."""
3096
+ audio: NotRequired[Nullable[CreatePromptMessagesPromptsAudioTypedDict]]
3097
+ r"""Data about a previous audio response from the model."""
3098
+ tool_calls: NotRequired[List[CreatePromptMessagesPromptsToolCallsTypedDict]]
3099
+ r"""The tool calls generated by the model, such as function calls."""
3100
+
3101
+
3102
+ class CreatePromptMessagesPromptsAssistantMessage(BaseModel):
3103
+ role: CreatePromptMessagesPromptsResponse200ApplicationJSONRole
3104
+ r"""The role of the messages author, in this case `assistant`."""
3105
+
3106
+ content: OptionalNullable[
3107
+ CreatePromptMessagesPromptsResponse200ApplicationJSONContent
3108
+ ] = UNSET
3109
+ r"""The contents of the assistant message. Required unless `tool_calls` or `function_call` is specified."""
3110
+
3111
+ refusal: OptionalNullable[str] = UNSET
3112
+ r"""The refusal message by the assistant."""
3113
+
3114
+ name: Optional[str] = None
3115
+ r"""An optional name for the participant. Provides the model information to differentiate between participants of the same role."""
3116
+
3117
+ audio: OptionalNullable[CreatePromptMessagesPromptsAudio] = UNSET
3118
+ r"""Data about a previous audio response from the model."""
3119
+
3120
+ tool_calls: Optional[List[CreatePromptMessagesPromptsToolCalls]] = None
3121
+ r"""The tool calls generated by the model, such as function calls."""
3122
+
3123
+ @model_serializer(mode="wrap")
3124
+ def serialize_model(self, handler):
3125
+ optional_fields = set(["content", "refusal", "name", "audio", "tool_calls"])
3126
+ nullable_fields = set(["content", "refusal", "audio"])
3127
+ serialized = handler(self)
3128
+ m = {}
3129
+
3130
+ for n, f in type(self).model_fields.items():
3131
+ k = f.alias or n
3132
+ val = serialized.get(k)
3133
+ is_nullable_and_explicitly_set = (
3134
+ k in nullable_fields
3135
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
3136
+ )
3137
+
3138
+ if val != UNSET_SENTINEL:
3139
+ if (
3140
+ val is not None
3141
+ or k not in optional_fields
3142
+ or is_nullable_and_explicitly_set
3143
+ ):
3144
+ m[k] = val
3145
+
3146
+ return m
3147
+
3148
+
3149
+ CreatePromptMessagesPromptsResponse200Role = Literal["user",]
3150
+ r"""The role of the messages author, in this case `user`."""
3151
+
3152
+
3153
+ CreatePrompt2PromptsResponse200ApplicationJSONResponseBodyType = Literal["file",]
3154
+ r"""The type of the content part. Always `file`."""
3155
+
3156
+
3157
+ CreatePrompt2PromptsResponse200ApplicationJSONResponseBodyPromptType = Literal[
3158
+ "ephemeral",
3159
+ ]
3160
+ r"""Create a cache control breakpoint at this content block. Accepts only the value \"ephemeral\"."""
3161
+
3162
+
3163
+ CreatePrompt2PromptsTTL = Literal[
3164
+ "5m",
3165
+ "1h",
3166
+ ]
3167
+ r"""The time-to-live for the cache control breakpoint. This may be one of the following values:
3168
+
3169
+ - `5m`: 5 minutes
3170
+ - `1h`: 1 hour
3171
+
3172
+ Defaults to `5m`. Only supported by `Anthropic` Claude models.
3173
+ """
3174
+
3175
+
3176
+ class CreatePrompt2PromptsCacheControlTypedDict(TypedDict):
3177
+ type: CreatePrompt2PromptsResponse200ApplicationJSONResponseBodyPromptType
3178
+ r"""Create a cache control breakpoint at this content block. Accepts only the value \"ephemeral\"."""
3179
+ ttl: NotRequired[CreatePrompt2PromptsTTL]
3180
+ r"""The time-to-live for the cache control breakpoint. This may be one of the following values:
3181
+
3182
+ - `5m`: 5 minutes
3183
+ - `1h`: 1 hour
3184
+
3185
+ Defaults to `5m`. Only supported by `Anthropic` Claude models.
3186
+ """
3187
+
3188
+
3189
+ class CreatePrompt2PromptsCacheControl(BaseModel):
3190
+ type: CreatePrompt2PromptsResponse200ApplicationJSONResponseBodyPromptType
3191
+ r"""Create a cache control breakpoint at this content block. Accepts only the value \"ephemeral\"."""
3192
+
3193
+ ttl: Optional[CreatePrompt2PromptsTTL] = "5m"
3194
+ r"""The time-to-live for the cache control breakpoint. This may be one of the following values:
3195
+
3196
+ - `5m`: 5 minutes
3197
+ - `1h`: 1 hour
3198
+
3199
+ Defaults to `5m`. Only supported by `Anthropic` Claude models.
3200
+ """
3201
+
3202
+ @model_serializer(mode="wrap")
3203
+ def serialize_model(self, handler):
3204
+ optional_fields = set(["ttl"])
3205
+ serialized = handler(self)
3206
+ m = {}
3207
+
3208
+ for n, f in type(self).model_fields.items():
3209
+ k = f.alias or n
3210
+ val = serialized.get(k)
3211
+
3212
+ if val != UNSET_SENTINEL:
3213
+ if val is not None or k not in optional_fields:
3214
+ m[k] = val
3215
+
3216
+ return m
3217
+
3218
+
3219
+ class CreatePrompt2Prompts4TypedDict(TypedDict):
3220
+ type: CreatePrompt2PromptsResponse200ApplicationJSONResponseBodyType
3221
+ r"""The type of the content part. Always `file`."""
3222
+ file: FileContentPartSchemaTypedDict
3223
+ r"""File data for the content part. Must contain either file_data or uri, but not both."""
3224
+ cache_control: NotRequired[CreatePrompt2PromptsCacheControlTypedDict]
3225
+
3226
+
3227
+ class CreatePrompt2Prompts4(BaseModel):
3228
+ type: CreatePrompt2PromptsResponse200ApplicationJSONResponseBodyType
3229
+ r"""The type of the content part. Always `file`."""
1772
3230
 
1773
- thinking_level: Annotated[
1774
- Optional[CreatePromptPromptsThinkingLevel],
1775
- pydantic.Field(alias="thinkingLevel"),
1776
- ] = None
1777
- r"""The level of thinking to use for the model. Only supported by `Google AI`"""
3231
+ file: FileContentPartSchema
3232
+ r"""File data for the content part. Must contain either file_data or uri, but not both."""
3233
+
3234
+ cache_control: Optional[CreatePrompt2PromptsCacheControl] = None
1778
3235
 
1779
3236
  @model_serializer(mode="wrap")
1780
3237
  def serialize_model(self, handler):
1781
- optional_fields = [
1782
- "temperature",
1783
- "maxTokens",
1784
- "topK",
1785
- "topP",
1786
- "frequencyPenalty",
1787
- "presencePenalty",
1788
- "numImages",
1789
- "seed",
1790
- "format",
1791
- "dimensions",
1792
- "quality",
1793
- "style",
1794
- "responseFormat",
1795
- "photoRealVersion",
1796
- "encoding_format",
1797
- "reasoningEffort",
1798
- "budgetTokens",
1799
- "verbosity",
1800
- "thinkingLevel",
1801
- ]
1802
- nullable_fields = ["responseFormat"]
1803
- null_default_fields = []
1804
-
3238
+ optional_fields = set(["cache_control"])
1805
3239
  serialized = handler(self)
1806
-
1807
3240
  m = {}
1808
3241
 
1809
3242
  for n, f in type(self).model_fields.items():
1810
3243
  k = f.alias or n
1811
3244
  val = serialized.get(k)
1812
- serialized.pop(k, None)
1813
-
1814
- optional_nullable = k in optional_fields and k in nullable_fields
1815
- is_set = (
1816
- self.__pydantic_fields_set__.intersection({n})
1817
- or k in null_default_fields
1818
- ) # pylint: disable=no-member
1819
3245
 
1820
- if val is not None and val != UNSET_SENTINEL:
1821
- m[k] = val
1822
- elif val != UNSET_SENTINEL and (
1823
- not k in optional_fields or (optional_nullable and is_set)
1824
- ):
1825
- m[k] = val
3246
+ if val != UNSET_SENTINEL:
3247
+ if val is not None or k not in optional_fields:
3248
+ m[k] = val
1826
3249
 
1827
3250
  return m
1828
3251
 
1829
3252
 
1830
- CreatePromptProvider = Literal[
1831
- "openai",
1832
- "groq",
1833
- "cohere",
1834
- "azure",
1835
- "aws",
1836
- "google",
1837
- "google-ai",
1838
- "huggingface",
1839
- "togetherai",
1840
- "perplexity",
1841
- "anthropic",
1842
- "leonardoai",
1843
- "fal",
1844
- "nvidia",
1845
- "jina",
1846
- "elevenlabs",
1847
- "litellm",
1848
- "cerebras",
1849
- "openailike",
1850
- "bytedance",
1851
- "mistral",
1852
- "deepseek",
1853
- "contextualai",
1854
- "moonshotai",
1855
- "zai",
1856
- "slack",
1857
- ]
3253
+ CreatePromptContentPromptsResponse2002TypedDict = TypeAliasType(
3254
+ "CreatePromptContentPromptsResponse2002TypedDict",
3255
+ Union[
3256
+ AudioContentPartSchemaTypedDict,
3257
+ TextContentPartSchemaTypedDict,
3258
+ ImageContentPartSchemaTypedDict,
3259
+ CreatePrompt2Prompts4TypedDict,
3260
+ ],
3261
+ )
1858
3262
 
1859
3263
 
1860
- CreatePromptPromptsRole = Literal[
1861
- "system",
1862
- "assistant",
1863
- "user",
1864
- "exception",
1865
- "tool",
1866
- "prompt",
1867
- "correction",
1868
- "expected_output",
3264
+ CreatePromptContentPromptsResponse2002 = Annotated[
3265
+ Union[
3266
+ Annotated[TextContentPartSchema, Tag("text")],
3267
+ Annotated[ImageContentPartSchema, Tag("image_url")],
3268
+ Annotated[AudioContentPartSchema, Tag("input_audio")],
3269
+ Annotated[CreatePrompt2Prompts4, Tag("file")],
3270
+ ],
3271
+ Discriminator(lambda m: get_discriminator(m, "type", "type")),
1869
3272
  ]
1870
- r"""The role of the prompt message"""
1871
-
1872
-
1873
- CreatePrompt2PromptsResponse200ApplicationJSONType = Literal["file",]
1874
- r"""The type of the content part. Always `file`."""
1875
-
1876
-
1877
- class CreatePrompt2PromptsFileTypedDict(TypedDict):
1878
- file_data: NotRequired[str]
1879
- r"""The file data as a data URI string in the format 'data:<mime-type>;base64,<base64-encoded-data>'. Example: 'data:image/png;base64,iVBORw0KGgoAAAANS...'"""
1880
- uri: NotRequired[str]
1881
- r"""URL to the file. Only supported by Anthropic Claude models for PDF files."""
1882
- mime_type: NotRequired[str]
1883
- r"""MIME type of the file (e.g., application/pdf, image/png)"""
1884
- filename: NotRequired[str]
1885
- r"""The name of the file, used when passing the file to the model as a string."""
1886
-
1887
3273
 
1888
- class CreatePrompt2PromptsFile(BaseModel):
1889
- file_data: Optional[str] = None
1890
- r"""The file data as a data URI string in the format 'data:<mime-type>;base64,<base64-encoded-data>'. Example: 'data:image/png;base64,iVBORw0KGgoAAAANS...'"""
1891
-
1892
- uri: Optional[str] = None
1893
- r"""URL to the file. Only supported by Anthropic Claude models for PDF files."""
1894
3274
 
1895
- mime_type: Annotated[Optional[str], pydantic.Field(alias="mimeType")] = None
1896
- r"""MIME type of the file (e.g., application/pdf, image/png)"""
3275
+ CreatePromptMessagesPromptsResponse200ContentTypedDict = TypeAliasType(
3276
+ "CreatePromptMessagesPromptsResponse200ContentTypedDict",
3277
+ Union[str, List[CreatePromptContentPromptsResponse2002TypedDict]],
3278
+ )
3279
+ r"""The contents of the user message."""
1897
3280
 
1898
- filename: Optional[str] = None
1899
- r"""The name of the file, used when passing the file to the model as a string."""
1900
3281
 
3282
+ CreatePromptMessagesPromptsResponse200Content = TypeAliasType(
3283
+ "CreatePromptMessagesPromptsResponse200Content",
3284
+ Union[str, List[CreatePromptContentPromptsResponse2002]],
3285
+ )
3286
+ r"""The contents of the user message."""
1901
3287
 
1902
- class CreatePrompt23TypedDict(TypedDict):
1903
- type: CreatePrompt2PromptsResponse200ApplicationJSONType
1904
- r"""The type of the content part. Always `file`."""
1905
- file: CreatePrompt2PromptsFileTypedDict
1906
3288
 
3289
+ class CreatePromptMessagesPromptsUserMessageTypedDict(TypedDict):
3290
+ role: CreatePromptMessagesPromptsResponse200Role
3291
+ r"""The role of the messages author, in this case `user`."""
3292
+ content: CreatePromptMessagesPromptsResponse200ContentTypedDict
3293
+ r"""The contents of the user message."""
3294
+ name: NotRequired[str]
3295
+ r"""An optional name for the participant. Provides the model information to differentiate between participants of the same role."""
1907
3296
 
1908
- class CreatePrompt23(BaseModel):
1909
- type: CreatePrompt2PromptsResponse200ApplicationJSONType
1910
- r"""The type of the content part. Always `file`."""
1911
3297
 
1912
- file: CreatePrompt2PromptsFile
3298
+ class CreatePromptMessagesPromptsUserMessage(BaseModel):
3299
+ role: CreatePromptMessagesPromptsResponse200Role
3300
+ r"""The role of the messages author, in this case `user`."""
1913
3301
 
3302
+ content: CreatePromptMessagesPromptsResponse200Content
3303
+ r"""The contents of the user message."""
1914
3304
 
1915
- CreatePrompt2PromptsResponse200Type = Literal["image_url",]
3305
+ name: Optional[str] = None
3306
+ r"""An optional name for the participant. Provides the model information to differentiate between participants of the same role."""
1916
3307
 
3308
+ @model_serializer(mode="wrap")
3309
+ def serialize_model(self, handler):
3310
+ optional_fields = set(["name"])
3311
+ serialized = handler(self)
3312
+ m = {}
1917
3313
 
1918
- class CreatePrompt2PromptsImageURLTypedDict(TypedDict):
1919
- url: str
1920
- r"""Either a URL of the image or the base64 encoded data URI."""
1921
- id: NotRequired[str]
1922
- r"""The orq.ai id of the image"""
1923
- detail: NotRequired[str]
1924
- r"""Specifies the detail level of the image. Currently only supported with OpenAI models"""
3314
+ for n, f in type(self).model_fields.items():
3315
+ k = f.alias or n
3316
+ val = serialized.get(k)
1925
3317
 
3318
+ if val != UNSET_SENTINEL:
3319
+ if val is not None or k not in optional_fields:
3320
+ m[k] = val
1926
3321
 
1927
- class CreatePrompt2PromptsImageURL(BaseModel):
1928
- url: str
1929
- r"""Either a URL of the image or the base64 encoded data URI."""
3322
+ return m
1930
3323
 
1931
- id: Optional[str] = None
1932
- r"""The orq.ai id of the image"""
1933
3324
 
1934
- detail: Optional[str] = None
1935
- r"""Specifies the detail level of the image. Currently only supported with OpenAI models"""
3325
+ CreatePromptMessagesPromptsResponseRole = Literal["system",]
3326
+ r"""The role of the messages author, in this case `system`."""
1936
3327
 
1937
3328
 
1938
- class CreatePrompt2Prompts2TypedDict(TypedDict):
1939
- r"""The image part of the prompt message. Only supported with vision models."""
3329
+ CreatePromptMessagesPromptsResponseContentTypedDict = TypeAliasType(
3330
+ "CreatePromptMessagesPromptsResponseContentTypedDict",
3331
+ Union[str, List[TextContentPartSchemaTypedDict]],
3332
+ )
3333
+ r"""The contents of the system message."""
1940
3334
 
1941
- type: CreatePrompt2PromptsResponse200Type
1942
- image_url: CreatePrompt2PromptsImageURLTypedDict
1943
3335
 
3336
+ CreatePromptMessagesPromptsResponseContent = TypeAliasType(
3337
+ "CreatePromptMessagesPromptsResponseContent",
3338
+ Union[str, List[TextContentPartSchema]],
3339
+ )
3340
+ r"""The contents of the system message."""
1944
3341
 
1945
- class CreatePrompt2Prompts2(BaseModel):
1946
- r"""The image part of the prompt message. Only supported with vision models."""
1947
3342
 
1948
- type: CreatePrompt2PromptsResponse200Type
3343
+ class CreatePromptMessagesPromptsSystemMessageTypedDict(TypedDict):
3344
+ r"""Developer-provided instructions that the model should follow, regardless of messages sent by the user."""
1949
3345
 
1950
- image_url: CreatePrompt2PromptsImageURL
3346
+ role: CreatePromptMessagesPromptsResponseRole
3347
+ r"""The role of the messages author, in this case `system`."""
3348
+ content: CreatePromptMessagesPromptsResponseContentTypedDict
3349
+ r"""The contents of the system message."""
3350
+ name: NotRequired[str]
3351
+ r"""An optional name for the participant. Provides the model information to differentiate between participants of the same role."""
1951
3352
 
1952
3353
 
1953
- CreatePrompt2PromptsResponseType = Literal["text",]
3354
+ class CreatePromptMessagesPromptsSystemMessage(BaseModel):
3355
+ r"""Developer-provided instructions that the model should follow, regardless of messages sent by the user."""
1954
3356
 
3357
+ role: CreatePromptMessagesPromptsResponseRole
3358
+ r"""The role of the messages author, in this case `system`."""
1955
3359
 
1956
- class CreatePrompt2Prompts1TypedDict(TypedDict):
1957
- r"""Text content part of a prompt message"""
3360
+ content: CreatePromptMessagesPromptsResponseContent
3361
+ r"""The contents of the system message."""
1958
3362
 
1959
- type: CreatePrompt2PromptsResponseType
1960
- text: str
3363
+ name: Optional[str] = None
3364
+ r"""An optional name for the participant. Provides the model information to differentiate between participants of the same role."""
1961
3365
 
3366
+ @model_serializer(mode="wrap")
3367
+ def serialize_model(self, handler):
3368
+ optional_fields = set(["name"])
3369
+ serialized = handler(self)
3370
+ m = {}
1962
3371
 
1963
- class CreatePrompt2Prompts1(BaseModel):
1964
- r"""Text content part of a prompt message"""
3372
+ for n, f in type(self).model_fields.items():
3373
+ k = f.alias or n
3374
+ val = serialized.get(k)
1965
3375
 
1966
- type: CreatePrompt2PromptsResponseType
3376
+ if val != UNSET_SENTINEL:
3377
+ if val is not None or k not in optional_fields:
3378
+ m[k] = val
1967
3379
 
1968
- text: str
3380
+ return m
1969
3381
 
1970
3382
 
1971
- CreatePromptContentPromptsResponse2TypedDict = TypeAliasType(
1972
- "CreatePromptContentPromptsResponse2TypedDict",
3383
+ CreatePromptPromptsResponseMessagesTypedDict = TypeAliasType(
3384
+ "CreatePromptPromptsResponseMessagesTypedDict",
1973
3385
  Union[
1974
- CreatePrompt2Prompts1TypedDict,
1975
- CreatePrompt2Prompts2TypedDict,
1976
- CreatePrompt23TypedDict,
3386
+ CreatePromptMessagesPromptsSystemMessageTypedDict,
3387
+ CreatePromptMessagesPromptsUserMessageTypedDict,
3388
+ CreatePromptMessagesPromptsToolMessageTypedDict,
3389
+ CreatePromptMessagesPromptsAssistantMessageTypedDict,
1977
3390
  ],
1978
3391
  )
1979
3392
 
1980
3393
 
1981
- CreatePromptContentPromptsResponse2 = Annotated[
3394
+ CreatePromptPromptsResponseMessages = Annotated[
1982
3395
  Union[
1983
- Annotated[CreatePrompt2Prompts1, Tag("text")],
1984
- Annotated[CreatePrompt2Prompts2, Tag("image_url")],
1985
- Annotated[CreatePrompt23, Tag("file")],
3396
+ Annotated[CreatePromptMessagesPromptsSystemMessage, Tag("system")],
3397
+ Annotated[CreatePromptMessagesPromptsUserMessage, Tag("user")],
3398
+ Annotated[CreatePromptMessagesPromptsAssistantMessage, Tag("assistant")],
3399
+ Annotated[CreatePromptMessagesPromptsToolMessage, Tag("tool")],
1986
3400
  ],
1987
- Discriminator(lambda m: get_discriminator(m, "type", "type")),
3401
+ Discriminator(lambda m: get_discriminator(m, "role", "role")),
1988
3402
  ]
1989
3403
 
1990
3404
 
1991
- CreatePromptPromptsContentTypedDict = TypeAliasType(
1992
- "CreatePromptPromptsContentTypedDict",
1993
- Union[str, List[CreatePromptContentPromptsResponse2TypedDict]],
1994
- )
1995
- r"""The contents of the user message. Either the text content of the message or an array of content parts with a defined type, each can be of type `text` or `image_url` when passing in images. You can pass multiple images by adding multiple `image_url` content parts. Can be null for tool messages in certain scenarios."""
1996
-
1997
-
1998
- CreatePromptPromptsContent = TypeAliasType(
1999
- "CreatePromptPromptsContent", Union[str, List[CreatePromptContentPromptsResponse2]]
2000
- )
2001
- r"""The contents of the user message. Either the text content of the message or an array of content parts with a defined type, each can be of type `text` or `image_url` when passing in images. You can pass multiple images by adding multiple `image_url` content parts. Can be null for tool messages in certain scenarios."""
2002
-
2003
-
2004
- CreatePromptPromptsResponseType = Literal["function",]
3405
+ class PromptFieldTypedDict(TypedDict):
3406
+ r"""Prompt configuration with model and messages. Use this instead of prompt_config."""
2005
3407
 
3408
+ audio: NotRequired[Nullable[CreatePromptPromptsAudioTypedDict]]
3409
+ r"""Parameters for audio output. Required when audio output is requested with modalities: [\"audio\"]. Learn more."""
3410
+ frequency_penalty: NotRequired[Nullable[float]]
3411
+ r"""Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim."""
3412
+ max_tokens: NotRequired[Nullable[int]]
3413
+ r"""`[Deprecated]`. The maximum number of tokens that can be generated in the chat completion. This value can be used to control costs for text generated via API.
2006
3414
 
2007
- class CreatePromptPromptsFunctionTypedDict(TypedDict):
2008
- name: str
2009
- arguments: str
2010
- r"""JSON string arguments for the functions"""
2011
-
3415
+ This value is now `deprecated` in favor of `max_completion_tokens`, and is not compatible with o1 series models.
3416
+ """
3417
+ max_completion_tokens: NotRequired[Nullable[int]]
3418
+ r"""An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning tokens"""
3419
+ logprobs: NotRequired[Nullable[bool]]
3420
+ r"""Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the content of message."""
3421
+ top_logprobs: NotRequired[Nullable[int]]
3422
+ r"""An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability. logprobs must be set to true if this parameter is used."""
3423
+ n: NotRequired[Nullable[int]]
3424
+ r"""How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep n as 1 to minimize costs."""
3425
+ presence_penalty: NotRequired[Nullable[float]]
3426
+ r"""Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics."""
3427
+ response_format: NotRequired[CreatePromptPromptsResponseFormatTypedDict]
3428
+ r"""An object specifying the format that the model must output"""
3429
+ reasoning_effort: NotRequired[CreatePromptPromptsReasoningEffort]
3430
+ r"""Constrains effort on reasoning for [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.
2012
3431
 
2013
- class CreatePromptPromptsFunction(BaseModel):
2014
- name: str
3432
+ - `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool calls are supported for all reasoning values in gpt-5.1.
3433
+ - All models before `gpt-5.1` default to `medium` reasoning effort, and do not support `none`.
3434
+ - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
3435
+ - `xhigh` is currently only supported for `gpt-5.1-codex-max`.
2015
3436
 
2016
- arguments: str
2017
- r"""JSON string arguments for the functions"""
3437
+ Any of \"none\", \"minimal\", \"low\", \"medium\", \"high\", \"xhigh\".
3438
+ """
3439
+ verbosity: NotRequired[str]
3440
+ r"""Adjusts response verbosity. Lower levels yield shorter answers."""
3441
+ seed: NotRequired[Nullable[float]]
3442
+ r"""If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result."""
3443
+ stop: NotRequired[Nullable[CreatePromptPromptsStopTypedDict]]
3444
+ r"""Up to 4 sequences where the API will stop generating further tokens."""
3445
+ stream_options: NotRequired[Nullable[CreatePromptPromptsStreamOptionsTypedDict]]
3446
+ r"""Options for streaming response. Only set this when you set stream: true."""
3447
+ thinking: NotRequired[CreatePromptPromptsThinkingTypedDict]
3448
+ temperature: NotRequired[Nullable[float]]
3449
+ r"""What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic."""
3450
+ top_p: NotRequired[Nullable[float]]
3451
+ r"""An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass."""
3452
+ top_k: NotRequired[Nullable[float]]
3453
+ r"""Limits the model to consider only the top k most likely tokens at each step."""
3454
+ tool_choice: NotRequired[CreatePromptPromptsToolChoiceTypedDict]
3455
+ r"""Controls which (if any) tool is called by the model."""
3456
+ parallel_tool_calls: NotRequired[bool]
3457
+ r"""Whether to enable parallel function calling during tool use."""
3458
+ modalities: NotRequired[Nullable[List[CreatePromptPromptsModalities]]]
3459
+ r"""Output types that you would like the model to generate. Most models are capable of generating text, which is the default: [\"text\"]. The gpt-4o-audio-preview model can also be used to generate audio. To request that this model generate both text and audio responses, you can use: [\"text\", \"audio\"]."""
3460
+ guardrails: NotRequired[List[CreatePromptPromptsGuardrailsTypedDict]]
3461
+ r"""A list of guardrails to apply to the request."""
3462
+ fallbacks: NotRequired[List[CreatePromptPromptsFallbacksTypedDict]]
3463
+ r"""Array of fallback models to use if primary model fails"""
3464
+ retry: NotRequired[CreatePromptPromptsRetryTypedDict]
3465
+ r"""Retry configuration for the request"""
3466
+ cache: NotRequired[CreatePromptPromptsCacheTypedDict]
3467
+ r"""Cache configuration for the request."""
3468
+ load_balancer: NotRequired[CreatePromptPromptsLoadBalancerTypedDict]
3469
+ r"""Load balancer configuration for the request."""
3470
+ timeout: NotRequired[CreatePromptPromptsTimeoutTypedDict]
3471
+ 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."""
3472
+ messages: NotRequired[List[CreatePromptPromptsResponseMessagesTypedDict]]
3473
+ r"""Array of messages that make up the conversation. Each message has a role (system, user, assistant, or tool) and content."""
3474
+ model: NotRequired[Nullable[str]]
3475
+ r"""Model ID used to generate the response, like `openai/gpt-4o` or `anthropic/claude-3-5-sonnet-20241022`. For private models, use format: `{workspaceKey}@{provider}/{model}`."""
3476
+ version: NotRequired[str]
2018
3477
 
2019
3478
 
2020
- class CreatePromptPromptsToolCallsTypedDict(TypedDict):
2021
- type: CreatePromptPromptsResponseType
2022
- function: CreatePromptPromptsFunctionTypedDict
2023
- id: NotRequired[str]
2024
- index: NotRequired[float]
3479
+ class PromptField(BaseModel):
3480
+ r"""Prompt configuration with model and messages. Use this instead of prompt_config."""
2025
3481
 
3482
+ audio: OptionalNullable[CreatePromptPromptsAudio] = UNSET
3483
+ r"""Parameters for audio output. Required when audio output is requested with modalities: [\"audio\"]. Learn more."""
2026
3484
 
2027
- class CreatePromptPromptsToolCalls(BaseModel):
2028
- type: CreatePromptPromptsResponseType
3485
+ frequency_penalty: OptionalNullable[float] = UNSET
3486
+ r"""Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim."""
2029
3487
 
2030
- function: CreatePromptPromptsFunction
3488
+ max_tokens: OptionalNullable[int] = UNSET
3489
+ r"""`[Deprecated]`. The maximum number of tokens that can be generated in the chat completion. This value can be used to control costs for text generated via API.
2031
3490
 
2032
- id: Optional[str] = None
3491
+ This value is now `deprecated` in favor of `max_completion_tokens`, and is not compatible with o1 series models.
3492
+ """
2033
3493
 
2034
- index: Optional[float] = None
3494
+ max_completion_tokens: OptionalNullable[int] = UNSET
3495
+ r"""An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning tokens"""
2035
3496
 
3497
+ logprobs: OptionalNullable[bool] = UNSET
3498
+ r"""Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the content of message."""
2036
3499
 
2037
- class CreatePromptPromptsResponseMessagesTypedDict(TypedDict):
2038
- role: CreatePromptPromptsRole
2039
- r"""The role of the prompt message"""
2040
- content: Nullable[CreatePromptPromptsContentTypedDict]
2041
- r"""The contents of the user message. Either the text content of the message or an array of content parts with a defined type, each can be of type `text` or `image_url` when passing in images. You can pass multiple images by adding multiple `image_url` content parts. Can be null for tool messages in certain scenarios."""
2042
- tool_calls: NotRequired[List[CreatePromptPromptsToolCallsTypedDict]]
2043
- tool_call_id: NotRequired[Nullable[str]]
3500
+ top_logprobs: OptionalNullable[int] = UNSET
3501
+ r"""An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability. logprobs must be set to true if this parameter is used."""
2044
3502
 
3503
+ n: OptionalNullable[int] = UNSET
3504
+ r"""How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep n as 1 to minimize costs."""
2045
3505
 
2046
- class CreatePromptPromptsResponseMessages(BaseModel):
2047
- role: CreatePromptPromptsRole
2048
- r"""The role of the prompt message"""
3506
+ presence_penalty: OptionalNullable[float] = UNSET
3507
+ r"""Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics."""
2049
3508
 
2050
- content: Nullable[CreatePromptPromptsContent]
2051
- r"""The contents of the user message. Either the text content of the message or an array of content parts with a defined type, each can be of type `text` or `image_url` when passing in images. You can pass multiple images by adding multiple `image_url` content parts. Can be null for tool messages in certain scenarios."""
3509
+ response_format: Optional[CreatePromptPromptsResponseFormat] = None
3510
+ r"""An object specifying the format that the model must output"""
2052
3511
 
2053
- tool_calls: Optional[List[CreatePromptPromptsToolCalls]] = None
3512
+ reasoning_effort: Optional[CreatePromptPromptsReasoningEffort] = None
3513
+ r"""Constrains effort on reasoning for [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.
2054
3514
 
2055
- tool_call_id: OptionalNullable[str] = UNSET
3515
+ - `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool calls are supported for all reasoning values in gpt-5.1.
3516
+ - All models before `gpt-5.1` default to `medium` reasoning effort, and do not support `none`.
3517
+ - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
3518
+ - `xhigh` is currently only supported for `gpt-5.1-codex-max`.
2056
3519
 
2057
- @model_serializer(mode="wrap")
2058
- def serialize_model(self, handler):
2059
- optional_fields = ["tool_calls", "tool_call_id"]
2060
- nullable_fields = ["content", "tool_call_id"]
2061
- null_default_fields = []
3520
+ Any of \"none\", \"minimal\", \"low\", \"medium\", \"high\", \"xhigh\".
3521
+ """
2062
3522
 
2063
- serialized = handler(self)
3523
+ verbosity: Optional[str] = None
3524
+ r"""Adjusts response verbosity. Lower levels yield shorter answers."""
2064
3525
 
2065
- m = {}
3526
+ seed: OptionalNullable[float] = UNSET
3527
+ r"""If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result."""
2066
3528
 
2067
- for n, f in type(self).model_fields.items():
2068
- k = f.alias or n
2069
- val = serialized.get(k)
2070
- serialized.pop(k, None)
3529
+ stop: OptionalNullable[CreatePromptPromptsStop] = UNSET
3530
+ r"""Up to 4 sequences where the API will stop generating further tokens."""
2071
3531
 
2072
- optional_nullable = k in optional_fields and k in nullable_fields
2073
- is_set = (
2074
- self.__pydantic_fields_set__.intersection({n})
2075
- or k in null_default_fields
2076
- ) # pylint: disable=no-member
3532
+ stream_options: OptionalNullable[CreatePromptPromptsStreamOptions] = UNSET
3533
+ r"""Options for streaming response. Only set this when you set stream: true."""
2077
3534
 
2078
- if val is not None and val != UNSET_SENTINEL:
2079
- m[k] = val
2080
- elif val != UNSET_SENTINEL and (
2081
- not k in optional_fields or (optional_nullable and is_set)
2082
- ):
2083
- m[k] = val
3535
+ thinking: Optional[CreatePromptPromptsThinking] = None
2084
3536
 
2085
- return m
3537
+ temperature: OptionalNullable[float] = UNSET
3538
+ r"""What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic."""
2086
3539
 
3540
+ top_p: OptionalNullable[float] = UNSET
3541
+ r"""An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass."""
2087
3542
 
2088
- class CreatePromptPromptConfigTypedDict(TypedDict):
2089
- r"""A list of messages compatible with the openAI schema"""
3543
+ top_k: OptionalNullable[float] = UNSET
3544
+ r"""Limits the model to consider only the top k most likely tokens at each step."""
2090
3545
 
2091
- messages: List[CreatePromptPromptsResponseMessagesTypedDict]
2092
- stream: NotRequired[bool]
2093
- model: NotRequired[str]
2094
- model_db_id: NotRequired[Nullable[str]]
2095
- r"""The id of the resource"""
2096
- model_type: NotRequired[Nullable[CreatePromptModelType]]
2097
- r"""The modality of the model"""
2098
- model_parameters: NotRequired[CreatePromptModelParametersTypedDict]
2099
- r"""Model Parameters: Not all parameters apply to every model"""
2100
- provider: NotRequired[CreatePromptProvider]
2101
- integration_id: NotRequired[Nullable[str]]
2102
- r"""The ID of the integration to use"""
2103
- version: NotRequired[str]
3546
+ tool_choice: Optional[CreatePromptPromptsToolChoice] = None
3547
+ r"""Controls which (if any) tool is called by the model."""
2104
3548
 
3549
+ parallel_tool_calls: Optional[bool] = None
3550
+ r"""Whether to enable parallel function calling during tool use."""
2105
3551
 
2106
- class CreatePromptPromptConfig(BaseModel):
2107
- r"""A list of messages compatible with the openAI schema"""
3552
+ modalities: OptionalNullable[List[CreatePromptPromptsModalities]] = UNSET
3553
+ r"""Output types that you would like the model to generate. Most models are capable of generating text, which is the default: [\"text\"]. The gpt-4o-audio-preview model can also be used to generate audio. To request that this model generate both text and audio responses, you can use: [\"text\", \"audio\"]."""
2108
3554
 
2109
- messages: List[CreatePromptPromptsResponseMessages]
3555
+ guardrails: Optional[List[CreatePromptPromptsGuardrails]] = None
3556
+ r"""A list of guardrails to apply to the request."""
2110
3557
 
2111
- stream: Optional[bool] = None
3558
+ fallbacks: Optional[List[CreatePromptPromptsFallbacks]] = None
3559
+ r"""Array of fallback models to use if primary model fails"""
2112
3560
 
2113
- model: Optional[str] = None
3561
+ retry: Optional[CreatePromptPromptsRetry] = None
3562
+ r"""Retry configuration for the request"""
2114
3563
 
2115
- model_db_id: OptionalNullable[str] = UNSET
2116
- r"""The id of the resource"""
3564
+ cache: Optional[CreatePromptPromptsCache] = None
3565
+ r"""Cache configuration for the request."""
2117
3566
 
2118
- model_type: OptionalNullable[CreatePromptModelType] = UNSET
2119
- r"""The modality of the model"""
3567
+ load_balancer: Optional[CreatePromptPromptsLoadBalancer] = None
3568
+ r"""Load balancer configuration for the request."""
2120
3569
 
2121
- model_parameters: Optional[CreatePromptModelParameters] = None
2122
- r"""Model Parameters: Not all parameters apply to every model"""
3570
+ timeout: Optional[CreatePromptPromptsTimeout] = None
3571
+ 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."""
2123
3572
 
2124
- provider: Optional[CreatePromptProvider] = None
3573
+ messages: Optional[List[CreatePromptPromptsResponseMessages]] = None
3574
+ r"""Array of messages that make up the conversation. Each message has a role (system, user, assistant, or tool) and content."""
2125
3575
 
2126
- integration_id: OptionalNullable[str] = UNSET
2127
- r"""The ID of the integration to use"""
3576
+ model: OptionalNullable[str] = UNSET
3577
+ r"""Model ID used to generate the response, like `openai/gpt-4o` or `anthropic/claude-3-5-sonnet-20241022`. For private models, use format: `{workspaceKey}@{provider}/{model}`."""
2128
3578
 
2129
3579
  version: Optional[str] = None
2130
3580
 
2131
3581
  @model_serializer(mode="wrap")
2132
3582
  def serialize_model(self, handler):
2133
- optional_fields = [
2134
- "stream",
2135
- "model",
2136
- "model_db_id",
2137
- "model_type",
2138
- "model_parameters",
2139
- "provider",
2140
- "integration_id",
2141
- "version",
2142
- ]
2143
- nullable_fields = ["model_db_id", "model_type", "integration_id"]
2144
- null_default_fields = []
2145
-
3583
+ optional_fields = set(
3584
+ [
3585
+ "audio",
3586
+ "frequency_penalty",
3587
+ "max_tokens",
3588
+ "max_completion_tokens",
3589
+ "logprobs",
3590
+ "top_logprobs",
3591
+ "n",
3592
+ "presence_penalty",
3593
+ "response_format",
3594
+ "reasoning_effort",
3595
+ "verbosity",
3596
+ "seed",
3597
+ "stop",
3598
+ "stream_options",
3599
+ "thinking",
3600
+ "temperature",
3601
+ "top_p",
3602
+ "top_k",
3603
+ "tool_choice",
3604
+ "parallel_tool_calls",
3605
+ "modalities",
3606
+ "guardrails",
3607
+ "fallbacks",
3608
+ "retry",
3609
+ "cache",
3610
+ "load_balancer",
3611
+ "timeout",
3612
+ "messages",
3613
+ "model",
3614
+ "version",
3615
+ ]
3616
+ )
3617
+ nullable_fields = set(
3618
+ [
3619
+ "audio",
3620
+ "frequency_penalty",
3621
+ "max_tokens",
3622
+ "max_completion_tokens",
3623
+ "logprobs",
3624
+ "top_logprobs",
3625
+ "n",
3626
+ "presence_penalty",
3627
+ "seed",
3628
+ "stop",
3629
+ "stream_options",
3630
+ "temperature",
3631
+ "top_p",
3632
+ "top_k",
3633
+ "modalities",
3634
+ "model",
3635
+ ]
3636
+ )
2146
3637
  serialized = handler(self)
2147
-
2148
3638
  m = {}
2149
3639
 
2150
3640
  for n, f in type(self).model_fields.items():
2151
3641
  k = f.alias or n
2152
3642
  val = serialized.get(k)
2153
- serialized.pop(k, None)
2154
-
2155
- optional_nullable = k in optional_fields and k in nullable_fields
2156
- is_set = (
2157
- self.__pydantic_fields_set__.intersection({n})
2158
- or k in null_default_fields
2159
- ) # pylint: disable=no-member
2160
-
2161
- if val is not None and val != UNSET_SENTINEL:
2162
- m[k] = val
2163
- elif val != UNSET_SENTINEL and (
2164
- not k in optional_fields or (optional_nullable and is_set)
2165
- ):
2166
- m[k] = val
3643
+ is_nullable_and_explicitly_set = (
3644
+ k in nullable_fields
3645
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
3646
+ )
3647
+
3648
+ if val != UNSET_SENTINEL:
3649
+ if (
3650
+ val is not None
3651
+ or k not in optional_fields
3652
+ or is_nullable_and_explicitly_set
3653
+ ):
3654
+ m[k] = val
2167
3655
 
2168
3656
  return m
2169
3657
 
@@ -2220,31 +3708,26 @@ class CreatePromptPromptsMetadata(BaseModel):
2220
3708
 
2221
3709
  @model_serializer(mode="wrap")
2222
3710
  def serialize_model(self, handler):
2223
- optional_fields = ["use_cases", "language"]
2224
- nullable_fields = ["language"]
2225
- null_default_fields = []
2226
-
3711
+ optional_fields = set(["use_cases", "language"])
3712
+ nullable_fields = set(["language"])
2227
3713
  serialized = handler(self)
2228
-
2229
3714
  m = {}
2230
3715
 
2231
3716
  for n, f in type(self).model_fields.items():
2232
3717
  k = f.alias or n
2233
3718
  val = serialized.get(k)
2234
- serialized.pop(k, None)
2235
-
2236
- optional_nullable = k in optional_fields and k in nullable_fields
2237
- is_set = (
2238
- self.__pydantic_fields_set__.intersection({n})
2239
- or k in null_default_fields
2240
- ) # pylint: disable=no-member
2241
-
2242
- if val is not None and val != UNSET_SENTINEL:
2243
- m[k] = val
2244
- elif val != UNSET_SENTINEL and (
2245
- not k in optional_fields or (optional_nullable and is_set)
2246
- ):
2247
- m[k] = val
3719
+ is_nullable_and_explicitly_set = (
3720
+ k in nullable_fields
3721
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
3722
+ )
3723
+
3724
+ if val != UNSET_SENTINEL:
3725
+ if (
3726
+ val is not None
3727
+ or k not in optional_fields
3728
+ or is_nullable_and_explicitly_set
3729
+ ):
3730
+ m[k] = val
2248
3731
 
2249
3732
  return m
2250
3733
 
@@ -2260,12 +3743,14 @@ class CreatePromptPromptTypedDict(TypedDict):
2260
3743
  updated: str
2261
3744
  display_name: str
2262
3745
  r"""The prompt’s name, meant to be displayable in the UI."""
2263
- prompt_config: CreatePromptPromptConfigTypedDict
2264
- r"""A list of messages compatible with the openAI schema"""
3746
+ prompt: PromptFieldTypedDict
3747
+ r"""Prompt configuration with model and messages. Use this instead of prompt_config."""
2265
3748
  created_by_id: NotRequired[Nullable[str]]
2266
3749
  updated_by_id: NotRequired[Nullable[str]]
2267
3750
  description: NotRequired[Nullable[str]]
2268
3751
  r"""The prompt’s description, meant to be displayable in the UI. Use this field to optionally store a long form explanation of the prompt for your own purpose"""
3752
+ prompt_config: NotRequired[PromptConfigTypedDict]
3753
+ r"""[DEPRECATED] Use the `prompt` property instead. A list of messages compatible with the openAI schema."""
2269
3754
  metadata: NotRequired[CreatePromptPromptsMetadataTypedDict]
2270
3755
 
2271
3756
 
@@ -2287,8 +3772,8 @@ class CreatePromptPrompt(BaseModel):
2287
3772
  display_name: str
2288
3773
  r"""The prompt’s name, meant to be displayable in the UI."""
2289
3774
 
2290
- prompt_config: CreatePromptPromptConfig
2291
- r"""A list of messages compatible with the openAI schema"""
3775
+ prompt: PromptField
3776
+ r"""Prompt configuration with model and messages. Use this instead of prompt_config."""
2292
3777
 
2293
3778
  created_by_id: OptionalNullable[str] = UNSET
2294
3779
 
@@ -2297,34 +3782,45 @@ class CreatePromptPrompt(BaseModel):
2297
3782
  description: OptionalNullable[str] = UNSET
2298
3783
  r"""The prompt’s description, meant to be displayable in the UI. Use this field to optionally store a long form explanation of the prompt for your own purpose"""
2299
3784
 
3785
+ prompt_config: Annotated[
3786
+ Optional[PromptConfig],
3787
+ pydantic.Field(
3788
+ deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
3789
+ ),
3790
+ ] = None
3791
+ r"""[DEPRECATED] Use the `prompt` property instead. A list of messages compatible with the openAI schema."""
3792
+
2300
3793
  metadata: Optional[CreatePromptPromptsMetadata] = None
2301
3794
 
2302
3795
  @model_serializer(mode="wrap")
2303
3796
  def serialize_model(self, handler):
2304
- optional_fields = ["created_by_id", "updated_by_id", "description", "metadata"]
2305
- nullable_fields = ["created_by_id", "updated_by_id", "description"]
2306
- null_default_fields = []
2307
-
3797
+ optional_fields = set(
3798
+ [
3799
+ "created_by_id",
3800
+ "updated_by_id",
3801
+ "description",
3802
+ "prompt_config",
3803
+ "metadata",
3804
+ ]
3805
+ )
3806
+ nullable_fields = set(["created_by_id", "updated_by_id", "description"])
2308
3807
  serialized = handler(self)
2309
-
2310
3808
  m = {}
2311
3809
 
2312
3810
  for n, f in type(self).model_fields.items():
2313
3811
  k = f.alias or n
2314
3812
  val = serialized.get(k)
2315
- serialized.pop(k, None)
2316
-
2317
- optional_nullable = k in optional_fields and k in nullable_fields
2318
- is_set = (
2319
- self.__pydantic_fields_set__.intersection({n})
2320
- or k in null_default_fields
2321
- ) # pylint: disable=no-member
2322
-
2323
- if val is not None and val != UNSET_SENTINEL:
2324
- m[k] = val
2325
- elif val != UNSET_SENTINEL and (
2326
- not k in optional_fields or (optional_nullable and is_set)
2327
- ):
2328
- m[k] = val
3813
+ is_nullable_and_explicitly_set = (
3814
+ k in nullable_fields
3815
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
3816
+ )
3817
+
3818
+ if val != UNSET_SENTINEL:
3819
+ if (
3820
+ val is not None
3821
+ or k not in optional_fields
3822
+ or is_nullable_and_explicitly_set
3823
+ ):
3824
+ m[k] = val
2329
3825
 
2330
3826
  return m