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
@@ -53,6 +53,22 @@ class RequestBody2(BaseModel):
53
53
 
54
54
  description: Optional[str] = None
55
55
 
56
+ @model_serializer(mode="wrap")
57
+ def serialize_model(self, handler):
58
+ optional_fields = set(["type", "description"])
59
+ serialized = handler(self)
60
+ m = {}
61
+
62
+ for n, f in type(self).model_fields.items():
63
+ k = f.alias or n
64
+ val = serialized.get(k)
65
+
66
+ if val != UNSET_SENTINEL:
67
+ if val is not None or k not in optional_fields:
68
+ m[k] = val
69
+
70
+ return m
71
+
56
72
 
57
73
  CreateKnowledgeRequestBodyType = Literal["internal",]
58
74
 
@@ -88,6 +104,22 @@ class CreateKnowledgeRequestBodyRerankConfig(BaseModel):
88
104
  rerank_threshold: Optional[float] = 0.5
89
105
  r"""The threshold value used to filter the rerank results, only documents with a relevance score greater than the threshold will be returned"""
90
106
 
107
+ @model_serializer(mode="wrap")
108
+ def serialize_model(self, handler):
109
+ optional_fields = set(["top_k", "rerank_threshold"])
110
+ serialized = handler(self)
111
+ m = {}
112
+
113
+ for n, f in type(self).model_fields.items():
114
+ k = f.alias or n
115
+ val = serialized.get(k)
116
+
117
+ if val != UNSET_SENTINEL:
118
+ if val is not None or k not in optional_fields:
119
+ m[k] = val
120
+
121
+ return m
122
+
91
123
 
92
124
  class CreateKnowledgeRequestBodyAgenticRagConfigTypedDict(TypedDict):
93
125
  r"""The Agentic RAG configuration for the knowledge base. If `null` is provided, Agentic RAG will be disabled."""
@@ -144,37 +176,34 @@ class RetrievalSettings(BaseModel):
144
176
 
145
177
  @model_serializer(mode="wrap")
146
178
  def serialize_model(self, handler):
147
- optional_fields = [
148
- "retrieval_type",
149
- "top_k",
150
- "threshold",
151
- "rerank_config",
152
- "agentic_rag_config",
153
- ]
154
- nullable_fields = ["rerank_config", "agentic_rag_config"]
155
- null_default_fields = []
156
-
179
+ optional_fields = set(
180
+ [
181
+ "retrieval_type",
182
+ "top_k",
183
+ "threshold",
184
+ "rerank_config",
185
+ "agentic_rag_config",
186
+ ]
187
+ )
188
+ nullable_fields = set(["rerank_config", "agentic_rag_config"])
157
189
  serialized = handler(self)
158
-
159
190
  m = {}
160
191
 
161
192
  for n, f in type(self).model_fields.items():
162
193
  k = f.alias or n
163
194
  val = serialized.get(k)
164
- serialized.pop(k, None)
165
-
166
- optional_nullable = k in optional_fields and k in nullable_fields
167
- is_set = (
168
- self.__pydantic_fields_set__.intersection({n})
169
- or k in null_default_fields
170
- ) # pylint: disable=no-member
171
-
172
- if val is not None and val != UNSET_SENTINEL:
173
- m[k] = val
174
- elif val != UNSET_SENTINEL and (
175
- not k in optional_fields or (optional_nullable and is_set)
176
- ):
177
- m[k] = val
195
+ is_nullable_and_explicitly_set = (
196
+ k in nullable_fields
197
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
198
+ )
199
+
200
+ if val != UNSET_SENTINEL:
201
+ if (
202
+ val is not None
203
+ or k not in optional_fields
204
+ or is_nullable_and_explicitly_set
205
+ ):
206
+ m[k] = val
178
207
 
179
208
  return m
180
209
 
@@ -217,6 +246,22 @@ class RequestBody1(BaseModel):
217
246
  retrieval_settings: Optional[RetrievalSettings] = None
