orq-ai-sdk 4.2.17__py3-none-any.whl → 4.3.0rc0__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 (75) hide show
  1. orq_ai_sdk/_hooks/globalhook.py +1 -0
  2. orq_ai_sdk/_version.py +3 -3
  3. orq_ai_sdk/agents.py +186 -186
  4. orq_ai_sdk/completions.py +1 -107
  5. orq_ai_sdk/edits.py +1 -107
  6. orq_ai_sdk/embeddings.py +1 -107
  7. orq_ai_sdk/generations.py +1 -99
  8. orq_ai_sdk/models/__init__.py +0 -405
  9. orq_ai_sdk/models/conversationresponse.py +1 -1
  10. orq_ai_sdk/models/conversationwithmessagesresponse.py +1 -1
  11. orq_ai_sdk/models/createagentrequestop.py +0 -24
  12. orq_ai_sdk/models/createchatcompletionop.py +0 -6
  13. orq_ai_sdk/models/createcompletionop.py +30 -218
  14. orq_ai_sdk/models/createcontactop.py +1 -1
  15. orq_ai_sdk/models/createconversationop.py +1 -1
  16. orq_ai_sdk/models/createconversationresponseop.py +2 -2
  17. orq_ai_sdk/models/createdatasetitemop.py +4 -4
  18. orq_ai_sdk/models/createdatasetop.py +1 -1
  19. orq_ai_sdk/models/createdatasourceop.py +1 -1
  20. orq_ai_sdk/models/createembeddingop.py +26 -221
  21. orq_ai_sdk/models/createevalop.py +14 -14
  22. orq_ai_sdk/models/createidentityop.py +1 -1
  23. orq_ai_sdk/models/createimageeditop.py +31 -242
  24. orq_ai_sdk/models/createimageop.py +22 -210
  25. orq_ai_sdk/models/createimagevariationop.py +31 -251
  26. orq_ai_sdk/models/createpromptop.py +0 -12
  27. orq_ai_sdk/models/creatererankop.py +26 -218
  28. orq_ai_sdk/models/createspeechop.py +24 -174
  29. orq_ai_sdk/models/createtoolop.py +6 -6
  30. orq_ai_sdk/models/createtranscriptionop.py +10 -180
  31. orq_ai_sdk/models/createtranslationop.py +10 -172
  32. orq_ai_sdk/models/filegetop.py +1 -1
  33. orq_ai_sdk/models/filelistop.py +1 -1
  34. orq_ai_sdk/models/fileuploadop.py +1 -1
  35. orq_ai_sdk/models/generateconversationnameop.py +1 -1
  36. orq_ai_sdk/models/getallpromptsop.py +0 -6
  37. orq_ai_sdk/models/getalltoolsop.py +6 -6
  38. orq_ai_sdk/models/getevalsop.py +14 -14
  39. orq_ai_sdk/models/getonepromptop.py +0 -6
  40. orq_ai_sdk/models/getpromptversionop.py +0 -6
  41. orq_ai_sdk/models/listagentsop.py +0 -12
  42. orq_ai_sdk/models/listdatasetdatapointsop.py +4 -4
  43. orq_ai_sdk/models/listdatasetsop.py +1 -1
  44. orq_ai_sdk/models/listdatasourcesop.py +1 -1
  45. orq_ai_sdk/models/listidentitiesop.py +1 -1
  46. orq_ai_sdk/models/listpromptversionsop.py +0 -6
  47. orq_ai_sdk/models/partdoneevent.py +1 -1
  48. orq_ai_sdk/models/reasoningpart.py +1 -1
  49. orq_ai_sdk/models/retrieveagentrequestop.py +0 -12
  50. orq_ai_sdk/models/retrievedatapointop.py +4 -4
  51. orq_ai_sdk/models/retrievedatasetop.py +1 -1
  52. orq_ai_sdk/models/retrievedatasourceop.py +1 -1
  53. orq_ai_sdk/models/retrieveidentityop.py +1 -1
  54. orq_ai_sdk/models/retrievetoolop.py +6 -6
  55. orq_ai_sdk/models/runagentop.py +1 -13
  56. orq_ai_sdk/models/streamrunagentop.py +1 -13
  57. orq_ai_sdk/models/updateagentop.py +0 -24
  58. orq_ai_sdk/models/updateconversationop.py +1 -1
  59. orq_ai_sdk/models/updatedatapointop.py +4 -4
  60. orq_ai_sdk/models/updatedatasetop.py +1 -1
  61. orq_ai_sdk/models/updatedatasourceop.py +1 -1
  62. orq_ai_sdk/models/updateevalop.py +14 -14
  63. orq_ai_sdk/models/updateidentityop.py +1 -1
  64. orq_ai_sdk/models/updatepromptop.py +0 -12
  65. orq_ai_sdk/models/updatetoolop.py +7 -7
  66. orq_ai_sdk/orq_completions.py +0 -6
  67. orq_ai_sdk/rerank.py +0 -98
  68. orq_ai_sdk/speech.py +1 -83
  69. orq_ai_sdk/transcriptions.py +0 -90
  70. orq_ai_sdk/translations.py +1 -87
  71. orq_ai_sdk/variations.py +1 -111
  72. {orq_ai_sdk-4.2.17.dist-info → orq_ai_sdk-4.3.0rc0.dist-info}/METADATA +202 -202
  73. {orq_ai_sdk-4.2.17.dist-info → orq_ai_sdk-4.3.0rc0.dist-info}/RECORD +75 -75
  74. {orq_ai_sdk-4.2.17.dist-info → orq_ai_sdk-4.3.0rc0.dist-info}/WHEEL +1 -1
  75. {orq_ai_sdk-4.2.17.dist-info → orq_ai_sdk-4.3.0rc0.dist-info}/top_level.txt +0 -0
