orq-ai-sdk 4.2.0rc28__py3-none-any.whl → 4.3.0rc7__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 (166) hide show
  1. orq_ai_sdk/_version.py +3 -3
  2. orq_ai_sdk/agents.py +186 -186
  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 +438 -0
  7. orq_ai_sdk/contacts.py +43 -855
  8. orq_ai_sdk/deployments.py +61 -0
  9. orq_ai_sdk/edits.py +364 -0
  10. orq_ai_sdk/embeddings.py +344 -0
  11. orq_ai_sdk/generations.py +370 -0
  12. orq_ai_sdk/identities.py +1037 -0
  13. orq_ai_sdk/images.py +28 -0
  14. orq_ai_sdk/models/__init__.py +5746 -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 +1945 -383
  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 +1381 -861
  29. orq_ai_sdk/models/createchunkop.py +46 -19
  30. orq_ai_sdk/models/createcompletionop.py +2078 -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 +579 -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 +715 -0
  41. orq_ai_sdk/models/createimageop.py +407 -128
  42. orq_ai_sdk/models/createimagevariationop.py +706 -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 +2759 -1251
  49. orq_ai_sdk/models/creatererankop.py +608 -0
  50. orq_ai_sdk/models/createresponseop.py +2567 -0
  51. orq_ai_sdk/models/createspeechop.py +466 -0
  52. orq_ai_sdk/models/createtoolop.py +537 -12
  53. orq_ai_sdk/models/createtranscriptionop.py +732 -0
  54. orq_ai_sdk/models/createtranslationop.py +702 -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 +1696 -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 +1679 -230
  84. orq_ai_sdk/models/getpromptversionop.py +1676 -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 +805 -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 +1690 -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 +799 -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 +1462 -196
  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 +1439 -194
  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 +1968 -397
  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 +2854 -1448
  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 +666 -0
  152. orq_ai_sdk/orq_responses.py +398 -0
  153. orq_ai_sdk/prompts.py +28 -36
  154. orq_ai_sdk/rerank.py +330 -0
  155. orq_ai_sdk/router.py +89 -641
  156. orq_ai_sdk/sdk.py +3 -0
  157. orq_ai_sdk/speech.py +333 -0
  158. orq_ai_sdk/transcriptions.py +416 -0
  159. orq_ai_sdk/translations.py +384 -0
  160. orq_ai_sdk/utils/__init__.py +13 -1
  161. orq_ai_sdk/variations.py +364 -0
  162. {orq_ai_sdk-4.2.0rc28.dist-info → orq_ai_sdk-4.3.0rc7.dist-info}/METADATA +169 -148
  163. orq_ai_sdk-4.3.0rc7.dist-info/RECORD +263 -0
  164. {orq_ai_sdk-4.2.0rc28.dist-info → orq_ai_sdk-4.3.0rc7.dist-info}/WHEEL +2 -1
  165. orq_ai_sdk-4.3.0rc7.dist-info/top_level.txt +1 -0
  166. orq_ai_sdk-4.2.0rc28.dist-info/RECORD +0 -233
orq_ai_sdk/_version.py CHANGED
@@ -3,10 +3,10 @@
3
3
  import importlib.metadata
4
4
 
5
5
  __title__: str = "orq-ai-sdk"
6
- __version__: str = "4.2.0-rc.28"
6
+ __version__: str = "4.3.0-rc.7"
7
7
  __openapi_doc_version__: str = "2.0"
8
- __gen_version__: str = "2.794.1"
9
- __user_agent__: str = "speakeasy-sdk/python 4.2.0-rc.28 2.794.1 2.0 orq-ai-sdk"
8
+ __gen_version__: str = "2.801.2"
9
+ __user_agent__: str = "speakeasy-sdk/python 4.3.0-rc.7 2.801.2 2.0 orq-ai-sdk"
10
10
 
11
11
  try:
12
12
  if __package__ is not None:
orq_ai_sdk/agents.py CHANGED
@@ -363,6 +363,192 @@ class Agents(BaseSDK):
363
363
 
364
364
  raise models.APIError("Unexpected response received", http_res)
365
365
 