218
247
  r"""The retrieval settings for the knowledge base. If not provider, Hybrid Search will be used as a default query strategy."""
219
248
 
249
+ @model_serializer(mode="wrap")
250
+ def serialize_model(self, handler):
251
+ optional_fields = set(["type", "description", "retrieval_settings"])
252
+ serialized = handler(self)
253
+ m = {}
254
+
255
+ for n, f in type(self).model_fields.items():
256
+ k = f.alias or n
257
+ val = serialized.get(k)
258
+
259
+ if val != UNSET_SENTINEL:
260
+ if val is not None or k not in optional_fields:
261
+ m[k] = val
262
+
263
+ return m
264
+
220
265
 
221
266
  CreateKnowledgeRequestBodyTypedDict = TypeAliasType(
222
267
  "CreateKnowledgeRequestBodyTypedDict",
@@ -255,6 +300,22 @@ class CreateKnowledgeResponseBodyRerankConfig(BaseModel):
255
300
  rerank_threshold: Optional[float] = 0.5
256
301
  r"""The threshold value used to filter the rerank results, only documents with a relevance score greater than the threshold will be returned"""
257
302
 
303
+ @model_serializer(mode="wrap")
304
+ def serialize_model(self, handler):
305
+ optional_fields = set(["top_k", "rerank_threshold"])
306
+ serialized = handler(self)
307
+ m = {}
308
+
309
+ for n, f in type(self).model_fields.items():
310
+ k = f.alias or n
311
+ val = serialized.get(k)
312
+
313
+ if val != UNSET_SENTINEL:
314
+ if val is not None or k not in optional_fields:
315
+ m[k] = val
316
+
317
+ return m
318
+
258
319
 
259
320
  class CreateKnowledgeResponseBodyAgenticRagConfigTypedDict(TypedDict):
260
321
  r"""The Agentic RAG configuration for the knowledge base. If `null` is provided, Agentic RAG will be disabled."""
@@ -306,31 +367,28 @@ class CreateKnowledgeResponseBodyRetrievalSettings(BaseModel):
306
367
 
307
368
  @model_serializer(mode="wrap")
308
369
  def serialize_model(self, handler):
309
- optional_fields = ["top_k", "threshold", "rerank_config", "agentic_rag_config"]
310
- nullable_fields = ["rerank_config", "agentic_rag_config"]
311
- null_default_fields = []
312
-
370
+ optional_fields = set(
371
+ ["top_k", "threshold", "rerank_config", "agentic_rag_config"]
372
+ )
373
+ nullable_fields = set(["rerank_config", "agentic_rag_config"])
313
374
  serialized = handler(self)
314
-
315
375
  m = {}
316
376
 
317
377
  for n, f in type(self).model_fields.items():
318
378
  k = f.alias or n
319
379
  val = serialized.get(k)
320
- serialized.pop(k, None)
321
-
322
- optional_nullable = k in optional_fields and k in nullable_fields
323
- is_set = (
324
- self.__pydantic_fields_set__.intersection({n})
325
- or k in null_default_fields
326
- ) # pylint: disable=no-member
327
-
328
- if val is not None and val != UNSET_SENTINEL:
329
- m[k] = val
330
- elif val != UNSET_SENTINEL and (
331
- not k in optional_fields or (optional_nullable and is_set)
332
- ):
333
- m[k] = val
380
+ is_nullable_and_explicitly_set = (
381
+ k in nullable_fields
382
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
383
+ )
384
+
385
+ if val != UNSET_SENTINEL:
386
+ if (
387
+ val is not None
388
+ or k not in optional_fields
389
+ or is_nullable_and_explicitly_set
390
+ ):
391
+ m[k] = val
334
392
 
335
393
  return m
336
394
 
@@ -420,38 +478,35 @@ class ResponseBody2(BaseModel):
420
478
 
421
479
  @model_serializer(mode="wrap")
422
480
  def serialize_model(self, handler):
423
- optional_fields = [
424
- "description",
425
- "path",
426
- "created_by_id",
427
- "updated_by_id",
428
- "type",
429
- "retrieval_settings",
430
- ]
431
- nullable_fields = ["created_by_id", "updated_by_id"]
432
- null_default_fields = []
433
-
481
+ optional_fields = set(
482
+ [
483
+ "description",
484
+ "path",
485
+ "created_by_id",
486
+ "updated_by_id",
487
+ "type",
488
+ "retrieval_settings",
489
+ ]
490
+ )
491
+ nullable_fields = set(["created_by_id", "updated_by_id"])
434
492
  serialized = handler(self)
435
-
436
493
  m = {}
437
494
 
438
495
  for n, f in type(self).model_fields.items():
439
496
  k = f.alias or n
440
497
  val = serialized.get(k)
441
- serialized.pop(k, None)
442
-
443
- optional_nullable = k in optional_fields and k in nullable_fields
444
- is_set = (
445
- self.__pydantic_fields_set__.intersection({n})
446
- or k in null_default_fields
447
- ) # pylint: disable=no-member
448
-
449
- if val is not None and val != UNSET_SENTINEL:
450
- m[k] = val
451
- elif val != UNSET_SENTINEL and (
452
- not k in optional_fields or (optional_nullable and is_set)
453
- ):
454
- m[k] = val
498
+ is_nullable_and_explicitly_set = (
499
+ k in nullable_fields
500
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
501
+ )
502
+
503
+ if val != UNSET_SENTINEL:
504
+ if (
505
+ val is not None
506
+ or k not in optional_fields
507
+ or is_nullable_and_explicitly_set
508
+ ):
509
+ m[k] = val
455
510
 
456
511
  return m
457
512
 
@@ -490,6 +545,22 @@ class ResponseBodyRerankConfig(BaseModel):
490
545
  rerank_threshold: Optional[float] = 0.5
491
546
  r"""The threshold value used to filter the rerank results, only documents with a relevance score greater than the threshold will be returned"""
492
547
 
548
+ @model_serializer(mode="wrap")
549
+ def serialize_model(self, handler):
550
+ optional_fields = set(["top_k", "rerank_threshold"])
551
+ serialized = handler(self)
552
+ m = {}
553
+
554
+ for n, f in type(self).model_fields.items():
555
+ k = f.alias or n
556
+ val = serialized.get(k)
557
+
558
+ if val != UNSET_SENTINEL:
559
+ if val is not None or k not in optional_fields:
560
+ m[k] = val
561
+
562
+ return m
563
+
493
564
 
494
565
  class ResponseBodyAgenticRagConfigTypedDict(TypedDict):
495
566
  r"""The Agentic RAG configuration for the knowledge base. If `null` is provided, Agentic RAG will be disabled."""
@@ -540,37 +611,34 @@ class ResponseBodyRetrievalSettings(BaseModel):
540
611
 
541
612
  @model_serializer(mode="wrap")
542
613
  def serialize_model(self, handler):
543
- optional_fields = [
544
- "retrieval_type",
545
- "top_k",
546
- "threshold",
547
- "rerank_config",
548
- "agentic_rag_config",
549
- ]
550
- nullable_fields = ["rerank_config", "agentic_rag_config"]
551
- null_default_fields = []
552
-
614
+ optional_fields = set(
615
+ [
616
+ "retrieval_type",
617
+ "top_k",
618
+ "threshold",
619
+ "rerank_config",
620
+ "agentic_rag_config",
621
+ ]
622
+ )
623
+ nullable_fields = set(["rerank_config", "agentic_rag_config"])
553
624
  serialized = handler(self)
554
-
555
625
  m = {}
556
626
 
557
627
  for n, f in type(self).model_fields.items():
558
628
  k = f.alias or n
559
629
  val = serialized.get(k)
560
- serialized.pop(k, None)
561
-
562
- optional_nullable = k in optional_fields and k in nullable_fields
563
- is_set = (
564
- self.__pydantic_fields_set__.intersection({n})
565
- or k in null_default_fields
566
- ) # pylint: disable=no-member
567
-
568
- if val is not None and val != UNSET_SENTINEL:
569
- m[k] = val
570
- elif val != UNSET_SENTINEL and (
571
- not k in optional_fields or (optional_nullable and is_set)
572
- ):
573
- m[k] = val
630
+ is_nullable_and_explicitly_set = (
631
+ k in nullable_fields
632
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
633
+ )
634
+
635
+ if val != UNSET_SENTINEL:
636
+ if (
637
+ val is not None
638
+ or k not in optional_fields
639
+ or is_nullable_and_explicitly_set
640
+ ):
641
+ m[k] = val
574
642
 
575
643
  return m
576
644
 
@@ -645,38 +713,35 @@ class ResponseBody1(BaseModel):
645
713
 
646
714
  @model_serializer(mode="wrap")
647
715
  def serialize_model(self, handler):
648
- optional_fields = [
649
- "description",
650
- "path",
651
- "created_by_id",
652
- "updated_by_id",
653
- "type",
654
- "retrieval_settings",
655
- ]
656
- nullable_fields = ["created_by_id", "updated_by_id"]
657
- null_default_fields = []
658
-
716
+ optional_fields = set(
717
+ [
718
+ "description",
719
+ "path",
720
+ "created_by_id",
721
+ "updated_by_id",
722
+ "type",
723
+ "retrieval_settings",
724
+ ]
725
+ )
726
+ nullable_fields = set(["created_by_id", "updated_by_id"])
659
727
  serialized = handler(self)
660
-
661
728
  m = {}
662
729
 
663
730
  for n, f in type(self).model_fields.items():
664
731
  k = f.alias or n
665
732
  val = serialized.get(k)
666
- serialized.pop(k, None)
667
-
668
- optional_nullable = k in optional_fields and k in nullable_fields
669
- is_set = (
670
- self.__pydantic_fields_set__.intersection({n})
671
- or k in null_default_fields
672
- ) # pylint: disable=no-member
673
-
674
- if val is not None and val != UNSET_SENTINEL:
675
- m[k] = val
676
- elif val != UNSET_SENTINEL and (
677
- not k in optional_fields or (optional_nullable and is_set)
678
- ):
679
- m[k] = val
733
+ is_nullable_and_explicitly_set = (
734
+ k in nullable_fields
735
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
736
+ )
737
+
738
+ if val != UNSET_SENTINEL:
739
+ if (
740
+ val is not None
741
+ or k not in optional_fields
742
+ or is_nullable_and_explicitly_set
743
+ ):
744
+ m[k] = val
680
745
 
681
746
  return m
682
747
 
@@ -1,9 +1,10 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
3
  from __future__ import annotations
4
- from orq_ai_sdk.types import BaseModel
4
+ from orq_ai_sdk.types import BaseModel, UNSET_SENTINEL
5
5
  from orq_ai_sdk.utils import FieldMetadata, PathParamMetadata, RequestMetadata
6
6
  import pydantic
7
+ from pydantic import model_serializer
7
8
  from typing import Dict, Optional
8
9
  from typing_extensions import Annotated, NotRequired, TypedDict
9
10
 
@@ -22,6 +23,22 @@ class CreateMemoryDocumentRequestBody(BaseModel):
22
23
  metadata: Optional[Dict[str, str]] = None
23
24
  r"""Flexible key-value pairs for custom filtering and categorization. Clients can add arbitrary string metadata to enable future filtering of memory documents based on their specific needs (e.g., document type, source, topic, relevance score, or any custom taxonomy)."""
24
25
 
26
+ @model_serializer(mode="wrap")
27
+ def serialize_model(self, handler):
28
+ optional_fields = set(["metadata"])
29
+ serialized = handler(self)
30
+ m = {}
31
+
32
+ for n, f in type(self).model_fields.items():
33
+ k = f.alias or n
34
+ val = serialized.get(k)
35
+
36
+ if val != UNSET_SENTINEL:
37
+ if val is not None or k not in optional_fields:
38
+ m[k] = val
39
+
40
+ return m
41
+
25
42
 
26
43
  class CreateMemoryDocumentRequestTypedDict(TypedDict):
27
44
  memory_store_key: str
@@ -47,6 +64,22 @@ class CreateMemoryDocumentRequest(BaseModel):
47
64
  FieldMetadata(request=RequestMetadata(media_type="application/json")),
48
65
  ] = None
