Skip to content

Latest commit

 

History

History
174 lines (110 loc) · 14 KB

README.md

File metadata and controls

174 lines (110 loc) · 14 KB

Files

(files)

Overview

Available Operations

create

Files are used to upload documents that can be used with features like Deployments.

Example Usage

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)

Parameters

Parameter Type Required Description
file models.File ✔️ The file to be uploaded.
purpose Optional[models.Purpose] The intended purpose of the uploaded file.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.FileUploadResponseBody

Errors

Error Type Status Code Content Type
models.APIError 4XX, 5XX */*

list

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.

Example Usage

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)

Parameters

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.

Response

models.FileListResponseBody

Errors

Error Type Status Code Content Type
models.APIError 4XX, 5XX */*

get

Retrieves the details of an existing file object. After you supply a unique file ID, orq.ai returns the corresponding file object

Example Usage

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)

Parameters

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.

Response

models.FileGetResponseBody

Errors

Error Type Status Code Content Type
models.APIError 4XX, 5XX */*

delete

Delete file

Example Usage

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 ...

Parameters

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.

Errors

Error Type Status Code Content Type
models.APIError 4XX, 5XX */*