366
+ def list(
367
+ self,
368
+ *,
369
+ limit: Optional[float] = None,
370
+ starting_after: Optional[str] = None,
371
+ ending_before: Optional[str] = None,
372
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
373
+ server_url: Optional[str] = None,
374
+ timeout_ms: Optional[int] = None,
375
+ http_headers: Optional[Mapping[str, str]] = None,
376
+ ) -> models.ListAgentsResponseBody:
377
+ r"""List agents
378
+
379
+ Retrieves a comprehensive list of agents configured in your workspace. Supports pagination for large datasets and returns agents sorted by creation date (newest first). Each agent in the response includes its complete configuration: model settings with fallback options, instructions, tools, knowledge bases, memory stores, and execution parameters. Use pagination parameters to efficiently navigate through large collections of agents.
380
+
381
+ :param limit: A limit on the number of objects to be returned. Limit can range between 1 and 200. When not provided, returns all agents without pagination.
382
+ :param starting_after: A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 20 objects, ending with `01JJ1HDHN79XAS7A01WB3HYSDB`, your subsequent call can include `after=01JJ1HDHN79XAS7A01WB3HYSDB` in order to fetch the next page of the list.
383
+ :param ending_before: A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 20 objects, starting with `01JJ1HDHN79XAS7A01WB3HYSDB`, your subsequent call can include `before=01JJ1HDHN79XAS7A01WB3HYSDB` in order to fetch the previous page of the list.
384
+ :param retries: Override the default retry configuration for this method
385
+ :param server_url: Override the default server URL for this method
386
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
387
+ :param http_headers: Additional headers to set or replace on requests.
388
+ """
389
+ base_url = None
390
+ url_variables = None
391
+ if timeout_ms is None:
392
+ timeout_ms = self.sdk_configuration.timeout_ms
393
+
394
+ if timeout_ms is None:
395
+ timeout_ms = 600000
396
+
397
+ if server_url is not None:
398
+ base_url = server_url
399
+ else:
400
+ base_url = self._get_url(base_url, url_variables)
401
+
402
+ request = models.ListAgentsRequest(
403
+ limit=limit,
404
+ starting_after=starting_after,
405
+ ending_before=ending_before,
406
+ )
407
+
408
+ req = self._build_request(
409
+ method="GET",
410
+ path="/v2/agents",
411
+ base_url=base_url,
412
+ url_variables=url_variables,
413
+ request=request,
414
+ request_body_required=False,
415
+ request_has_path_params=False,
416
+ request_has_query_params=True,
417
+ user_agent_header="user-agent",
418
+ accept_header_value="application/json",
419
+ http_headers=http_headers,
420
+ security=self.sdk_configuration.security,
421
+ allow_empty_value=None,
422
+ timeout_ms=timeout_ms,
423
+ )
424
+
425
+ if retries == UNSET:
426
+ if self.sdk_configuration.retry_config is not UNSET:
427
+ retries = self.sdk_configuration.retry_config
428
+
429
+ retry_config = None
430
+ if isinstance(retries, utils.RetryConfig):
431
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
432
+
433
+ http_res = self.do_request(
434
+ hook_ctx=HookContext(
435
+ config=self.sdk_configuration,
436
+ base_url=base_url or "",
437
+ operation_id="ListAgents",
438
+ oauth2_scopes=None,
439
+ security_source=get_security_from_env(
440
+ self.sdk_configuration.security, models.Security
441
+ ),
442
+ ),
443
+ request=req,
444
+ error_status_codes=["4XX", "5XX"],
445
+ retry_config=retry_config,
446
+ )
447
+
448
+ if utils.match_response(http_res, "200", "application/json"):
449
+ return unmarshal_json_response(models.ListAgentsResponseBody, http_res)
450
+ if utils.match_response(http_res, "4XX", "*"):
451
+ http_res_text = utils.stream_to_text(http_res)
452
+ raise models.APIError("API error occurred", http_res, http_res_text)
453
+ if utils.match_response(http_res, "5XX", "*"):
454
+ http_res_text = utils.stream_to_text(http_res)
455
+ raise models.APIError("API error occurred", http_res, http_res_text)
456
+
457
+ raise models.APIError("Unexpected response received", http_res)
458
+
459
+ async def list_async(
460
+ self,
461
+ *,
462
+ limit: Optional[float] = None,
463
+ starting_after: Optional[str] = None,
464
+ ending_before: Optional[str] = None,
465
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
466
+ server_url: Optional[str] = None,
467
+ timeout_ms: Optional[int] = None,
468
+ http_headers: Optional[Mapping[str, str]] = None,
469
+ ) -> models.ListAgentsResponseBody:
470
+ r"""List agents
471
+
472
+ Retrieves a comprehensive list of agents configured in your workspace. Supports pagination for large datasets and returns agents sorted by creation date (newest first). Each agent in the response includes its complete configuration: model settings with fallback options, instructions, tools, knowledge bases, memory stores, and execution parameters. Use pagination parameters to efficiently navigate through large collections of agents.
473
+
474
+ :param limit: A limit on the number of objects to be returned. Limit can range between 1 and 200. When not provided, returns all agents without pagination.
475
+ :param starting_after: A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 20 objects, ending with `01JJ1HDHN79XAS7A01WB3HYSDB`, your subsequent call can include `after=01JJ1HDHN79XAS7A01WB3HYSDB` in order to fetch the next page of the list.
476
+ :param ending_before: A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 20 objects, starting with `01JJ1HDHN79XAS7A01WB3HYSDB`, your subsequent call can include `before=01JJ1HDHN79XAS7A01WB3HYSDB` in order to fetch the previous page of the list.
477
+ :param retries: Override the default retry configuration for this method
478
+ :param server_url: Override the default server URL for this method
479
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
480
+ :param http_headers: Additional headers to set or replace on requests.
481
+ """
482
+ base_url = None
483
+ url_variables = None
484
+ if timeout_ms is None:
485
+ timeout_ms = self.sdk_configuration.timeout_ms
486
+
487
+ if timeout_ms is None:
488
+ timeout_ms = 600000
489
+
490
+ if server_url is not None:
491
+ base_url = server_url
492
+ else:
493
+ base_url = self._get_url(base_url, url_variables)
494
+
495
+ request = models.ListAgentsRequest(
496
+ limit=limit,
497
+ starting_after=starting_after,
498
+ ending_before=ending_before,
499
+ )
500
+
501
+ req = self._build_request_async(
502
+ method="GET",
503
+ path="/v2/agents",
504
+ base_url=base_url,
505
+ url_variables=url_variables,
506
+ request=request,
507
+ request_body_required=False,
508
+ request_has_path_params=False,
509
+ request_has_query_params=True,
510
+ user_agent_header="user-agent",
511
+ accept_header_value="application/json",
512
+ http_headers=http_headers,
513
+ security=self.sdk_configuration.security,
514
+ allow_empty_value=None,
515
+ timeout_ms=timeout_ms,
516
+ )
517
+
518
+ if retries == UNSET:
519
+ if self.sdk_configuration.retry_config is not UNSET:
520
+ retries = self.sdk_configuration.retry_config
521
+
522
+ retry_config = None
523
+ if isinstance(retries, utils.RetryConfig):
524
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
525
+
526
+ http_res = await self.do_request_async(
527
+ hook_ctx=HookContext(
528
+ config=self.sdk_configuration,
529
+ base_url=base_url or "",
530
+ operation_id="ListAgents",
531
+ oauth2_scopes=None,
532
+ security_source=get_security_from_env(
533
+ self.sdk_configuration.security, models.Security
534
+ ),
535
+ ),
536
+ request=req,
537
+ error_status_codes=["4XX", "5XX"],
538
+ retry_config=retry_config,
539
+ )
540
+
541
+ if utils.match_response(http_res, "200", "application/json"):
542
+ return unmarshal_json_response(models.ListAgentsResponseBody, http_res)
543
+ if utils.match_response(http_res, "4XX", "*"):
544
+ http_res_text = await utils.stream_to_text_async(http_res)
545
+ raise models.APIError("API error occurred", http_res, http_res_text)
546
+ if utils.match_response(http_res, "5XX", "*"):
547
+ http_res_text = await utils.stream_to_text_async(http_res)
548
+ raise models.APIError("API error occurred", http_res, http_res_text)
549
+
550
+ raise models.APIError("Unexpected response received", http_res)
551
+
366
552
  def delete(
367
553
  self,
368
554
  *,
@@ -1425,192 +1611,6 @@ class Agents(BaseSDK):
1425
1611
 
1426
1612
  raise models.APIError("Unexpected response received", http_res)
1427
1613
 
1428
- def list(
1429
- self,
1430
- *,
1431
- limit: Optional[float] = None,
1432
- starting_after: Optional[str] = None,
1433
- ending_before: Optional[str] = None,
1434
- retries: OptionalNullable[utils.RetryConfig] = UNSET,
1435
- server_url: Optional[str] = None,
1436
- timeout_ms: Optional[int] = None,
1437
- http_headers: Optional[Mapping[str, str]] = None,
1438
- ) -> models.ListAgentsResponseBody:
1439
- r"""List agents
1440
-
1441
- Retrieves a comprehensive list of agents configured in your workspace. Supports pagination for large datasets and returns agents sorted by creation date (newest first). Each agent in the response includes its complete configuration: model settings with fallback options, instructions, tools, knowledge bases, memory stores, and execution parameters. Use pagination parameters to efficiently navigate through large collections of agents.
1442
-
1443
- :param limit: A limit on the number of objects to be returned. Limit can range between 1 and 200. When not provided, returns all agents without pagination.
1444
- :param starting_after: A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 20 objects, ending with `01JJ1HDHN79XAS7A01WB3HYSDB`, your subsequent call can include `after=01JJ1HDHN79XAS7A01WB3HYSDB` in order to fetch the next page of the list.
1445
- :param ending_before: A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 20 objects, starting with `01JJ1HDHN79XAS7A01WB3HYSDB`, your subsequent call can include `before=01JJ1HDHN79XAS7A01WB3HYSDB` in order to fetch the previous page of the list.
1446
- :param retries: Override the default retry configuration for this method
1447
- :param server_url: Override the default server URL for this method
1448
- :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1449
- :param http_headers: Additional headers to set or replace on requests.
1450
- """
1451
- base_url = None
1452
- url_variables = None
1453
- if timeout_ms is None:
1454
- timeout_ms = self.sdk_configuration.timeout_ms
1455
-
1456
- if timeout_ms is None:
1457
- timeout_ms = 600000
1458
-
1459
- if server_url is not None:
1460
- base_url = server_url
1461
- else:
1462
- base_url = self._get_url(base_url, url_variables)
1463
-
1464
- request = models.ListAgentsRequest(
1465
- limit=limit,
1466
- starting_after=starting_after,
1467
- ending_before=ending_before,
1468
- )
1469
-
1470
- req = self._build_request(
1471
- method="GET",
1472
- path="/v2/agents/",
1473
- base_url=base_url,
1474
- url_variables=url_variables,
1475
- request=request,
1476
- request_body_required=False,
1477
- request_has_path_params=False,
1478
- request_has_query_params=True,
1479
- user_agent_header="user-agent",
1480
- accept_header_value="application/json",
1481
- http_headers=http_headers,
1482
- security=self.sdk_configuration.security,
1483
- allow_empty_value=None,
1484
- timeout_ms=timeout_ms,
1485
- )
1486
-
1487
- if retries == UNSET:
1488
- if self.sdk_configuration.retry_config is not UNSET:
1489
- retries = self.sdk_configuration.retry_config
1490
-
1491
- retry_config = None
1492
- if isinstance(retries, utils.RetryConfig):
1493
- retry_config = (retries, ["429", "500", "502", "503", "504"])
1494
-
1495
- http_res = self.do_request(
1496
- hook_ctx=HookContext(
1497
- config=self.sdk_configuration,
1498
- base_url=base_url or "",
1499
- operation_id="ListAgents",
1500
- oauth2_scopes=None,
1501
- security_source=get_security_from_env(
1502
- self.sdk_configuration.security, models.Security
1503
- ),
1504
- ),
1505
- request=req,
1506
- error_status_codes=["4XX", "5XX"],
1507
- retry_config=retry_config,
1508
- )
1509
-
1510
- if utils.match_response(http_res, "200", "application/json"):
1511
- return unmarshal_json_response(models.ListAgentsResponseBody, http_res)
1512
- if utils.match_response(http_res, "4XX", "*"):
1513
- http_res_text = utils.stream_to_text(http_res)
1514
- raise models.APIError("API error occurred", http_res, http_res_text)
1515
- if utils.match_response(http_res, "5XX", "*"):
1516
- http_res_text = utils.stream_to_text(http_res)
1517
- raise models.APIError("API error occurred", http_res, http_res_text)
1518
-
1519
- raise models.APIError("Unexpected response received", http_res)
1520
-
1521
- async def list_async(
1522
- self,
1523
- *,
1524
- limit: Optional[float] = None,
1525
- starting_after: Optional[str] = None,
1526
- ending_before: Optional[str] = None,
1527
- retries: OptionalNullable[utils.RetryConfig] = UNSET,
1528
- server_url: Optional[str] = None,
1529
- timeout_ms: Optional[int] = None,
1530
- http_headers: Optional[Mapping[str, str]] = None,
1531
- ) -> models.ListAgentsResponseBody:
1532
- r"""List agents
1533
-
1534
- Retrieves a comprehensive list of agents configured in your workspace. Supports pagination for large datasets and returns agents sorted by creation date (newest first). Each agent in the response includes its complete configuration: model settings with fallback options, instructions, tools, knowledge bases, memory stores, and execution parameters. Use pagination parameters to efficiently navigate through large collections of agents.
1535
-
1536
- :param limit: A limit on the number of objects to be returned. Limit can range between 1 and 200. When not provided, returns all agents without pagination.
1537
- :param starting_after: A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 20 objects, ending with `01JJ1HDHN79XAS7A01WB3HYSDB`, your subsequent call can include `after=01JJ1HDHN79XAS7A01WB3HYSDB` in order to fetch the next page of the list.
1538
- :param ending_before: A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 20 objects, starting with `01JJ1HDHN79XAS7A01WB3HYSDB`, your subsequent call can include `before=01JJ1HDHN79XAS7A01WB3HYSDB` in order to fetch the previous page of the list.
1539
- :param retries: Override the default retry configuration for this method
1540
- :param server_url: Override the default server URL for this method
1541
- :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1542
- :param http_headers: Additional headers to set or replace on requests.
1543
- """
1544
- base_url = None
1545
- url_variables = None
1546
- if timeout_ms is None:
1547
- timeout_ms = self.sdk_configuration.timeout_ms
1548
-
1549
- if timeout_ms is None:
1550
- timeout_ms = 600000
1551
-
1552
- if server_url is not None:
1553
- base_url = server_url
1554
- else:
1555
- base_url = self._get_url(base_url, url_variables)
1556
-
1557
- request = models.ListAgentsRequest(
1558
- limit=limit,
1559
- starting_after=starting_after,
1560
- ending_before=ending_before,
1561
- )
1562
-
1563
- req = self._build_request_async(
1564
- method="GET",
1565
- path="/v2/agents/",
1566
- base_url=base_url,
1567
- url_variables=url_variables,
1568
- request=request,
1569
- request_body_required=False,
1570
- request_has_path_params=False,
1571
- request_has_query_params=True,
1572
- user_agent_header="user-agent",
1573
- accept_header_value="application/json",
1574
- http_headers=http_headers,
1575
- security=self.sdk_configuration.security,
1576
- allow_empty_value=None,
1577
- timeout_ms=timeout_ms,
1578
- )
1579
-
1580
- if retries == UNSET:
1581
- if self.sdk_configuration.retry_config is not UNSET:
1582
- retries = self.sdk_configuration.retry_config
1583
-
1584
- retry_config = None
1585
- if isinstance(retries, utils.RetryConfig):
1586
- retry_config = (retries, ["429", "500", "502", "503", "504"])
1587
-
1588
- http_res = await self.do_request_async(
1589
- hook_ctx=HookContext(
1590
- config=self.sdk_configuration,
1591
- base_url=base_url or "",
1592
- operation_id="ListAgents",
1593
- oauth2_scopes=None,
1594
- security_source=get_security_from_env(
1595
- self.sdk_configuration.security, models.Security
1596
- ),
1597
- ),
1598
- request=req,
1599
- error_status_codes=["4XX", "5XX"],
1600
- retry_config=retry_config,
1601
- )
1602
-
1603
- if utils.match_response(http_res, "200", "application/json"):
1604
- return unmarshal_json_response(models.ListAgentsResponseBody, http_res)
1605
- if utils.match_response(http_res, "4XX", "*"):
1606
- http_res_text = await utils.stream_to_text_async(http_res)
1607
- raise models.APIError("API error occurred", http_res, http_res_text)
1608
- if utils.match_response(http_res, "5XX", "*"):
1609
- http_res_text = await utils.stream_to_text_async(http_res)
1610
- raise models.APIError("API error occurred", http_res, http_res_text)
1611
-
1612
- raise models.APIError("Unexpected response received", http_res)
1613
-
1614
1614
  @deprecated(
1615
1615
  "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
1616
1616
  )
orq_ai_sdk/audio.py ADDED
@@ -0,0 +1,30 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from .basesdk import BaseSDK
4
+ from .sdkconfiguration import SDKConfiguration
5
+ from orq_ai_sdk.speech import Speech
6
+ from orq_ai_sdk.transcriptions import Transcriptions
7
+ from orq_ai_sdk.translations import Translations
8
+ from typing import Optional
9
+
10
+
11
+ class Audio(BaseSDK):
12
+ speech: Speech
13
+ transcriptions: Transcriptions
14
+ translations: Translations
15
+
16
+ def __init__(
17
+ self, sdk_config: SDKConfiguration, parent_ref: Optional[object] = None
18
+ ) -> None:
19
+ BaseSDK.__init__(self, sdk_config, parent_ref=parent_ref)
20
+ self.sdk_configuration = sdk_config
21
+ self._init_sdks()
22
+
23
+ def _init_sdks(self):
24
+ self.speech = Speech(self.sdk_configuration, parent_ref=self.parent_ref)
25
+ self.transcriptions = Transcriptions(
26
+ self.sdk_configuration, parent_ref=self.parent_ref
27
+ )
28
+ self.translations = Translations(
29
+ self.sdk_configuration, parent_ref=self.parent_ref
30
+ )
orq_ai_sdk/basesdk.py CHANGED
@@ -8,7 +8,12 @@ from orq_ai_sdk._hooks import (
8
8
  AfterSuccessContext,
9
9
  BeforeRequestContext,
10
10
  )
11
- from orq_ai_sdk.utils import RetryConfig, SerializedRequestBody, get_body_content
11
+ from orq_ai_sdk.utils import (
12
+ RetryConfig,
13
+ SerializedRequestBody,
14
+ get_body_content,
15
+ run_sync_in_thread,
16
+ )
12
17
  from typing import Callable, List, Mapping, Optional, Tuple
13
18
  from urllib.parse import parse_qs, urlparse
14
19
 
@@ -311,7 +316,10 @@ class BaseSDK:
311
316
  async def do():
312
317
  http_res = None
313
318
  try:
314
- req = hooks.before_request(BeforeRequestContext(hook_ctx), request)
319
+ req = await run_sync_in_thread(
320
+ hooks.before_request, BeforeRequestContext(hook_ctx), request
321
+ )
322
+
315
323
  logger.debug(
316
324
  "Request:\nMethod: %s\nURL: %s\nHeaders: %s\nBody: %s",
317
325
  req.method,
@@ -325,7 +333,10 @@ class BaseSDK:
325
333
 
326
334
  http_res = await client.send(req, stream=stream)
327
335
  except Exception as e:
328
- _, e = hooks.after_error(AfterErrorContext(hook_ctx), None, e)
336
+ _, e = await run_sync_in_thread(
337
+ hooks.after_error, AfterErrorContext(hook_ctx), None, e
338
+ )
339
+
329
340
  if e is not None:
330
341
  logger.debug("Request Exception", exc_info=True)
331
342
  raise e
@@ -343,9 +354,10 @@ class BaseSDK:
343
354
  )
344
355
 
345
356
  if utils.match_status_codes(error_status_codes, http_res.status_code):
346
- result, err = hooks.after_error(
347
- AfterErrorContext(hook_ctx), http_res, None
357
+ result, err = await run_sync_in_thread(
358
+ hooks.after_error, AfterErrorContext(hook_ctx), http_res, None
348
359
  )
360
+
349
361
  if err is not None:
350
362
  logger.debug("Request Exception", exc_info=True)
351
363
  raise err
@@ -365,6 +377,8 @@ class BaseSDK:
365
377
  http_res = await do()
366
378
 
367
379
  if not utils.match_status_codes(error_status_codes, http_res.status_code):
368
- http_res = hooks.after_success(AfterSuccessContext(hook_ctx), http_res)
380
+ http_res = await run_sync_in_thread(
381
+ hooks.after_success, AfterSuccessContext(hook_ctx), http_res
382
+ )
369
383
 
370
384
  return http_res
orq_ai_sdk/chat.py ADDED
@@ -0,0 +1,22 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from .basesdk import BaseSDK
4
+ from .sdkconfiguration import SDKConfiguration
5
+ from orq_ai_sdk.orq_completions import OrqCompletions
6
+ from typing import Optional
7
+
8
+
9
+ class Chat(BaseSDK):
10
+ completions: OrqCompletions
11
+
12
+ def __init__(
13
+ self, sdk_config: SDKConfiguration, parent_ref: Optional[object] = None
14
+ ) -> None:
15
+ BaseSDK.__init__(self, sdk_config, parent_ref=parent_ref)
16
+ self.sdk_configuration = sdk_config
17
+ self._init_sdks()
18
+
19
+ def _init_sdks(self):
20
+ self.completions = OrqCompletions(
21
+ self.sdk_configuration, parent_ref=self.parent_ref
22
+ )