49
66
 
67
+ @model_serializer(mode="wrap")
68
+ def serialize_model(self, handler):
69
+ optional_fields = set(["RequestBody"])
70
+ serialized = handler(self)
71
+ m = {}
72
+
73
+ for n, f in type(self).model_fields.items():
74
+ k = f.alias or n
75
+ val = serialized.get(k)
76
+
77
+ if val != UNSET_SENTINEL:
78
+ if val is not None or k not in optional_fields:
79
+ m[k] = val
80
+
81
+ return m
82
+
50
83
 
51
84
  class CreateMemoryDocumentResponseBodyTypedDict(TypedDict):
52
85
  r"""Memory document successfully created."""
@@ -89,3 +122,19 @@ class CreateMemoryDocumentResponseBody(BaseModel):
89
122
 
90
123
  metadata: Optional[Dict[str, str]] = None
91
124
  r"""Flexible key-value pairs for custom filtering and categorization. Clients can add arbitrary string metadata to enable future filtering of memory documents based on their specific needs (e.g., document type, source, topic, relevance score, or any custom taxonomy)."""
125
+
126
+ @model_serializer(mode="wrap")
127
+ def serialize_model(self, handler):
128
+ optional_fields = set(["created_by_id", "updated_by_id", "metadata"])
129
+ serialized = handler(self)
130
+ m = {}
131
+
132
+ for n, f in type(self).model_fields.items():
133
+ k = f.alias or n
134
+ val = serialized.get(k)
135
+
136
+ if val != UNSET_SENTINEL:
137
+ if val is not None or k not in optional_fields:
138
+ m[k] = val
139
+
140
+ return m
@@ -42,13 +42,30 @@ class CreateMemoryRequest(BaseModel):
42
42
  FieldMetadata(request=RequestMetadata(media_type="application/json")),
