Skip to main content

Files

List Files

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(limit=10)

    # Handle response
    print(res)

Create a File

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(purpose=retrieval)

    # Handle response
    print(res)

Get Content

Returns a presigned URL for downloading the file content by file ID.
from orq_ai_sdk import Orq
import os

with Orq(
    api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:

    res = orq.files.get_content(file_id_or_path="<value>")

    # Handle response
    print(res)

Retrieve a File

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>")

    # Handle response
    print(res)

Delete a File

Delete a file
from orq_ai_sdk import Orq
import os

with Orq(
    api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:

    res = orq.files.delete(file_id="<id>")

    # Handle response
    print(res)

Update a File

Updates the metadata of an existing file object.
from orq_ai_sdk import Orq
import os

with Orq(
    api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:

    res = orq.files.update(file_id_param="<id>")

    # Handle response
    print(res)