(files)
Files are used to upload documents that can be used with features like Deployments.
from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.files.create(file={
"file_name": "example.file",
"content": open("example.file", "rb"),
})
assert res is not None
# Handle response
print(res)
models.FileUploadResponseBody
Error Type |
Status Code |
Content Type |
models.APIError |
4XX, 5XX |
*/* |
Returns a list of the files that your account has access to. orq.ai sorts and returns the files by their creation dates, placing the most recently created files at the top.
from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.files.list()
assert res is not None
# Handle response
print(res)
Parameter |
Type |
Required |
Description |
limit |
Optional[float] |
➖ |
A limit on the number of objects to be returned. Limit can range between 1 and 50, and the default is 10 |
starting_after |
Optional[str] |
➖ |
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. |
ending_before |
Optional[str] |
➖ |
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. |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.FileListResponseBody
Error Type |
Status Code |
Content Type |
models.APIError |
4XX, 5XX |
*/* |
Retrieves the details of an existing file object. After you supply a unique file ID, orq.ai returns the corresponding file object
from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.files.get(file_id="<id>")
assert res is not None
# Handle response
print(res)
Parameter |
Type |
Required |
Description |
file_id |
str |
✔️ |
The ID of the file |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.FileGetResponseBody
Error Type |
Status Code |
Content Type |
models.APIError |
4XX, 5XX |
*/* |
Delete file
from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
orq.files.delete(file_id="<id>")
# Use the SDK ...
Parameter |
Type |
Required |
Description |
file_id |
str |
✔️ |
The ID of the file |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
Error Type |
Status Code |
Content Type |
models.APIError |
4XX, 5XX |
*/* |