43
43
  ] = None
44
44
 
45
+ @model_serializer(mode="wrap")
46
+ def serialize_model(self, handler):
47
+ optional_fields = set(["RequestBody"])
48
+ serialized = handler(self)
49
+ m = {}
50
+
51
+ for n, f in type(self).model_fields.items():
52
+ k = f.alias or n
53
+ val = serialized.get(k)
54
+
55
+ if val != UNSET_SENTINEL:
56
+ if val is not None or k not in optional_fields:
57
+ m[k] = val
58
+
59
+ return m
60
+
45
61
 
46
62
  class CreateMemoryResponseBodyTypedDict(TypedDict):
47
63
  r"""Memory successfully created."""
48
64
 
49
65
  id: str
66
+ r"""Unique identifier for the memory. This is automatically generated by the system."""
50
67
  entity_id: str
51
- r"""This property have been deprecated and moved to `_id`. Please refer to `_id` for future operations"""
68
+ r"""Customer provided entity ID for the memory. This is used to link the memory to a specific user/company/session/etc. Has to be unique within the memory store."""
52
69
  created: str
53
70
  updated: str
54
71
  store_id: str
@@ -63,6 +80,7 @@ class CreateMemoryResponseBody(BaseModel):
63
80
  r"""Memory successfully created."""
