orq-ai-sdk 4.4.0rc24
Python Client SDK for the Orq API.
Requires Python: >=3.10

# orq-ai-sdk

Developer-friendly & type-safe Python SDK specifically catered to leverage *orq-ai-sdk* API.

<div align="left">
    <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>
    <a href="https://opensource.org/licenses/MIT">
        <img src="https://img.shields.io/badge/License-MIT-blue.svg" style="width: 100px; height: 28px;" />
    </a>
</div>

<!-- Start Summary [summary] -->
## Summary

orq.ai API: orq.ai API documentation

For more information about the API: [orq.ai Documentation](https://docs.orq.ai)
<!-- End Summary [summary] -->

<!-- Start Table of Contents [toc] -->
## Table of Contents
<!-- $toc-max-depth=2 -->
* [orq-ai-sdk](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/#orq-ai-sdk)
  * [SDK Installation](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/#sdk-installation)
  * [IDE Support](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/#ide-support)
  * [SDK Example Usage](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/#sdk-example-usage)
  * [Authentication](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/#authentication)
  * [Available Resources and Operations](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/#available-resources-and-operations)
  * [Server-sent event streaming](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/#server-sent-event-streaming)
  * [File uploads](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/#file-uploads)
  * [Retries](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/#retries)
  * [Error Handling](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/#error-handling)
  * [Server Selection](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/#server-selection)
  * [Custom HTTP Client](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/#custom-http-client)
  * [Resource Management](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/#resource-management)
  * [Debugging](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/#debugging)
* [Development](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/#development)
  * [Maturity](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/#maturity)
  * [Contributions](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/#contributions)

<!-- End Table of Contents [toc] -->

<!-- Start SDK Installation [installation] -->
## SDK Installation

> [!NOTE]
> **Python version upgrade policy**
>
> 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.

The SDK can be installed with *uv*, *pip*, or *poetry* package managers.

### uv

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

```bash
uv add orq-ai-sdk
```

### PIP

*PIP* is the default package installer for Python, enabling easy installation and management of packages from PyPI via the command line.

```bash
pip install orq-ai-sdk
```

### Poetry

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

```bash
poetry add orq-ai-sdk
```

### Shell and script usage with `uv`

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:

```shell
uvx --from orq-ai-sdk python
```

It's also possible to write a standalone Python script without needing to set up a whole project like so:

```python
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.10"
# dependencies = [
#     "orq-ai-sdk",
# ]
# ///

from orq_ai_sdk import Orq

sdk = Orq(
  # SDK arguments
)

# Rest of script here...
```

Once that is saved to a file, you can run it with `uv run script.py` where
`script.py` can be replaced with the actual file name.
<!-- End SDK Installation [installation] -->

<!-- Start IDE Support [idesupport] -->
## IDE Support

### PyCharm

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.

- [PyCharm Pydantic Plugin](https://docs.pydantic.dev/latest/integrations/pycharm/)
<!-- End IDE Support [idesupport] -->

<!-- Start SDK Example Usage [usage] -->
## SDK Example Usage

### Example

```python
# Synchronous Example
from orq_ai_sdk import Orq
import os


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

    res = orq.contacts.create(external_id="user_12345", display_name="Jane Smith", email="jane.smith@example.com", avatar_url="https://example.com/avatars/jane-smith.jpg", tags=[
        "premium",
        "beta-user",
        "enterprise",
    ], metadata={
        "department": "Engineering",
        "role": "Senior Developer",
        "subscription_tier": "premium",
        "last_login": "2024-01-15T10:30:00Z",
    })

    # Handle response
    print(res)
```

</br>

The same SDK client can also be used to make asynchronous requests by importing asyncio.

```python
# Asynchronous Example
import asyncio
from orq_ai_sdk import Orq
import os

async def main():

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

        res = await orq.contacts.create_async(external_id="user_12345", display_name="Jane Smith", email="jane.smith@example.com", avatar_url="https://example.com/avatars/jane-smith.jpg", tags=[
            "premium",
            "beta-user",
            "enterprise",
        ], metadata={
            "department": "Engineering",
            "role": "Senior Developer",
            "subscription_tier": "premium",
            "last_login": "2024-01-15T10:30:00Z",
        })

        # Handle response
        print(res)

asyncio.run(main())
```
<!-- End SDK Example Usage [usage] -->

<!-- Start Authentication [security] -->
## Authentication

### Per-Client Security Schemes

This SDK supports the following security scheme globally:

| Name      | Type | Scheme      | Environment Variable |
| --------- | ---- | ----------- | -------------------- |
| `api_key` | http | HTTP Bearer | `ORQ_API_KEY`        |

To authenticate with the API the `api_key` parameter must be set when initializing the SDK client instance. For example:
```python
from orq_ai_sdk import Orq
import os


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

    res = orq.contacts.create(external_id="user_12345", display_name="Jane Smith", email="jane.smith@example.com", avatar_url="https://example.com/avatars/jane-smith.jpg", tags=[
        "premium",
        "beta-user",
        "enterprise",
    ], metadata={
        "department": "Engineering",
        "role": "Senior Developer",
        "subscription_tier": "premium",
        "last_login": "2024-01-15T10:30:00Z",
    })

    # Handle response
    print(res)

```
<!-- End Authentication [security] -->

<!-- Start Available Resources and Operations [operations] -->
## Available Resources and Operations

<details open>
<summary>Available methods</summary>

### [Agents](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/agents/README.md)

* [create](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/agents/README.md#create) - Create agent
* [list](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/agents/README.md#list) - List agents
* [delete](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/agents/README.md#delete) - Delete agent
* [retrieve](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/agents/README.md#retrieve) - Retrieve agent
* [update](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/agents/README.md#update) - Update agent
* [~~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**
* [~~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**
* [~~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**
* [~~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**

#### [Agents.Responses](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/responses/README.md)

* [create](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/responses/README.md#create) - Create response

### [Chunking](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/chunking/README.md)

* [parse](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/chunking/README.md#parse) - Parse text

### [Contacts](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/contacts/README.md)

* [create](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/contacts/README.md#create) - Update user information

### [Conversations](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/conversations/README.md)

* [list](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/conversations/README.md#list) - List conversations
* [create](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/conversations/README.md#create) - Create conversation
* [generate_name](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/conversations/README.md#generate_name) - Generate conversation name
* [retrieve](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/conversations/README.md#retrieve) - Retrieve conversation
* [update](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/conversations/README.md#update) - Update conversation
* [delete](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/conversations/README.md#delete) - Delete conversation
* [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

### [Datasets](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/datasets/README.md)

* [list](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/datasets/README.md#list) - List datasets
* [create](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/datasets/README.md#create) - Create a dataset
* [retrieve](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/datasets/README.md#retrieve) - Retrieve a dataset
* [update](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/datasets/README.md#update) - Update a dataset
* [delete](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/datasets/README.md#delete) - Delete a dataset
* [list_datapoints](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/datasets/README.md#list_datapoints) - List datapoints
* [create_datapoint](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/datasets/README.md#create_datapoint) - Create a datapoint
* [retrieve_datapoint](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/datasets/README.md#retrieve_datapoint) - Retrieve a datapoint
* [update_datapoint](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/datasets/README.md#update_datapoint) - Update a datapoint
* [delete_datapoint](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/datasets/README.md#delete_datapoint) - Delete a datapoint
* [clear](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/datasets/README.md#clear) - Delete all datapoints

### [Deployments](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/deployments/README.md)

* [invoke](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/deployments/README.md#invoke) - Invoke
* [list](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/deployments/README.md#list) - List all deployments
* [get_config](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/deployments/README.md#get_config) - Get config
* [stream](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/deployments/README.md#stream) - Stream

#### [Deployments.Metrics](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/metrics/README.md)

* [create](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/metrics/README.md#create) - Add metrics

### [Evals](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/evals/README.md)

* [all](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/evals/README.md#all) - Get all Evaluators
* [create](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/evals/README.md#create) - Create an Evaluator
* [update](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/evals/README.md#update) - Update an Evaluator
* [delete](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/evals/README.md#delete) - Delete an Evaluator
* [invoke](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/evals/README.md#invoke) - Invoke a Custom Evaluator

### [Evaluators](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/evaluators/README.md)

* [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

### [Feedback](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/feedback/README.md)

* [create](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/feedback/README.md#create) - Submit feedback

### [Files](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/files/README.md)

* [create](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/files/README.md#create) - Create file
* [list](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/files/README.md#list) - List all files
* [get](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/files/README.md#get) - Retrieve a file
* [delete](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/files/README.md#delete) - Delete file

### [Identities](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/identities/README.md)

* [list](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/identities/README.md#list) - List identities
* [create](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/identities/README.md#create) - Create an identity
* [retrieve](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/identities/README.md#retrieve) - Retrieve an identity
* [update](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/identities/README.md#update) - Update an identity
* [delete](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/identities/README.md#delete) - Delete an identity

### [Internal](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/internal/README.md)

* [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

### [Knowledge](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/knowledge/README.md)

* [list](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/knowledge/README.md#list) - List all knowledge bases
* [create](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/knowledge/README.md#create) - Create a knowledge
* [retrieve](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/knowledge/README.md#retrieve) - Retrieves a knowledge base
* [update](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/knowledge/README.md#update) - Updates a knowledge
* [delete](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/knowledge/README.md#delete) - Deletes a knowledge
* [search](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/knowledge/README.md#search) - Search knowledge base
* [list_datasources](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/knowledge/README.md#list_datasources) - List all datasources
* [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
* [retrieve_datasource](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/knowledge/README.md#retrieve_datasource) - Retrieve a datasource
* [delete_datasource](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/knowledge/README.md#delete_datasource) - Deletes a datasource
* [update_datasource](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/knowledge/README.md#update_datasource) - Update a datasource
* [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
* [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
* [delete_chunks](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/knowledge/README.md#delete_chunks) - Delete multiple chunks
* [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
* [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
* [update_chunk](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/knowledge/README.md#update_chunk) - Update a chunk
* [delete_chunk](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/knowledge/README.md#delete_chunk) - Delete a chunk
* [retrieve_chunk](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/knowledge/README.md#retrieve_chunk) - Retrieve a chunk

### [MemoryStores](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/memorystores/README.md)

* [list](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/memorystores/README.md#list) - List memory stores
* [create](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/memorystores/README.md#create) - Create memory store
* [retrieve](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/memorystores/README.md#retrieve) - Retrieve memory store
* [update](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/memorystores/README.md#update) - Update memory store
* [delete](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/memorystores/README.md#delete) - Delete memory store
* [list_memories](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/memorystores/README.md#list_memories) - List all memories
* [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
* [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
* [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
* [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
* [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
* [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
* [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
* [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
* [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

### [Models](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/models/README.md)

* [list](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/models/README.md#list) - List models

### [Prompts](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/prompts/README.md)

* [list](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/prompts/README.md#list) - List all prompts
* [create](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/prompts/README.md#create) - Create a prompt
* [retrieve](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/prompts/README.md#retrieve) - Retrieve a prompt
* [update](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/prompts/README.md#update) - Update a prompt
* [delete](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/prompts/README.md#delete) - Delete a prompt
* [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
* [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

### [Remoteconfigs](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/remoteconfigs/README.md)

* [retrieve](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/remoteconfigs/README.md#retrieve) - Retrieve a remote config

### [Router](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/router/README.md)

* [ocr](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/router/README.md#ocr) - Extracts text content while maintaining document structure and hierarchy

#### [Router.Audio.Speech](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/speech/README.md)

* [create](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/speech/README.md#create) - Create speech

#### [Router.Audio.Transcriptions](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/transcriptions/README.md)

* [create](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/transcriptions/README.md#create) - Create transcription

#### [Router.Audio.Translations](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/translations/README.md)

* [create](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/translations/README.md#create) - Create translation

#### [Router.Chat.Completions](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/orqcompletions/README.md)

* [create](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/orqcompletions/README.md#create) - Create chat completion

#### [Router.Completions](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/completions/README.md)

* [create](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/completions/README.md#create) - Create completion

#### [Router.Embeddings](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/embeddings/README.md)

* [create](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/embeddings/README.md#create) - Create embeddings

#### [Router.Images.Edits](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/edits/README.md)

* [create](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/edits/README.md#create) - Create image edit

#### [Router.Images.Generations](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/generations/README.md)

* [create](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/generations/README.md#create) - Create image

#### [Router.Images.Variations](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/variations/README.md)

* [create](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/variations/README.md#create) - Create image variation

#### [Router.Moderations](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/moderations/README.md)

* [create](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/moderations/README.md#create) - Create moderation

#### [Router.Rerank](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/rerank/README.md)

* [create](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/rerank/README.md#create) - Create rerank

#### [Router.Responses](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/orqresponses/README.md)

* [create](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/orqresponses/README.md#create) - Create response

### [Tools](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/tools/README.md)

* [list](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/tools/README.md#list) - List tools
* [create](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/tools/README.md#create) - Create tool
* [update](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/tools/README.md#update) - Update tool
* [delete](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/tools/README.md#delete) - Delete tool
* [retrieve](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/docs/sdks/tools/README.md#retrieve) - Retrieve tool
* [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
* [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

</details>
<!-- End Available Resources and Operations [operations] -->

<!-- Start Server-sent event streaming [eventstream] -->
## Server-sent event streaming

[Server-sent events][mdn-sse] are used to stream content from certain
operations. These operations will expose the stream as [Generator][generator] that
can be consumed using a simple `for` loop. The loop will
terminate when the server no longer has any events to send and closes the
underlying connection.  

The stream is also a [Context Manager][context-manager] and can be used with the `with` statement and will close the
underlying connection when the context is exited.

```python
from orq_ai_sdk import Orq
import os


with Orq(
    environment="<value>",
    contact_id="<id>",
    api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:

    res = orq.deployments.stream(key="<key>", identity={
        "id": "contact_01ARZ3NDEKTSV4RRFFQ69G5FAV",
        "display_name": "Jane Doe",
        "email": "jane.doe@example.com",
        "metadata": [
            {
                "department": "Engineering",
                "role": "Senior Developer",
            },
        ],
        "logo_url": "https://example.com/avatars/jane-doe.jpg",
        "tags": [
            "hr",
            "engineering",
        ],
    }, documents=[
        {
            "text": "The refund policy allows customers to return items within 30 days of purchase for a full refund.",
            "metadata": {
                "file_name": "refund_policy.pdf",
                "file_type": "application/pdf",
                "page_number": 1,
            },
        },
        {
            "text": "Premium members receive free shipping on all orders over $50.",
            "metadata": {
                "file_name": "membership_benefits.md",
                "file_type": "text/markdown",
            },
        },
    ])

    with res as event_stream:
        for event in event_stream:
            # handle event
            print(event, flush=True)

```

[mdn-sse]: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events
[generator]: https://book.pythontips.com/en/latest/generators.html
[context-manager]: https://book.pythontips.com/en/latest/context_managers.html
<!-- End Server-sent event streaming [eventstream] -->

<!-- Start File uploads [file-upload] -->
## File uploads

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.

> [!TIP]
>
> For endpoints that handle file uploads bytes arrays can also be used. However, using streams is recommended for large files.
>

```python
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"),
    }, purpose="retrieval")

    # Handle response
    print(res)

```
<!-- End File uploads [file-upload] -->

<!-- Start Retries [retries] -->
## Retries

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.

To change the default retry strategy for a single API call, simply provide a `RetryConfig` object to the call:
```python
from orq_ai_sdk import Orq
from orq_ai_sdk.utils import BackoffStrategy, RetryConfig
import os


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

    res = orq.contacts.create(external_id="user_12345", display_name="Jane Smith", email="jane.smith@example.com", avatar_url="https://example.com/avatars/jane-smith.jpg", tags=[
        "premium",
        "beta-user",
        "enterprise",
    ], metadata={
        "department": "Engineering",
        "role": "Senior Developer",
        "subscription_tier": "premium",
        "last_login": "2024-01-15T10:30:00Z",
    },
        RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False))

    # Handle response
    print(res)

```

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:
```python
from orq_ai_sdk import Orq
from orq_ai_sdk.utils import BackoffStrategy, RetryConfig
import os


with Orq(
    retry_config=RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False),
    api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:

    res = orq.contacts.create(external_id="user_12345", display_name="Jane Smith", email="jane.smith@example.com", avatar_url="https://example.com/avatars/jane-smith.jpg", tags=[
        "premium",
        "beta-user",
        "enterprise",
    ], metadata={
        "department": "Engineering",
        "role": "Senior Developer",
        "subscription_tier": "premium",
        "last_login": "2024-01-15T10:30:00Z",
    })

    # Handle response
    print(res)

```
<!-- End Retries [retries] -->

<!-- Start Error Handling [errors] -->
## Error Handling

[`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:

| Property           | Type             | Description                                                                             |
| ------------------ | ---------------- | --------------------------------------------------------------------------------------- |
| `err.message`      | `str`            | Error message                                                                           |
| `err.status_code`  | `int`            | HTTP response status code eg `404`                                                      |
| `err.headers`      | `httpx.Headers`  | HTTP response headers                                                                   |
| `err.body`         | `str`            | HTTP body. Can be empty string if no body is returned.                                  |
| `err.raw_response` | `httpx.Response` | Raw HTTP response                                                                       |
| `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). |

### Example
```python
from orq_ai_sdk import Orq, models
import os


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

        res = orq.evals.all(limit=10)

        # Handle response
        print(res)


    except models.OrqError as e:
        # The base class for HTTP error responses
        print(e.message)
        print(e.status_code)
        print(e.body)
        print(e.headers)
        print(e.raw_response)

        # Depending on the method different errors may be thrown
        if isinstance(e, models.GetEvalsEvalsResponseBody):
            print(e.data.message)  # str
```

### Error Classes
**Primary error:**
* [`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.

<details><summary>Less common errors (36)</summary>

<br />

**Network errors:**
* [`httpx.RequestError`](https://www.python-httpx.org/exceptions/#httpx.RequestError): Base class for request errors.
    * [`httpx.ConnectError`](https://www.python-httpx.org/exceptions/#httpx.ConnectError): HTTP client was unable to make a request to a server.
    * [`httpx.TimeoutException`](https://www.python-httpx.org/exceptions/#httpx.TimeoutException): HTTP request timed out.


**Inherit from [`OrqError`](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/./src/orq_ai_sdk/models/orqerror.py)**:
* [`HonoAPIError`](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/./src/orq_ai_sdk/models/honoapierror.py): Applicable to 9 of 115 methods.*
* [`InvokeEvalEvalsResponseBody`](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/./src/orq_ai_sdk/models/invokeevalevalsresponsebody.py): Bad request. Status code `400`. Applicable to 1 of 115 methods.*
* [`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 115 methods.*
* [`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 115 methods.*
* [`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 115 methods.*
* [`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 115 methods.*
* [`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 115 methods.*
* [`InvokeEvalEvalsResponseResponseBody`](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/./src/orq_ai_sdk/models/invokeevalevalsresponseresponsebody.py): Workspace ID is not found on the request. Status code `404`. Applicable to 1 of 115 methods.*
* [`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 115 methods.*
* [`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 115 methods.*
* [`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 115 methods.*
* [`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 115 methods.*
* [`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 115 methods.*
* [`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 115 methods.*
* [`UpdateAgentAgentsResponseBody`](https://github.com/orq-ai/orq-python/blob/master/packages/orq-rc/./src/orq_ai_sdk/models/updateagentagentsresponsebody.py): Ag