orq-ai-sdk 4.2.0rc48__py3-none-any.whl → 4.2.12__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 (103) 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/chat.py +22 -0
  5. orq_ai_sdk/completions.py +438 -0
  6. orq_ai_sdk/contacts.py +43 -886
  7. orq_ai_sdk/deployments.py +61 -0
  8. orq_ai_sdk/edits.py +364 -0
  9. orq_ai_sdk/embeddings.py +344 -0
  10. orq_ai_sdk/generations.py +370 -0
  11. orq_ai_sdk/images.py +28 -0
  12. orq_ai_sdk/models/__init__.py +3839 -424
  13. orq_ai_sdk/models/conversationresponse.py +1 -1
  14. orq_ai_sdk/models/conversationwithmessagesresponse.py +1 -1
  15. orq_ai_sdk/models/createagentrequestop.py +768 -12
  16. orq_ai_sdk/models/createagentresponse.py +68 -2
  17. orq_ai_sdk/models/createchatcompletionop.py +538 -313
  18. orq_ai_sdk/models/createcompletionop.py +2078 -0
  19. orq_ai_sdk/models/createcontactop.py +5 -10
  20. orq_ai_sdk/models/createconversationop.py +1 -1
  21. orq_ai_sdk/models/createconversationresponseop.py +2 -2
  22. orq_ai_sdk/models/createdatasetitemop.py +4 -4
  23. orq_ai_sdk/models/createdatasetop.py +1 -1
  24. orq_ai_sdk/models/createdatasourceop.py +1 -1
  25. orq_ai_sdk/models/createembeddingop.py +579 -0
  26. orq_ai_sdk/models/createevalop.py +14 -14
  27. orq_ai_sdk/models/createidentityop.py +1 -1
  28. orq_ai_sdk/models/createimageeditop.py +715 -0
  29. orq_ai_sdk/models/createimageop.py +228 -82
  30. orq_ai_sdk/models/createimagevariationop.py +706 -0
  31. orq_ai_sdk/models/creatememoryop.py +4 -2
  32. orq_ai_sdk/models/createmoderationop.py +521 -0
  33. orq_ai_sdk/models/createpromptop.py +375 -6
  34. orq_ai_sdk/models/creatererankop.py +608 -0
  35. orq_ai_sdk/models/createresponseop.py +2567 -0
  36. orq_ai_sdk/models/createspeechop.py +466 -0
  37. orq_ai_sdk/models/createtoolop.py +6 -6
  38. orq_ai_sdk/models/createtranscriptionop.py +732 -0
  39. orq_ai_sdk/models/createtranslationop.py +702 -0
  40. orq_ai_sdk/models/deploymentgetconfigop.py +17 -7
  41. orq_ai_sdk/models/deploymentsop.py +1 -0
  42. orq_ai_sdk/models/deploymentstreamop.py +7 -0
  43. orq_ai_sdk/models/filegetop.py +1 -1
  44. orq_ai_sdk/models/filelistop.py +1 -1
  45. orq_ai_sdk/models/fileuploadop.py +1 -1
  46. orq_ai_sdk/models/generateconversationnameop.py +1 -1
  47. orq_ai_sdk/models/getallmemoriesop.py +4 -2
  48. orq_ai_sdk/models/getallpromptsop.py +188 -3
  49. orq_ai_sdk/models/getalltoolsop.py +6 -6
  50. orq_ai_sdk/models/getevalsop.py +17 -17
  51. orq_ai_sdk/models/getonepromptop.py +188 -3
  52. orq_ai_sdk/models/getpromptversionop.py +188 -3
  53. orq_ai_sdk/models/invokedeploymentrequest.py +11 -4
  54. orq_ai_sdk/models/listagentsop.py +372 -0
  55. orq_ai_sdk/models/listdatasetdatapointsop.py +4 -4
  56. orq_ai_sdk/models/listdatasetsop.py +1 -1
  57. orq_ai_sdk/models/listdatasourcesop.py +1 -1
  58. orq_ai_sdk/models/listidentitiesop.py +1 -1
  59. orq_ai_sdk/models/listmodelsop.py +1 -0
  60. orq_ai_sdk/models/listpromptversionsop.py +188 -3
  61. orq_ai_sdk/models/partdoneevent.py +1 -1
  62. orq_ai_sdk/models/post_v2_router_ocrop.py +408 -0
  63. orq_ai_sdk/models/publiccontact.py +9 -3
  64. orq_ai_sdk/models/publicidentity.py +62 -0
  65. orq_ai_sdk/models/reasoningpart.py +1 -1
  66. orq_ai_sdk/models/responsedoneevent.py +14 -11
  67. orq_ai_sdk/models/retrieveagentrequestop.py +382 -0
  68. orq_ai_sdk/models/retrievedatapointop.py +4 -4
  69. orq_ai_sdk/models/retrievedatasetop.py +1 -1
  70. orq_ai_sdk/models/retrievedatasourceop.py +1 -1
  71. orq_ai_sdk/models/retrieveidentityop.py +1 -1
  72. orq_ai_sdk/models/retrievememoryop.py +4 -2
  73. orq_ai_sdk/models/retrievetoolop.py +6 -6
  74. orq_ai_sdk/models/runagentop.py +379 -9
  75. orq_ai_sdk/models/streamrunagentop.py +385 -9
  76. orq_ai_sdk/models/updateagentop.py +770 -12
  77. orq_ai_sdk/models/updateconversationop.py +1 -1
  78. orq_ai_sdk/models/updatedatapointop.py +4 -4
  79. orq_ai_sdk/models/updatedatasetop.py +1 -1
  80. orq_ai_sdk/models/updatedatasourceop.py +1 -1
  81. orq_ai_sdk/models/updateevalop.py +14 -14
  82. orq_ai_sdk/models/updateidentityop.py +1 -1
  83. orq_ai_sdk/models/updatememoryop.py +4 -2
  84. orq_ai_sdk/models/updatepromptop.py +375 -6
  85. orq_ai_sdk/models/updatetoolop.py +7 -7
  86. orq_ai_sdk/moderations.py +218 -0
  87. orq_ai_sdk/orq_completions.py +666 -0
  88. orq_ai_sdk/orq_responses.py +398 -0
  89. orq_ai_sdk/rerank.py +330 -0
  90. orq_ai_sdk/router.py +89 -641
  91. orq_ai_sdk/speech.py +333 -0
  92. orq_ai_sdk/transcriptions.py +416 -0
  93. orq_ai_sdk/translations.py +384 -0
  94. orq_ai_sdk/variations.py +364 -0
  95. orq_ai_sdk-4.2.12.dist-info/METADATA +888 -0
  96. {orq_ai_sdk-4.2.0rc48.dist-info → orq_ai_sdk-4.2.12.dist-info}/RECORD +98 -75
  97. {orq_ai_sdk-4.2.0rc48.dist-info → orq_ai_sdk-4.2.12.dist-info}/WHEEL +1 -1
  98. orq_ai_sdk/models/deletecontactop.py +0 -44
  99. orq_ai_sdk/models/listcontactsop.py +0 -265
  100. orq_ai_sdk/models/retrievecontactop.py +0 -142
  101. orq_ai_sdk/models/updatecontactop.py +0 -233
  102. orq_ai_sdk-4.2.0rc48.dist-info/METADATA +0 -788
  103. {orq_ai_sdk-4.2.0rc48.dist-info → orq_ai_sdk-4.2.12.dist-info}/top_level.txt +0 -0