64
81
 
65
82
  id: Annotated[str, pydantic.Field(alias="_id")]
83
+ r"""Unique identifier for the memory. This is automatically generated by the system."""
66
84
 
67
85
  entity_id: Annotated[
68
86
  str,
@@ -70,7 +88,7 @@ class CreateMemoryResponseBody(BaseModel):
70
88
  deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
71
89
  ),
72
90
  ]
73
- r"""This property have been deprecated and moved to `_id`. Please refer to `_id` for future operations"""
91
+ r"""Customer provided entity ID for the memory. This is used to link the memory to a specific user/company/session/etc. Has to be unique within the memory store."""
74
92
 
75
93
  created: str
76
94
 
@@ -89,30 +107,25 @@ class CreateMemoryResponseBody(BaseModel):
89
107
 
90
108
  @model_serializer(mode="wrap")
91
109
  def serialize_model(self, handler):
92
- optional_fields = ["created_by_id", "updated_by_id"]
93
- nullable_fields = ["created_by_id", "updated_by_id"]
94
- null_default_fields = []
95
-
110
+ optional_fields = set(["created_by_id", "updated_by_id"])
111
+ nullable_fields = set(["created_by_id", "updated_by_id"])
96
112
  serialized = handler(self)
97
-
98
113
  m = {}