@@ -42,3 +42,4 @@ class GlobalHook(BeforeRequestHook):
42
42
  return httpx.Request(method=request.method, url=request.url, extensions=request.extensions, headers=request.headers, content=data)
43
43
 
44
44
  return request
45
+
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.17"
6
+ __version__: str = "4.3.0-rc.0"
7
7
  __openapi_doc_version__: str = "2.0"
8
- __gen_version__: str = "2.801.2"
9
- __user_agent__: str = "speakeasy-sdk/python 4.2.17 2.801.2 2.0 orq-ai-sdk"
8
+ __gen_version__: str = "2.799.0"
9
+ __user_agent__: str = "speakeasy-sdk/python 4.3.0-rc.0 2.799.0 2.0 orq-ai-sdk"
10
10
 
11
11
  try:
12
12
  if __package__ is not None:
orq_ai_sdk/agents.py CHANGED
@@ -363,192 +363,6 @@ 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
-
552
366
  def delete(
553
367
  self,
554
368
  *,
@@ -1611,6 +1425,192 @@ class Agents(BaseSDK):
1611
1425
 
1612
1426
  raise models.APIError("Unexpected response received", http_res)
1613
1427
 
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/completions.py CHANGED
@@ -8,7 +8,7 @@ from orq_ai_sdk.models import createcompletionop as models_createcompletionop
8
8
  from orq_ai_sdk.types import OptionalNullable, UNSET
9
9
  from orq_ai_sdk.utils import eventstreaming, get_security_from_env
10
10
  from orq_ai_sdk.utils.unmarshal_json_response import unmarshal_json_response
11
- from typing import List, Mapping, Optional, Union
11
+ from typing import Mapping, Optional, Union
12
12
 
13
13
 
14
14
  class CreateAcceptEnum(str, Enum):
@@ -37,37 +37,6 @@ class Completions(BaseSDK):
37
37
  top_p: OptionalNullable[float] = 1,
38
38
  n: OptionalNullable[float] = 1,
39
39
  user: Optional[str] = None,
40
- name: Optional[str] = None,
41
- fallbacks: Optional[
42
- Union[
43
- List[models_createcompletionop.CreateCompletionFallbacks],
44
- List[models_createcompletionop.CreateCompletionFallbacksTypedDict],
45
- ]
46
- ] = None,
47
- retry: Optional[
48
- Union[
49
- models_createcompletionop.CreateCompletionRetry,
50
- models_createcompletionop.CreateCompletionRetryTypedDict,
51
- ]
52
- ] = None,
53
- cache: Optional[
54
- Union[
55
- models_createcompletionop.CreateCompletionCache,
56
- models_createcompletionop.CreateCompletionCacheTypedDict,
57
- ]
58
- ] = None,
59
- load_balancer: Optional[
60
- Union[
61
- models_createcompletionop.CreateCompletionLoadBalancer,
62
- models_createcompletionop.CreateCompletionLoadBalancerTypedDict,
63
- ]
64
- ] = None,
65
- timeout: Optional[
66
- Union[
67
- models_createcompletionop.CreateCompletionTimeout,
68
- models_createcompletionop.CreateCompletionTimeoutTypedDict,
69
- ]
70
- ] = None,
71
40
  orq: Optional[
72
41
  Union[
73
42
  models_createcompletionop.CreateCompletionOrq,
@@ -97,12 +66,6 @@ class Completions(BaseSDK):
97
66
  :param top_p: An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.
98
67
  :param n: How many completions to generate for each prompt. Note: Because this parameter generates many completions, it can quickly consume your token quota.
99
68
  :param user: A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.
100
- :param name: The name to display on the trace. If not specified, the default system name will be used.
101
- :param fallbacks: Array of fallback models to use if primary model fails
102
- :param retry: Retry configuration for the request
103
- :param cache: Cache configuration for the request.
104
- :param load_balancer: Load balancer configuration for the request.
105
- :param timeout: 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.
106
69
  :param orq: Leverage Orq's intelligent routing capabilities to enhance your AI application with enterprise-grade reliability and observability. Orq provides automatic request management including retries on failures, model fallbacks for high availability, identity-level analytics tracking, conversation threading, and dynamic prompt templating with variable substitution.
107
70
  :param stream:
108
71
  :param retries: Override the default retry configuration for this method
@@ -137,22 +100,6 @@ class Completions(BaseSDK):
137
100
  top_p=top_p,
138
101
  n=n,
139
102
  user=user,
140
- name=name,
141
- fallbacks=utils.get_pydantic_model(
142
- fallbacks, Optional[List[models.CreateCompletionFallbacks]]
143
- ),
144
- retry=utils.get_pydantic_model(
145
- retry, Optional[models.CreateCompletionRetry]
146
- ),
147
- cache=utils.get_pydantic_model(
148
- cache, Optional[models.CreateCompletionCache]
149
- ),
150
- load_balancer=utils.get_pydantic_model(
151
- load_balancer, Optional[models.CreateCompletionLoadBalancer]
152
- ),
153
- timeout=utils.get_pydantic_model(
154
- timeout, Optional[models.CreateCompletionTimeout]
155
- ),
156
103
  orq=utils.get_pydantic_model(orq, Optional[models.CreateCompletionOrq]),
157
104
  stream=stream,
158
105
  )
@@ -247,37 +194,6 @@ class Completions(BaseSDK):
247
194
  top_p: OptionalNullable[float] = 1,
248
195
  n: OptionalNullable[float] = 1,
249
196
  user: Optional[str] = None,
250
- name: Optional[str] = None,
251
- fallbacks: Optional[
252
- Union[
253
- List[models_createcompletionop.CreateCompletionFallbacks],
254
- List[models_createcompletionop.CreateCompletionFallbacksTypedDict],
255
- ]
256
- ] = None,
257
- retry: Optional[
258
- Union[
259
- models_createcompletionop.CreateCompletionRetry,
260
- models_createcompletionop.CreateCompletionRetryTypedDict,
261
- ]
262
- ] = None,
263
- cache: Optional[
264
- Union[
265
- models_createcompletionop.CreateCompletionCache,
266
- models_createcompletionop.CreateCompletionCacheTypedDict,
267
- ]
268
- ] = None,
269
- load_balancer: Optional[
270
- Union[
271
- models_createcompletionop.CreateCompletionLoadBalancer,
272
- models_createcompletionop.CreateCompletionLoadBalancerTypedDict,
273
- ]
274
- ] = None,
275
- timeout: Optional[
276
- Union[
277
- models_createcompletionop.CreateCompletionTimeout,
278
- models_createcompletionop.CreateCompletionTimeoutTypedDict,
279
- ]
280
- ] = None,
281
197
  orq: Optional[
282
198
  Union[
283
199
  models_createcompletionop.CreateCompletionOrq,
@@ -307,12 +223,6 @@ class Completions(BaseSDK):
307
223
  :param top_p: An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.
308
224
  :param n: How many completions to generate for each prompt. Note: Because this parameter generates many completions, it can quickly consume your token quota.
309
225
  :param user: A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.
310
- :param name: The name to display on the trace. If not specified, the default system name will be used.
311
- :param fallbacks: Array of fallback models to use if primary model fails
312
- :param retry: Retry configuration for the request
313
- :param cache: Cache configuration for the request.
314
- :param load_balancer: Load balancer configuration for the request.
315
- :param timeout: 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.
316
226
  :param orq: Leverage Orq's intelligent routing capabilities to enhance your AI application with enterprise-grade reliability and observability. Orq provides automatic request management including retries on failures, model fallbacks for high availability, identity-level analytics tracking, conversation threading, and dynamic prompt templating with variable substitution.
317
227
  :param stream:
318
228
  :param retries: Override the default retry configuration for this method
@@ -347,22 +257,6 @@ class Completions(BaseSDK):
347
257
  top_p=top_p,
348
258
  n=n,
349
259
  user=user,
350
- name=name,
351
- fallbacks=utils.get_pydantic_model(
352
- fallbacks, Optional[List[models.CreateCompletionFallbacks]]
353
- ),
354
- retry=utils.get_pydantic_model(
355
- retry, Optional[models.CreateCompletionRetry]
356
- ),
357
- cache=utils.get_pydantic_model(
358
- cache, Optional[models.CreateCompletionCache]
359
- ),
360
- load_balancer=utils.get_pydantic_model(
361
- load_balancer, Optional[models.CreateCompletionLoadBalancer]
362
- ),
363
- timeout=utils.get_pydantic_model(
364
- timeout, Optional[models.CreateCompletionTimeout]
365
- ),
366
260
  orq=utils.get_pydantic_model(orq, Optional[models.CreateCompletionOrq]),
367
261
  stream=stream,
368
262
  )