@@ -1,788 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: orq-ai-sdk
3
- Version: 4.2.0rc48
4
- Summary: Python Client SDK for the Orq API.
5
- Author: Orq
6
- Project-URL: repository, https://github.com/orq-ai/orq-python.git
7
- Requires-Python: >=3.9.2
8
- Description-Content-Type: text/markdown
9
- Requires-Dist: httpcore>=1.0.9
10
- Requires-Dist: httpx>=0.28.1
11
- Requires-Dist: pydantic>=2.11.2
12
- Requires-Dist: requests==2.32.4
13
-
14
- # orq-ai-sdk
15
-
16
- Developer-friendly & type-safe Python SDK specifically catered to leverage *orq-ai-sdk* API.
17
-
18
- <div align="left">
19
- <a href="https://www.speakeasy.com/?utm_source=orq-ai-sdk&utm_campaign=python"><img src="https://custom-icon-badges.demolab.com/badge/-Built%20By%20Speakeasy-212015?style=for-the-badge&logoColor=FBE331&logo=speakeasy&labelColor=545454" /></a>
20
- <a href="https://opensource.org/licenses/MIT">
21
- <img src="https://img.shields.io/badge/License-MIT-blue.svg" style="width: 100px; height: 28px;" />
22
- </a>
23
- </div>
24
-
25
- <!-- Start Summary [summary] -->
26
- ## Summary
27
-
28
- orq.ai API: orq.ai API documentation
29
-
30
- For more information about the API: [orq.ai Documentation](https://docs.orq.ai)
31
- <!-- End Summary [summary] -->
32
-
33
- <!-- Start Table of Contents [toc] -->
34
- ## Table of Contents
35
- <!-- $toc-max-depth=2 -->
36
- * [orq-ai-sdk](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/#orq-ai-sdk)
37
- * [SDK Installation](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/#sdk-installation)
38
- * [IDE Support](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/#ide-support)
39
- * [SDK Example Usage](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/#sdk-example-usage)
40
- * [Authentication](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/#authentication)
41
- * [Available Resources and Operations](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/#available-resources-and-operations)
42
- * [Server-sent event streaming](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/#server-sent-event-streaming)
43
- * [File uploads](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/#file-uploads)
44
- * [Retries](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/#retries)
45
- * [Error Handling](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/#error-handling)
46
- * [Server Selection](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/#server-selection)
47
- * [Custom HTTP Client](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/#custom-http-client)
48
- * [Resource Management](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/#resource-management)
49
- * [Debugging](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/#debugging)
50
- * [Development](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/#development)
51
- * [Maturity](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/#maturity)
52
- * [Contributions](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/#contributions)
53
-
54
- <!-- End Table of Contents [toc] -->
55
-
56
- <!-- Start SDK Installation [installation] -->
57
- ## SDK Installation
58
-
59
- > [!NOTE]
60
- > **Python version upgrade policy**
61
- >
62
- > Once a Python version reaches its [official end of life date](https://devguide.python.org/versions/), a 3-month grace period is provided for users to upgrade. Following this grace period, the minimum python version supported in the SDK will be updated.
63
-
64
- The SDK can be installed with *uv*, *pip*, or *poetry* package managers.
65
-
66
- ### uv
67
-
68
- *uv* is a fast Python package installer and resolver, designed as a drop-in replacement for pip and pip-tools. It's recommended for its speed and modern Python tooling capabilities.
69
-
70
- ```bash
71
- uv add orq-ai-sdk
72
- ```
73
-
74
- ### PIP
75
-
76
- *PIP* is the default package installer for Python, enabling easy installation and management of packages from PyPI via the command line.
77
-
78
- ```bash
79
- pip install orq-ai-sdk
80
- ```
81
-
82
- ### Poetry
83
-
84
- *Poetry* is a modern tool that simplifies dependency management and package publishing by using a single `pyproject.toml` file to handle project metadata and dependencies.
85
-
86
- ```bash
87
- poetry add orq-ai-sdk
88
- ```
89
-
90
- ### Shell and script usage with `uv`
91
-
92
- You can use this SDK in a Python shell with [uv](https://docs.astral.sh/uv/) and the `uvx` command that comes with it like so:
93
-
94
- ```shell
95
- uvx --from orq-ai-sdk python
96
- ```
97
-
98
- It's also possible to write a standalone Python script without needing to set up a whole project like so:
99
-
100
- ```python
101
- #!/usr/bin/env -S uv run --script
102
- # /// script
103
- # requires-python = ">=3.9"
104
- # dependencies = [
105
- # "orq-ai-sdk",
106
- # ]
107
- # ///
108
-
109
- from orq_ai_sdk import Orq
110
-
111
- sdk = Orq(
112
- # SDK arguments
113
- )
114
-
115
- # Rest of script here...
116
- ```
117
-
118
- Once that is saved to a file, you can run it with `uv run script.py` where
119
- `script.py` can be replaced with the actual file name.
120
- <!-- End SDK Installation [installation] -->
121
-
122
- <!-- Start IDE Support [idesupport] -->
123
- ## IDE Support
124
-
125
- ### PyCharm
126
-
127
- Generally, the SDK will work well with most IDEs out of the box. However, when using PyCharm, you can enjoy much better integration with Pydantic by installing an additional plugin.
128
-
129
- - [PyCharm Pydantic Plugin](https://docs.pydantic.dev/latest/integrations/pycharm/)
130
- <!-- End IDE Support [idesupport] -->
131
-
132
- <!-- Start SDK Example Usage [usage] -->
133
- ## SDK Example Usage
134
-
135
- ### Example
136
-
137
- ```python
138
- # Synchronous Example
139
- from orq_ai_sdk import Orq
140
- import os
141
-
142
-
143
- with Orq(
144
- api_key=os.getenv("ORQ_API_KEY", ""),
145
- ) as orq:
146
-
147
- res = orq.feedback.create(field="rating", value=[
148
- "good",
149
- ], trace_id="67HTZ65Z9W91HSF51CW68KK1QH")
150
-
151
- # Handle response
152
- print(res)
153
- ```
154
-
155
- </br>
156
-
157
- The same SDK client can also be used to make asynchronous requests by importing asyncio.
158
-
159
- ```python
160
- # Asynchronous Example
161
- import asyncio
162
- from orq_ai_sdk import Orq
163
- import os
164
-
165
- async def main():
166
-
167
- async with Orq(
168
- api_key=os.getenv("ORQ_API_KEY", ""),
169
- ) as orq:
170
-
171
- res = await orq.feedback.create_async(field="rating", value=[
172
- "good",
173
- ], trace_id="67HTZ65Z9W91HSF51CW68KK1QH")
174
-
175
- # Handle response
176
- print(res)
177
-
178
- asyncio.run(main())
179
- ```
180
- <!-- End SDK Example Usage [usage] -->
181
-
182
- <!-- Start Authentication [security] -->
183
- ## Authentication
184
-
185
- ### Per-Client Security Schemes
186
-
187
- This SDK supports the following security scheme globally:
188
-
189
- | Name | Type | Scheme | Environment Variable |
190
- | --------- | ---- | ----------- | -------------------- |
191
- | `api_key` | http | HTTP Bearer | `ORQ_API_KEY` |
192
-
193
- To authenticate with the API the `api_key` parameter must be set when initializing the SDK client instance. For example:
194
- ```python
195
- from orq_ai_sdk import Orq
196
- import os
197
-
198
-
199
- with Orq(
200
- api_key=os.getenv("ORQ_API_KEY", ""),
201
- ) as orq:
202
-
203
- res = orq.feedback.create(field="rating", value=[
204
- "good",
205
- ], trace_id="67HTZ65Z9W91HSF51CW68KK1QH")
206
-
207
- # Handle response
208
- print(res)
209
-
210
- ```
211
- <!-- End Authentication [security] -->
212
-
213
- <!-- Start Available Resources and Operations [operations] -->
214
- ## Available Resources and Operations
215
-
216
- <details open>
217
- <summary>Available methods</summary>
218
-
219
- ### [Agents](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/agents/README.md)
220
-
221
- * [create](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/agents/README.md#create) - Create agent
222
- * [delete](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/agents/README.md#delete) - Delete agent
223
- * [retrieve](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/agents/README.md#retrieve) - Retrieve agent
224
- * [update](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/agents/README.md#update) - Update agent
225
- * [~~invoke~~](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/agents/README.md#invoke) - Execute an agent task :warning: **Deprecated**
226
- * [list](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/agents/README.md#list) - List agents
227
- * [~~run~~](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/agents/README.md#run) - Run an agent with configuration :warning: **Deprecated**
228
- * [~~stream_run~~](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/agents/README.md#stream_run) - Run agent with streaming response :warning: **Deprecated**
229
- * [~~stream~~](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/agents/README.md#stream) - Stream agent execution in real-time :warning: **Deprecated**
230
-
231
- #### [Agents.Responses](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/responses/README.md)
232
-
233
- * [create](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/responses/README.md#create) - Create response
234
-
235
- ### [Chunking](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/chunking/README.md)
236
-
237
- * [parse](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/chunking/README.md#parse) - Parse text
238
-
239
- ### [~~Contacts~~](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/contacts/README.md)
240
-
241
- * [~~create~~](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/contacts/README.md#create) - Create a contact :warning: **Deprecated**
242
- * [~~list~~](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/contacts/README.md#list) - List contacts :warning: **Deprecated**
243
- * [~~retrieve~~](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/contacts/README.md#retrieve) - Retrieve a contact :warning: **Deprecated**
244
- * [~~update~~](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/contacts/README.md#update) - Update a contact :warning: **Deprecated**
245
- * [~~delete~~](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/contacts/README.md#delete) - Delete a contact :warning: **Deprecated**
246
-
247
- ### [Conversations](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/conversations/README.md)
248
-
249
- * [list](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/conversations/README.md#list) - List conversations
250
- * [create](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/conversations/README.md#create) - Create conversation
251
- * [generate_name](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/conversations/README.md#generate_name) - Generate conversation name
252
- * [retrieve](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/conversations/README.md#retrieve) - Retrieve conversation
253
- * [update](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/conversations/README.md#update) - Update conversation
254
- * [delete](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/conversations/README.md#delete) - Delete conversation
255
- * [create_conversation_response](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/conversations/README.md#create_conversation_response) - Create internal response
256
-
257
- ### [Datasets](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/datasets/README.md)
258
-
259
- * [list](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/datasets/README.md#list) - List datasets
260
- * [create](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/datasets/README.md#create) - Create a dataset
261
- * [retrieve](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/datasets/README.md#retrieve) - Retrieve a dataset
262
- * [update](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/datasets/README.md#update) - Update a dataset
263
- * [delete](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/datasets/README.md#delete) - Delete a dataset
264
- * [list_datapoints](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/datasets/README.md#list_datapoints) - List datapoints
265
- * [create_datapoint](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/datasets/README.md#create_datapoint) - Create a datapoint
266
- * [retrieve_datapoint](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/datasets/README.md#retrieve_datapoint) - Retrieve a datapoint
267
- * [update_datapoint](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/datasets/README.md#update_datapoint) - Update a datapoint
268
- * [delete_datapoint](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/datasets/README.md#delete_datapoint) - Delete a datapoint
269
- * [clear](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/datasets/README.md#clear) - Delete all datapoints
270
-
271
- ### [Deployments](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/deployments/README.md)
272
-
273
- * [invoke](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/deployments/README.md#invoke) - Invoke
274
- * [list](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/deployments/README.md#list) - List all deployments
275
- * [get_config](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/deployments/README.md#get_config) - Get config
276
- * [stream](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/deployments/README.md#stream) - Stream
277
-
278
- #### [Deployments.Metrics](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/metrics/README.md)
279
-
280
- * [create](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/metrics/README.md#create) - Add metrics
281
-
282
- ### [Evals](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/evals/README.md)
283
-
284
- * [all](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/evals/README.md#all) - Get all Evaluators
285
- * [create](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/evals/README.md#create) - Create an Evaluator
286
- * [update](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/evals/README.md#update) - Update an Evaluator
287
- * [delete](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/evals/README.md#delete) - Delete an Evaluator
288
- * [invoke](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/evals/README.md#invoke) - Invoke a Custom Evaluator
289
-
290
- ### [Evaluators](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/evaluators/README.md)
291
-
292
- * [get_v2_evaluators_id_versions](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/evaluators/README.md#get_v2_evaluators_id_versions) - List evaluator versions
293
-
294
- ### [Feedback](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/feedback/README.md)
295
-
296
- * [create](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/feedback/README.md#create) - Submit feedback
297
-
298
- ### [Files](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/files/README.md)
299
-
300
- * [create](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/files/README.md#create) - Create file
301
- * [list](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/files/README.md#list) - List all files
302
- * [get](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/files/README.md#get) - Retrieve a file
303
- * [delete](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/files/README.md#delete) - Delete file
304
-
305
- ### [Identities](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/identities/README.md)
306
-
307
- * [list](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/identities/README.md#list) - List identities
308
- * [create](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/identities/README.md#create) - Create an identity
309
- * [retrieve](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/identities/README.md#retrieve) - Retrieve an identity
310
- * [update](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/identities/README.md#update) - Update an identity
311
- * [delete](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/identities/README.md#delete) - Delete an identity
312
-
313
- ### [Internal](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/internal/README.md)
314
-
315
- * [create_conversation_response](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/internal/README.md#create_conversation_response) - Create internal response
316
-
317
- ### [Knowledge](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/knowledge/README.md)
318
-
319
- * [list](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/knowledge/README.md#list) - List all knowledge bases
320
- * [create](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/knowledge/README.md#create) - Create a knowledge
321
- * [retrieve](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/knowledge/README.md#retrieve) - Retrieves a knowledge base
322
- * [update](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/knowledge/README.md#update) - Updates a knowledge
323
- * [delete](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/knowledge/README.md#delete) - Deletes a knowledge
324
- * [search](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/knowledge/README.md#search) - Search knowledge base
325
- * [list_datasources](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/knowledge/README.md#list_datasources) - List all datasources
326
- * [create_datasource](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/knowledge/README.md#create_datasource) - Create a new datasource
327
- * [retrieve_datasource](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/knowledge/README.md#retrieve_datasource) - Retrieve a datasource
328
- * [delete_datasource](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/knowledge/README.md#delete_datasource) - Deletes a datasource
329
- * [update_datasource](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/knowledge/README.md#update_datasource) - Update a datasource
330
- * [create_chunks](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/knowledge/README.md#create_chunks) - Create chunks for a datasource
331
- * [list_chunks](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/knowledge/README.md#list_chunks) - List all chunks for a datasource
332
- * [delete_chunks](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/knowledge/README.md#delete_chunks) - Delete multiple chunks
333
- * [list_chunks_paginated](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/knowledge/README.md#list_chunks_paginated) - List chunks with offset-based pagination
334
- * [get_chunks_count](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/knowledge/README.md#get_chunks_count) - Get chunks total count
335
- * [update_chunk](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/knowledge/README.md#update_chunk) - Update a chunk
336
- * [delete_chunk](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/knowledge/README.md#delete_chunk) - Delete a chunk
337
- * [retrieve_chunk](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/knowledge/README.md#retrieve_chunk) - Retrieve a chunk
338
-
339
- ### [MemoryStores](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/memorystores/README.md)
340
-
341
- * [list](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/memorystores/README.md#list) - List memory stores
342
- * [create](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/memorystores/README.md#create) - Create memory store
343
- * [retrieve](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/memorystores/README.md#retrieve) - Retrieve memory store
344
- * [update](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/memorystores/README.md#update) - Update memory store
345
- * [delete](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/memorystores/README.md#delete) - Delete memory store
346
- * [list_memories](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/memorystores/README.md#list_memories) - List all memories
347
- * [create_memory](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/memorystores/README.md#create_memory) - Create a new memory
348
- * [retrieve_memory](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/memorystores/README.md#retrieve_memory) - Retrieve a specific memory
349
- * [update_memory](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/memorystores/README.md#update_memory) - Update a specific memory
350
- * [delete_memory](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/memorystores/README.md#delete_memory) - Delete a specific memory
351
- * [list_documents](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/memorystores/README.md#list_documents) - List all documents for a memory
352
- * [create_document](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/memorystores/README.md#create_document) - Create a new memory document
353
- * [retrieve_document](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/memorystores/README.md#retrieve_document) - Retrieve a specific memory document
354
- * [update_document](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/memorystores/README.md#update_document) - Update a specific memory document
355
- * [delete_document](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/memorystores/README.md#delete_document) - Delete a specific memory document
356
-
357
- ### [Models](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/models/README.md)
358
-
359
- * [list](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/models/README.md#list) - List models
360
-
361
- ### [Prompts](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/prompts/README.md)
362
-
363
- * [list](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/prompts/README.md#list) - List all prompts
364
- * [create](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/prompts/README.md#create) - Create a prompt
365
- * [retrieve](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/prompts/README.md#retrieve) - Retrieve a prompt
366
- * [update](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/prompts/README.md#update) - Update a prompt
367
- * [delete](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/prompts/README.md#delete) - Delete a prompt
368
- * [list_versions](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/prompts/README.md#list_versions) - List all prompt versions
369
- * [get_version](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/prompts/README.md#get_version) - Retrieve a prompt version
370
-
371
- ### [Remoteconfigs](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/remoteconfigs/README.md)
372
-
373
- * [retrieve](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/remoteconfigs/README.md#retrieve) - Retrieve a remote config
374
-
375
- ### [Router](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/router/README.md)
376
-
377
- * [chat_completions](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/router/README.md#chat_completions) - Create chat completion
378
- * [images_generate](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/router/README.md#images_generate) - Create image
379
-
380
- ### [Tools](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/tools/README.md)
381
-
382
- * [list](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/tools/README.md#list) - List tools
383
- * [create](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/tools/README.md#create) - Create tool
384
- * [update](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/tools/README.md#update) - Update tool
385
- * [delete](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/tools/README.md#delete) - Delete tool
386
- * [retrieve](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/tools/README.md#retrieve) - Retrieve tool
387
- * [get_v2_tools_tool_id_versions](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/tools/README.md#get_v2_tools_tool_id_versions) - List tool versions
388
- * [get_v2_tools_tool_id_versions_version_id_](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/tools/README.md#get_v2_tools_tool_id_versions_version_id_) - Get tool version
389
-
390
- </details>
391
- <!-- End Available Resources and Operations [operations] -->
392
-
393
- <!-- Start Server-sent event streaming [eventstream] -->
394
- ## Server-sent event streaming
395
-
396
- [Server-sent events][mdn-sse] are used to stream content from certain
397
- operations. These operations will expose the stream as [Generator][generator] that
398
- can be consumed using a simple `for` loop. The loop will
399
- terminate when the server no longer has any events to send and closes the
400
- underlying connection.
401
-
402
- The stream is also a [Context Manager][context-manager] and can be used with the `with` statement and will close the
403
- underlying connection when the context is exited.
404
-
405
- ```python
406
- from orq_ai_sdk import Orq
407
- import os
408
-
409
-
410
- with Orq(
411
- environment="<value>",
412
- contact_id="<id>",
413
- api_key=os.getenv("ORQ_API_KEY", ""),
414
- ) as orq:
415
-
416
- res = orq.deployments.stream(key="<key>", documents=[
417
- {
418
- "text": "The refund policy allows customers to return items within 30 days of purchase for a full refund.",
419
- "metadata": {
420
- "file_name": "refund_policy.pdf",
421
- "file_type": "application/pdf",
422
- "page_number": 1,
423
- },
424
- },
425
- {
426
- "text": "Premium members receive free shipping on all orders over $50.",
427
- "metadata": {
428
- "file_name": "membership_benefits.md",
429
- "file_type": "text/markdown",
430
- },
431
- },
432
- ])
433
-
434
- with res as event_stream:
435
- for event in event_stream:
436
- # handle event
437
- print(event, flush=True)
438
-
439
- ```
440
-
441
- [mdn-sse]: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events
442
- [generator]: https://book.pythontips.com/en/latest/generators.html
443
- [context-manager]: https://book.pythontips.com/en/latest/context_managers.html
444
- <!-- End Server-sent event streaming [eventstream] -->
445
-
446
- <!-- Start File uploads [file-upload] -->
447
- ## File uploads
448
-
449
- Certain SDK methods accept file objects as part of a request body or multi-part request. It is possible and typically recommended to upload files as a stream rather than reading the entire contents into memory. This avoids excessive memory consumption and potentially crashing with out-of-memory errors when working with very large files. The following example demonstrates how to attach a file stream to a request.
450
-
451
- > [!TIP]
452
- >
453
- > For endpoints that handle file uploads bytes arrays can also be used. However, using streams is recommended for large files.
454
- >
455
-
456
- ```python
457
- from orq_ai_sdk import Orq
458
- import os
459
-
460
-
461
- with Orq(
462
- api_key=os.getenv("ORQ_API_KEY", ""),
463
- ) as orq:
464
-
465
- res = orq.files.create(file={
466
- "file_name": "example.file",
467
- "content": open("example.file", "rb"),
468
- }, purpose="retrieval")
469
-
470
- # Handle response
471
- print(res)
472
-
473
- ```
474
- <!-- End File uploads [file-upload] -->
475
-
476
- <!-- Start Retries [retries] -->
477
- ## Retries
478
-
479
- Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
480
-
481
- To change the default retry strategy for a single API call, simply provide a `RetryConfig` object to the call:
482
- ```python
483
- from orq_ai_sdk import Orq
484
- from orq_ai_sdk.utils import BackoffStrategy, RetryConfig
485
- import os
486
-
487
-
488
- with Orq(
489
- api_key=os.getenv("ORQ_API_KEY", ""),
490
- ) as orq:
491
-
492
- res = orq.feedback.create(field="rating", value=[
493
- "good",
494
- ], trace_id="67HTZ65Z9W91HSF51CW68KK1QH",
495
- RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False))
496
-
497
- # Handle response
498
- print(res)
499
-
500
- ```
501
-
502
- If you'd like to override the default retry strategy for all operations that support retries, you can use the `retry_config` optional parameter when initializing the SDK:
503
- ```python
504
- from orq_ai_sdk import Orq
505
- from orq_ai_sdk.utils import BackoffStrategy, RetryConfig
506
- import os
507
-
508
-
509
- with Orq(
510
- retry_config=RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False),
511
- api_key=os.getenv("ORQ_API_KEY", ""),
512
- ) as orq:
513
-
514
- res = orq.feedback.create(field="rating", value=[
515
- "good",
516
- ], trace_id="67HTZ65Z9W91HSF51CW68KK1QH")
517
-
518
- # Handle response
519
- print(res)
520
-
521
- ```
522
- <!-- End Retries [retries] -->
523
-
524
- <!-- Start Error Handling [errors] -->
525
- ## Error Handling
526
-
527
- [`OrqError`](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/./src/orq_ai_sdk/models/orqerror.py) is the base class for all HTTP error responses. It has the following properties:
528
-
529
- | Property | Type | Description |
530
- | ------------------ | ---------------- | --------------------------------------------------------------------------------------- |
531
- | `err.message` | `str` | Error message |
532
- | `err.status_code` | `int` | HTTP response status code eg `404` |
533
- | `err.headers` | `httpx.Headers` | HTTP response headers |
534
- | `err.body` | `str` | HTTP body. Can be empty string if no body is returned. |
535
- | `err.raw_response` | `httpx.Response` | Raw HTTP response |
536
- | `err.data` | | Optional. Some errors may contain structured data. [See Error Classes](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/#error-classes). |
537
-
538
- ### Example
539
- ```python
540
- from orq_ai_sdk import Orq, models
541
- import os
542
-
543
-
544
- with Orq(
545
- api_key=os.getenv("ORQ_API_KEY", ""),
546
- ) as orq:
547
- res = None
548
- try:
549
-
550
- res = orq.evals.all(limit=10)
551
-
552
- # Handle response
553
- print(res)
554
-
555
-
556
- except models.OrqError as e:
557
- # The base class for HTTP error responses
558
- print(e.message)
559
- print(e.status_code)
560
- print(e.body)
561
- print(e.headers)
562
- print(e.raw_response)
563
-
564
- # Depending on the method different errors may be thrown
565
- if isinstance(e, models.GetEvalsEvalsResponseBody):
566
- print(e.data.message) # str
567
- ```
568
-
569
- ### Error Classes
570
- **Primary error:**
571
- * [`OrqError`](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/./src/orq_ai_sdk/models/orqerror.py): The base class for HTTP error responses.
572
-
573
- <details><summary>Less common errors (35)</summary>
574
-
575
- <br />
576
-
577
- **Network errors:**
578
- * [`httpx.RequestError`](https://www.python-httpx.org/exceptions/#httpx.RequestError): Base class for request errors.
579
- * [`httpx.ConnectError`](https://www.python-httpx.org/exceptions/#httpx.ConnectError): HTTP client was unable to make a request to a server.
580
- * [`httpx.TimeoutException`](https://www.python-httpx.org/exceptions/#httpx.TimeoutException): HTTP request timed out.
581
-
582
-
583
- **Inherit from [`OrqError`](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/./src/orq_ai_sdk/models/orqerror.py)**:
584
- * [`HonoAPIError`](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/./src/orq_ai_sdk/models/honoapierror.py): Applicable to 9 of 108 methods.*
585
- * [`GenerateConversationNameConversationsResponseBody`](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/./src/orq_ai_sdk/models/generateconversationnameconversationsresponsebody.py): Conversation already has a display name. This endpoint only generates names for conversations with empty display names. Status code `400`. Applicable to 1 of 108 methods.*
586
- * [`RetrieveContactContactsResponseBody`](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/./src/orq_ai_sdk/models/retrievecontactcontactsresponsebody.py): Contact not found. Status code `404`. Applicable to 1 of 108 methods.*
587
- * [`UpdateContactContactsResponseBody`](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/./src/orq_ai_sdk/models/updatecontactcontactsresponsebody.py): Contact not found. Status code `404`. Applicable to 1 of 108 methods.*
588
- * [`DeleteContactResponseBody`](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/./src/orq_ai_sdk/models/deletecontactresponsebody.py): Contact not found. Status code `404`. Applicable to 1 of 108 methods.*
589
- * [`GetEvalsEvalsResponseBody`](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/./src/orq_ai_sdk/models/getevalsevalsresponsebody.py): Workspace ID is not found on the request. Status code `404`. Applicable to 1 of 108 methods.*
590
- * [`CreateEvalEvalsResponseBody`](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/./src/orq_ai_sdk/models/createevalevalsresponsebody.py): Workspace ID is not found on the request. Status code `404`. Applicable to 1 of 108 methods.*
591
- * [`UpdateEvalEvalsResponseBody`](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/./src/orq_ai_sdk/models/updateevalevalsresponsebody.py): Workspace ID is not found on the request. Status code `404`. Applicable to 1 of 108 methods.*
592
- * [`DeleteEvalResponseBody`](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/./src/orq_ai_sdk/models/deleteevalresponsebody.py): Workspace ID is not found on the request. Status code `404`. Applicable to 1 of 108 methods.*
593
- * [`InvokeEvalEvalsResponseBody`](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/./src/orq_ai_sdk/models/invokeevalevalsresponsebody.py): Workspace ID is not found on the request. Status code `404`. Applicable to 1 of 108 methods.*
594
- * [`GetV2EvaluatorsIDVersionsEvaluatorsResponseBody`](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/./src/orq_ai_sdk/models/getv2evaluatorsidversionsevaluatorsresponsebody.py): Evaluator not found. Status code `404`. Applicable to 1 of 108 methods.*
595
- * [`RetrieveIdentityIdentitiesResponseBody`](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/./src/orq_ai_sdk/models/retrieveidentityidentitiesresponsebody.py): Identity not found. Status code `404`. Applicable to 1 of 108 methods.*
596
- * [`UpdateIdentityIdentitiesResponseBody`](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/./src/orq_ai_sdk/models/updateidentityidentitiesresponsebody.py): Identity not found. Status code `404`. Applicable to 1 of 108 methods.*
597
- * [`DeleteIdentityResponseBody`](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/./src/orq_ai_sdk/models/deleteidentityresponsebody.py): Identity not found. Status code `404`. Applicable to 1 of 108 methods.*
598
- * [`DeleteAgentResponseBody`](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/./src/orq_ai_sdk/models/deleteagentresponsebody.py): Agent not found. The specified agent key does not exist in the workspace or has already been deleted. Status code `404`. Applicable to 1 of 108 methods.*
599
- * [`RetrieveAgentRequestAgentsResponseBody`](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/./src/orq_ai_sdk/models/retrieveagentrequestagentsresponsebody.py): Agent not found. The specified agent key does not exist in the workspace or you do not have permission to access it. Status code `404`. Applicable to 1 of 108 methods.*
600
- * [`UpdateAgentAgentsResponseBody`](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/./src/orq_ai_sdk/models/updateagentagentsresponsebody.py): Agent not found. The specified agent key does not exist in the workspace or you do not have permission to modify it. Status code `404`. Applicable to 1 of 108 methods.*
601
- * [`StreamRunAgentAgentsResponseBody`](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/./src/orq_ai_sdk/models/streamrunagentagentsresponsebody.py): Model not found. Status code `404`. Applicable to 1 of 108 methods.*
602
- * [`StreamAgentAgentsResponseBody`](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/./src/orq_ai_sdk/models/streamagentagentsresponsebody.py): Agent not found. Status code `404`. Applicable to 1 of 108 methods.*
603
- * [`GenerateConversationNameConversationsResponseResponseBody`](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/./src/orq_ai_sdk/models/generateconversationnameconversationsresponseresponsebody.py): Conversation not found. Status code `404`. Applicable to 1 of 108 methods.*
604
- * [`RetrieveConversationResponseBody`](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/./src/orq_ai_sdk/models/retrieveconversationresponsebody.py): Conversation not found. The specified conversation ID does not exist in the workspace or you do not have permission to access it. Status code `404`. Applicable to 1 of 108 methods.*
605
- * [`UpdateConversationConversationsResponseBody`](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/./src/orq_ai_sdk/models/updateconversationconversationsresponsebody.py): Conversation not found. The specified conversation ID does not exist in the workspace or you do not have permission to modify it. Status code `404`. Applicable to 1 of 108 methods.*
606
- * [`DeleteConversationResponseBody`](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/./src/orq_ai_sdk/models/deleteconversationresponsebody.py): Conversation not found. The specified conversation ID does not exist in the workspace or has already been deleted. Status code `404`. Applicable to 1 of 108 methods.*
607
- * [`UpdatePromptResponseBody`](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/./src/orq_ai_sdk/models/updatepromptresponsebody.py): Prompt not found. Status code `404`. Applicable to 1 of 108 methods.*
608
- * [`DeletePromptResponseBody`](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/./src/orq_ai_sdk/models/deletepromptresponsebody.py): Prompt not found. Status code `404`. Applicable to 1 of 108 methods.*
609
- * [`GetPromptVersionPromptsResponseBody`](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/./src/orq_ai_sdk/models/getpromptversionpromptsresponsebody.py): Not Found - The prompt or prompt version does not exist. Status code `404`. Applicable to 1 of 108 methods.*
610
- * [`UpdateToolToolsResponseBody`](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/./src/orq_ai_sdk/models/updatetooltoolsresponsebody.py): Tool not found. Status code `404`. Applicable to 1 of 108 methods.*
611
- * [`GetV2ToolsToolIDVersionsToolsResponseBody`](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/./src/orq_ai_sdk/models/getv2toolstoolidversionstoolsresponsebody.py): Tool not found. Status code `404`. Applicable to 1 of 108 methods.*
612
- * [`GetV2ToolsToolIDVersionsVersionIDToolsResponseBody`](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/./src/orq_ai_sdk/models/getv2toolstoolidversionsversionidtoolsresponsebody.py): Tool or version not found. Status code `404`. Applicable to 1 of 108 methods.*
613
- * [`InvokeEvalEvalsResponseResponseBody`](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/./src/orq_ai_sdk/models/invokeevalevalsresponseresponsebody.py): Error running the evaluator. Status code `500`. Applicable to 1 of 108 methods.*
614
- * [`ResponseValidationError`](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/./src/orq_ai_sdk/models/responsevalidationerror.py): Type mismatch between the response data and the expected Pydantic model. Provides access to the Pydantic validation error via the `cause` attribute.
615
-
616
- </details>
617
-
618
- \* Check [the method documentation](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/#available-resources-and-operations) to see if the error is applicable.
619
- <!-- End Error Handling [errors] -->
620
-
621
- <!-- Start Server Selection [server] -->
622
- ## Server Selection
623
-
624
- ### Override Server URL Per-Client
625
-
626
- The default server can be overridden globally by passing a URL to the `server_url: str` optional parameter when initializing the SDK client instance. For example:
627
- ```python
628
- from orq_ai_sdk import Orq
629
- import os
630
-
631
-
632
- with Orq(
633
- server_url="https://my.orq.ai",
634
- api_key=os.getenv("ORQ_API_KEY", ""),
635
- ) as orq:
636
-
637
- res = orq.feedback.create(field="rating", value=[
638
- "good",
639
- ], trace_id="67HTZ65Z9W91HSF51CW68KK1QH")
640
-
641
- # Handle response
642
- print(res)
643
-
644
- ```
645
- <!-- End Server Selection [server] -->
646
-
647
- <!-- Start Custom HTTP Client [http-client] -->
648
- ## Custom HTTP Client
649
-
650
- The Python SDK makes API calls using the [httpx](https://www.python-httpx.org/) HTTP library. In order to provide a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration, you can initialize the SDK client with your own HTTP client instance.
651
- Depending on whether you are using the sync or async version of the SDK, you can pass an instance of `HttpClient` or `AsyncHttpClient` respectively, which are Protocol's ensuring that the client has the necessary methods to make API calls.
652
- This allows you to wrap the client with your own custom logic, such as adding custom headers, logging, or error handling, or you can just pass an instance of `httpx.Client` or `httpx.AsyncClient` directly.
653
-
654
- For example, you could specify a header for every request that this sdk makes as follows:
655
- ```python
656
- from orq_ai_sdk import Orq
657
- import httpx
658
-
659
- http_client = httpx.Client(headers={"x-custom-header": "someValue"})
660
- s = Orq(client=http_client)
661
- ```
662
-
663
- or you could wrap the client with your own custom logic:
664
- ```python
665
- from orq_ai_sdk import Orq
666
- from orq_ai_sdk.httpclient import AsyncHttpClient
667
- import httpx
668
-
669
- class CustomClient(AsyncHttpClient):
670
- client: AsyncHttpClient
671
-
672
- def __init__(self, client: AsyncHttpClient):
673
- self.client = client
674
-
675
- async def send(
676
- self,
677
- request: httpx.Request,
678
- *,
679
- stream: bool = False,
680
- auth: Union[
681
- httpx._types.AuthTypes, httpx._client.UseClientDefault, None
682
- ] = httpx.USE_CLIENT_DEFAULT,
683
- follow_redirects: Union[
684
- bool, httpx._client.UseClientDefault
685
- ] = httpx.USE_CLIENT_DEFAULT,
686
- ) -> httpx.Response:
687
- request.headers["Client-Level-Header"] = "added by client"
688
-
689
- return await self.client.send(
690
- request, stream=stream, auth=auth, follow_redirects=follow_redirects
691
- )
692
-
693
- def build_request(
694
- self,
695
- method: str,
696
- url: httpx._types.URLTypes,
697
- *,
698
- content: Optional[httpx._types.RequestContent] = None,
699
- data: Optional[httpx._types.RequestData] = None,
700
- files: Optional[httpx._types.RequestFiles] = None,
701
- json: Optional[Any] = None,
702
- params: Optional[httpx._types.QueryParamTypes] = None,
703
- headers: Optional[httpx._types.HeaderTypes] = None,
704
- cookies: Optional[httpx._types.CookieTypes] = None,
705
- timeout: Union[
706
- httpx._types.TimeoutTypes, httpx._client.UseClientDefault
707
- ] = httpx.USE_CLIENT_DEFAULT,
708
- extensions: Optional[httpx._types.RequestExtensions] = None,
709
- ) -> httpx.Request:
710
- return self.client.build_request(
711
- method,
712
- url,
713
- content=content,
714
- data=data,
715
- files=files,
716
- json=json,
717
- params=params,
718
- headers=headers,
719
- cookies=cookies,
720
- timeout=timeout,
721
- extensions=extensions,
722
- )
723
-
724
- s = Orq(async_client=CustomClient(httpx.AsyncClient()))
725
- ```
726
- <!-- End Custom HTTP Client [http-client] -->
727
-
728
- <!-- Start Resource Management [resource-management] -->
729
- ## Resource Management
730
-
731
- The `Orq` class implements the context manager protocol and registers a finalizer function to close the underlying sync and async HTTPX clients it uses under the hood. This will close HTTP connections, release memory and free up other resources held by the SDK. In short-lived Python programs and notebooks that make a few SDK method calls, resource management may not be a concern. However, in longer-lived programs, it is beneficial to create a single SDK instance via a [context manager][context-manager] and reuse it across the application.
732
-
733
- [context-manager]: https://docs.python.org/3/reference/datamodel.html#context-managers
734
-
735
- ```python
736
- from orq_ai_sdk import Orq
737
- import os
738
- def main():
739
-
740
- with Orq(
741
- api_key=os.getenv("ORQ_API_KEY", ""),
742
- ) as orq:
743
- # Rest of application here...
744
-
745
-
746
- # Or when using async:
747
- async def amain():
748
-
749
- async with Orq(
750
- api_key=os.getenv("ORQ_API_KEY", ""),
751
- ) as orq:
752
- # Rest of application here...
753
- ```
754
- <!-- End Resource Management [resource-management] -->
755
-
756
- <!-- Start Debugging [debug] -->
757
- ## Debugging
758
-
759
- You can setup your SDK to emit debug logs for SDK requests and responses.
760
-
761
- You can pass your own logger class directly into your SDK.
762
- ```python
763
- from orq_ai_sdk import Orq
764
- import logging
765
-
766
- logging.basicConfig(level=logging.DEBUG)
767
- s = Orq(debug_logger=logging.getLogger("orq_ai_sdk"))
768
- ```
769
-
770
- You can also enable a default debug logger by setting an environment variable `ORQ_DEBUG` to true.
771
- <!-- End Debugging [debug] -->
772
-
773
- <!-- Placeholder for Future Speakeasy SDK Sections -->
774
-
775
- # Development
776
-
777
- ## Maturity
778
-
779
- This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage
780
- to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally
781
- looking for the latest version.
782
-
783
- ## Contributions
784
-
785
- While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation.
786
- We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.
787
-
788
- ### SDK Created by [Speakeasy](https://www.speakeasy.com/?utm_source=orq-ai-sdk&utm_campaign=python)