99
114
 
100
115
  for n, f in type(self).model_fields.items():
101
116
  k = f.alias or n
102
117
  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
118
+ is_nullable_and_explicitly_set = (
119
+ k in nullable_fields
120
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
121
+ )
122
+
123
+ if val != UNSET_SENTINEL:
124
+ if (
125
+ val is not None
126
+ or k not in optional_fields
127
+ or is_nullable_and_explicitly_set
128
+ ):
129
+ m[k] = val
117
130
 
118
131
  return m
@@ -1,8 +1,9 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
3
  from __future__ import annotations
4
- from orq_ai_sdk.types import BaseModel
4
+ from orq_ai_sdk.types import BaseModel, UNSET_SENTINEL
5
5
  import pydantic
6
+ from pydantic import model_serializer
6
7
  from typing import Optional
7
8
  from typing_extensions import Annotated, NotRequired, TypedDict
8
9
 
@@ -54,6 +55,22 @@ class CreateMemoryStoreRequestBody(BaseModel):
54
55
  ttl: Optional[float] = None
55
56
  r"""The default time to live of every memory document created within the memory store. Useful to control if the documents in the memory should be store for short or long term."""
56
57
 
58
+ @model_serializer(mode="wrap")
59
+ def serialize_model(self, handler):
60
+ optional_fields = set(["ttl"])
61
+ serialized = handler(self)
62
+ m = {}
63
+
64
+ for n, f in type(self).model_fields.items():
65
+ k = f.alias or n
66
+ val = serialized.get(k)
67
+
68
+ if val != UNSET_SENTINEL:
69
+ if val is not None or k not in optional_fields:
70
+ m[k] = val
71
+
72
+ return m
73
+
57
74
 
58
75
  class CreateMemoryStoreEmbeddingConfigTypedDict(TypedDict):
59
76
  model: str
@@ -115,3 +132,19 @@ class CreateMemoryStoreResponseBody(BaseModel):
115
132
 
116
133
  ttl: Optional[float] = None
117
134
  r"""The default time to live of every memory document created within the memory store. Useful to control if the documents in the memory should be store for short or long term."""
135
+
136
+ @model_serializer(mode="wrap")
137
+ def serialize_model(self, handler):
138
+ optional_fields = set(["created_by_id", "updated_by_id", "ttl"])
139
+ serialized = handler(self)
140
+ m = {}
141
+
142
+ for n, f in type(self).model_fields.items():
143
+ k = f.alias or n
144
+ val = serialized.get(k)
145
+
146
+ if val != UNSET_SENTINEL:
147
+ if val is not None or k not in optional_fields:
148
+ m[k] = val
149
+
150
+ return m