Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.orq.ai/llms.txt

Use this file to discover all available pages before exploring further.

We recommend to use our official client libraries to interact with the orq.ai API.

Github

Our SDKs are available on Github:

Node.js

Python

Installation

# The SDK can be installed with either pip or poetry package managers.
# PIP

pip install orq-ai-sdk

# Poetry

poetry add orq-ai-sdk

Usage

To get your workspace API Keys, see API Keys.
Initialize the orq.ai client with your API key:
import os

from orq_ai_sdk import Orq

client = Orq(
	 api_key=os.environ.get("ORQ_API_KEY", "__API_KEY__"),
 	 environment="production",
   # optionally initiate the identity_id for the session
   identity_id=2025
)

Agents

Agents A2A

Register an external A2A-compliant agent into Orquesta. The agent card will be fetched during registration to validate the agent and cache its capabilities.
from orq_ai_sdk import Orq
import os

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

    res = orq.agents.post_v2_agents_a2a()

    # Handle response
    print(res)

Agents Card Refresh

Fetches the latest agent card from the external A2A agent and updates the cached card in the database. Similar to MCP server refresh functionality.
from orq_ai_sdk import Orq
import os

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

    res = orq.agents.post_v2_agents_key_card_refresh(key="<key>")

    # Handle response
    print(res)

Create an Agent

Creates a new agent with the specified configuration, including model selection, instructions, tools, and knowledge bases. Agents are intelligent assistants that can execute tasks, interact with tools, and maintain context through memory stores. The agent can be configured with a primary model and optional fallback models for automatic failover, custom instructions for behavior control, and various settings to control execution limits and tool usage.
from orq_ai_sdk import Orq
import os

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

    res = orq.agents.create(key="<key>", role="<value>", description="alongside beneath doubtfully behest validity bah after furthermore", instructions="<value>", path="Default", model={
        "id": "<id>",
        "retry": {
            "count": 3,
            "on_codes": [
                429,
                500,
                502,
                503,
                504,
            ],
        },
    }, settings={
        "tools": [
            {
                "type": "mcp",
                "id": "01KA84ND5J0SWQMA2Q8HY5WZZZ",
                "tool_id": "01KXYZ123456789",
                "requires_approval": False,
            },
        ],
    }, fallback_models=[
        {
            "id": "<id>",
            "retry": {
                "count": 3,
                "on_codes": [
                    429,
                    500,
                    502,
                    503,
                    504,
                ],
            },
        },
    ], knowledge_bases=[
        {
            "knowledge_id": "customer-knowledge-base",
        },
    ], engine="text")

    # Handle response
    print(res)

List Agents

Retrieves a comprehensive list of agents configured in your workspace. Supports pagination for large datasets and returns agents sorted by creation date (newest first). Each agent in the response includes its complete configuration: model settings with fallback options, instructions, tools, knowledge bases, memory stores, and execution parameters. Use pagination parameters to efficiently navigate through large collections of agents.
from orq_ai_sdk import Orq
import os

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

    res = orq.agents.list(limit=10)

    # Handle response
    print(res)

Delete an Agent

Permanently removes an agent from the workspace. This operation is irreversible and will delete all associated configuration including model assignments, tools, knowledge bases, memory stores, and cached data. Active agent sessions will be terminated, and the agent key will become available for reuse.
from orq_ai_sdk import Orq
import os

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

    orq.agents.delete(agent_key="<value>")

    # Use the SDK ...

Retrieve an Agent

Retrieves detailed information about a specific agent identified by its unique key or identifier. Returns the complete agent manifest including configuration settings, model assignments (primary and fallback), tools, knowledge bases, memory stores, instructions, and execution parameters. Use this endpoint to fetch the current state and configuration of an individual agent.
from orq_ai_sdk import Orq
import os

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

    res = orq.agents.retrieve(agent_key="<value>")

    # Handle response
    print(res)

Update an Agent

Modifies an existing agent’s configuration with partial updates. Supports updating any aspect of the agent including model assignments (primary and fallback), instructions, tools, knowledge bases, memory stores, and execution parameters. Only the fields provided in the request body will be updated; all other fields remain unchanged. Changes take effect immediately for new agent invocations.
from orq_ai_sdk import Orq
import os

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

    res = orq.agents.update(agent_key="<value>", model="El Camino", fallback_models=[
        "<value>",
    ], settings={
        "tools": [
            {
                "type": "mcp",
                "id": "01KA84ND5J0SWQMA2Q8HY5WZZZ",
                "tool_id": "01KXYZ123456789",
                "requires_approval": False,
            },
        ],
    }, path="Default", knowledge_bases=[
        {
            "knowledge_id": "customer-knowledge-base",
        },
    ])

    # Handle response
    print(res)

Invoke an Agent [deprecated]

Invokes an agent to perform a task with the provided input message. The agent will process the request using its configured model and tools, maintaining context through memory stores if configured. Supports automatic model fallback on primary model failure, tool execution, knowledge base retrieval, and continuation of previous conversations. Returns a task response that can be used to track execution status and retrieve results.
from orq_ai_sdk import Orq
import os

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

    res = orq.agents.invoke(key="<key>", message={
        "role": "user",
        "parts": [],
    }, 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",
        ],
    }, thread={
        "id": "thread_01ARZ3NDEKTSV4RRFFQ69G5FAV",
        "tags": [
            "customer-support",
            "priority-high",
        ],
    })

    # Handle response
    print(res)

Run an Agent [deprecated]

Executes an agent using inline configuration or references an existing agent. Supports dynamic agent creation where the system automatically manages agent versioning - reusing existing agents with matching configurations or creating new versions when configurations differ. Ideal for programmatic agent execution with flexible configuration management. The agent processes messages in A2A format with support for memory context, tool execution, and automatic model fallback on failure.
from orq_ai_sdk import Orq
import os

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

    res = orq.agents.run(key="<key>", model="F-150", role="<value>", instructions="<value>", message={
        "role": "tool",
        "parts": [
            {
                "kind": "text",
                "text": "<value>",
            },
        ],
    }, path="Default", settings={}, fallback_models=[
        "<value>",
    ], 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",
        ],
    }, thread={
        "id": "thread_01ARZ3NDEKTSV4RRFFQ69G5FAV",
        "tags": [
            "customer-support",
            "priority-high",
        ],
    }, knowledge_bases=[
        {
            "knowledge_id": "customer-knowledge-base",
        },
    ], engine="text")

    # Handle response
    print(res)

Stream Run [deprecated]

Dynamically configures and executes an agent while streaming the interaction in real-time via Server-Sent Events (SSE). Intelligently manages agent versioning by reusing existing agents with matching configurations or creating new versions when configurations differ. Combines the flexibility of inline configuration with real-time streaming, making it ideal for dynamic agent interactions with live feedback. The stream provides continuous updates including message chunks, tool executions, and status changes until completion or timeout.
from orq_ai_sdk import Orq
import os

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

    res = orq.agents.stream_run(key="<key>", model="Alpine", role="<value>", instructions="<value>", message={
        "role": "user",
        "parts": [
            {
                "kind": "file",
                "file": {
                    "uri": "https://jumbo-zebra.info/",
                },
            },
        ],
    }, path="Default", settings={}, fallback_models=[
        "<value>",
    ], 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",
        ],
    }, thread={
        "id": "thread_01ARZ3NDEKTSV4RRFFQ69G5FAV",
        "tags": [
            "customer-support",
            "priority-high",
        ],
    }, knowledge_bases=[
        {
            "knowledge_id": "customer-knowledge-base",
        },
    ], engine="text")

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

Stream an Agent [deprecated]

Executes an agent and streams the interaction in real-time using Server-Sent Events (SSE). Provides live updates as the agent processes the request, including message chunks, tool calls, and execution status. Perfect for building responsive chat interfaces and monitoring agent progress. The stream continues until the agent completes its task, encounters an error, or reaches the configured timeout (default 30 minutes, configurable 1-3600 seconds).
from orq_ai_sdk import Orq
import os

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

    res = orq.agents.stream(key="<key>", message={
        "role": "user",
        "parts": [],
    }, 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",
        ],
    }, thread={
        "id": "thread_01ARZ3NDEKTSV4RRFFQ69G5FAV",
        "tags": [
            "customer-support",
            "priority-high",
        ],
    })

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

Agents.Responses

Create a Response

Initiates an agent conversation and returns a complete response. This endpoint manages the full lifecycle of an agent interaction, from receiving the initial message through all processing steps until completion. Supports synchronous execution (waits for completion) and asynchronous execution (returns immediately with task ID). The response includes all messages exchanged, tool calls made, and token usage statistics. Ideal for request-response patterns where you need the complete interaction result.
from orq_ai_sdk import Orq
import os

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

    res = orq.agents.responses.create(agent_key="<value>", message={
        "role": "tool",
        "parts": [],
    }, 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",
        ],
    }, thread={
        "id": "thread_01ARZ3NDEKTSV4RRFFQ69G5FAV",
        "tags": [
            "customer-support",
            "priority-high",
        ],
    }, background=False, stream=False)

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

Retrieve a Response

Retrieves the current state of an agent response by task ID. Returns the response output, model information, token usage, and execution status. When the agent is still processing, the output array will be empty and status will be in_progress. Once completed, the response includes the full output, usage statistics, and finish reason.
from orq_ai_sdk import Orq
import os

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

    res = orq.agents.responses.get(agent_key="<value>", task_id="<id>")

    # Handle response
    print(res)

Annotations

Create an Annotation

Annotate a span
from orq_ai_sdk import Orq
import os

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

    orq.annotations.create(trace_id="<id>", span_id="<id>", annotations=[])

    # Use the SDK ...

Delete an Annotation

Remove an annotation from a span
from orq_ai_sdk import Orq
import os

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

    orq.annotations.delete(trace_id="<id>", span_id="<id>", keys=[
        "<value 1>",
    ])

    # Use the SDK ...

Chunking

Parse

Split large text documents into smaller, manageable chunks using different chunking strategies optimized for RAG (Retrieval-Augmented Generation) workflows. This endpoint supports multiple chunking algorithms including token-based, sentence-based, recursive, semantic, and specialized strategies.
from orq_ai_sdk import Orq
import os

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

    res = orq.chunking.parse(request={
        "text": "The quick brown fox jumps over the lazy dog. This is a sample text that will be chunked into smaller pieces. Each chunk will maintain context while respecting the maximum chunk size.",
        "metadata": True,
        "strategy": "semantic",
        "chunk_size": 256,
        "threshold": 0.8,
        "embedding_model": "openai/text-embedding-3-small",
        "dimensions": 512,
        "mode": "window",
        "similarity_window": 1,
    })

    # Handle response
    print(res)

Contacts

Create a Contact

Update or add user information to workspace
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)

Datasets

List Datasets

Retrieves a paginated list of datasets for the current workspace. Results can be paginated using cursor-based pagination.
from orq_ai_sdk import Orq
import os

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

    res = orq.datasets.list(limit=10)

    # Handle response
    print(res)

Create a Dataset

Creates a new dataset in the specified project.
from orq_ai_sdk import Orq
import os

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

    res = orq.datasets.create(request={
        "display_name": "Neva.Raynor10",
        "path": "Default",
    })

    # Handle response
    print(res)

Retrieve a Dataset

Retrieves a specific dataset by its unique identifier
from orq_ai_sdk import Orq
import os

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

    res = orq.datasets.retrieve(dataset_id="<id>")

    # Handle response
    print(res)

Update a Dataset

Update a dataset
from orq_ai_sdk import Orq
import os

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

    res = orq.datasets.update(dataset_id="<id>", path="Default")

    # Handle response
    print(res)

Delete a Dataset

Permanently deletes a dataset and all its datapoints. This action is irreversible.
from orq_ai_sdk import Orq
import os

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

    orq.datasets.delete(dataset_id="<id>")

    # Use the SDK ...

List Datapoints

Retrieves a paginated list of datapoints from a specific dataset.
from orq_ai_sdk import Orq
import os

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

    res = orq.datasets.list_datapoints(dataset_id="<id>", limit=10)

    # Handle response
    print(res)

Create Datapoint

Creates a new datapoint in the specified dataset.
from orq_ai_sdk import Orq
import os

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

    res = orq.datasets.create_datapoint(dataset_id="<id>")

    # Handle response
    print(res)

Retrieve Datapoint

Retrieves a datapoint object
from orq_ai_sdk import Orq
import os

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

    res = orq.datasets.retrieve_datapoint(dataset_id="<id>", datapoint_id="<id>")

    # Handle response
    print(res)

Update Datapoint

Update a datapoint
from orq_ai_sdk import Orq
import os

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

    res = orq.datasets.update_datapoint(dataset_id="<id>", datapoint_id="<id>")

    # Handle response
    print(res)

Delete Datapoint

Permanently deletes a specific datapoint from a dataset.
from orq_ai_sdk import Orq
import os

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

    orq.datasets.delete_datapoint(dataset_id="<id>", datapoint_id="<id>")

    # Use the SDK ...

Clear Datasets

Delete all datapoints from a dataset. This action is irreversible.
from orq_ai_sdk import Orq
import os

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

    orq.datasets.clear(dataset_id="<id>")

    # Use the SDK ...

Deployments

Invoke a Deployment

Invoke a deployment with a given payload
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.invoke(key="<key>", stream=False, 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",
            },
        },
    ])

    assert res is not None

    # Handle response
    print(res)

List Deployments

Returns a list of your deployments. The deployments are returned sorted by creation date, with the most recent deployments appearing first.
from orq_ai_sdk import Orq
import os

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

    res = orq.deployments.list(limit=10)

    # Handle response
    print(res)

Get Config

Retrieve the deployment configuration
from orq_ai_sdk import Orq
import os

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

    res = orq.deployments.get_config(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",
            },
        },
    ])

    assert res is not None

    # Handle response
    print(res)

Stream a Deployment

Stream deployment generation. Only supported for completions and chat completions.
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)

Evals

All Evals

Get all Evaluators
from orq_ai_sdk import Orq
import os

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

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

    # Handle response
    print(res)

Create an Eval

Create an Evaluator
from orq_ai_sdk import Orq
import os

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

    res = orq.evals.create(request={
        "output_type": "string",
        "type": "http_eval",
        "url": "https://total-unit.name",
        "method": "GET",
        "headers": {
            "key": "<value>",
            "key1": "<value>",
            "key2": "<value>",
        },
        "payload": {
            "key": "<value>",
        },
        "path": "Default",
        "description": "",
        "key": "<key>",
    })

    # Handle response
    print(res)

Update an Eval

Update an Evaluator
from orq_ai_sdk import Orq
import os

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

    res = orq.evals.update(id="<id>", path="Default")

    # Handle response
    print(res)

Delete an Eval

Delete an Evaluator
from orq_ai_sdk import Orq
import os

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

    orq.evals.delete(id="<id>")

    # Use the SDK ...

Invoke an Eval

Invoke a Custom Evaluator
from orq_ai_sdk import Orq
import os

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

    res = orq.evals.invoke(id="<id>", messages=[
        {
            "role": "tool",
            "content": [],
        },
    ])

    # Handle response
    print(res)

Evaluators Versions

Returns version history for a specific evaluator
from orq_ai_sdk import Orq
import os

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

    res = orq.evals.get_v2_evaluators_id_versions(id="<id>", limit=10)

    # Handle response
    print(res)

Feedback

Create a Feedback

from orq_ai_sdk import Orq
import os

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

    res = orq.feedback.post_v2_feedback()

    # Handle response
    print(res)

Feedback Remove

from orq_ai_sdk import Orq
import os

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

    res = orq.feedback.post_v2_feedback_remove()

    # Handle response
    print(res)

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)

GuardrailRules

List GuardrailRules

Returns a paginated list of guardrail rules for the current project.
from orq_ai_sdk import Orq
import os

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

    res = orq.guardrail_rules.list(limit=10)

    # Handle response
    print(res)

Create a GuardrailRule

Creates a new guardrail rule with expression, guardrails configuration, and timeout settings.
from orq_ai_sdk import Orq
import os

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

    res = orq.guardrail_rules.create(display_name="Rosemarie_Wisoky")

    # Handle response
    print(res)

Delete a GuardrailRule

Deletes an existing guardrail rule by ID.
from orq_ai_sdk import Orq
import os

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

    orq.guardrail_rules.delete(guardrail_rule_id="<id>")

    # Use the SDK ...

Retrieve a GuardrailRule

Retrieves the details of an existing guardrail rule by ID.
from orq_ai_sdk import Orq
import os

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

    res = orq.guardrail_rules.retrieve(guardrail_rule_id="<id>")

    # Handle response
    print(res)

Update a GuardrailRule

Partially updates an existing guardrail rule. Only provided fields are updated.
from orq_ai_sdk import Orq
import os

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

    res = orq.guardrail_rules.update(guardrail_rule_id="<id>")

    # Handle response
    print(res)

HumanReviewSets

List HumanReviewSets

Get all human review sets
from orq_ai_sdk import Orq
import os

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

    res = orq.human_review_sets.get_v2_human_eval_sets()

    # Handle response
    print(res)

Create a HumanReviewSet

Create a human review set
from orq_ai_sdk import Orq
import os

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

    res = orq.human_review_sets.post_v2_human_eval_sets()

    # Handle response
    print(res)

Retrieve a HumanReviewSet

Get a human review set by ID
from orq_ai_sdk import Orq
import os

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

    res = orq.human_review_sets.get_v2_human_eval_sets_id_(id="<id>")

    # Handle response
    print(res)

Update a HumanReviewSet

Update a human review set
from orq_ai_sdk import Orq
import os

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

    res = orq.human_review_sets.patch_v2_human_eval_sets_id_(id="<id>")

    # Handle response
    print(res)

Delete a HumanReviewSet

Delete a human review set
from orq_ai_sdk import Orq
import os

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

    orq.human_review_sets.delete_v2_human_eval_sets_id_(id="<id>")

    # Use the SDK ...

Identities

List Identities

Retrieves a paginated list of identities in your workspace. Use pagination parameters to navigate through large identity lists efficiently.
from orq_ai_sdk import Orq
import os

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

    res = orq.identities.list(limit=10, search="john", filter_by={
        "tags": [
            "premium",
            "beta-user",
        ],
    }, include_metrics=False)

    # Handle response
    print(res)

Create an Identity

Creates a new identity with a unique external_id. If an identity with the same external_id already exists, the operation will fail. Use this endpoint to add users from your system to orq.ai for tracking their usage and engagement.
from orq_ai_sdk import Orq
import os

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

    res = orq.identities.create(request={
        "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)

Retrieve an Identity

Retrieves detailed information about a specific identity using their identity ID or external ID from your system.
from orq_ai_sdk import Orq
import os

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

    res = orq.identities.retrieve(id="<id>", include_metrics=False)

    # Handle response
    print(res)

Update an Identity

Updates specific fields of an existing identity. Only the fields provided in the request body will be updated.
from orq_ai_sdk import Orq
import os

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

    res = orq.identities.update(id="<id>", 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)

Delete an Identity

Permanently deletes an identity from your workspace and cleans up associated budget configurations. This action cannot be undone.
from orq_ai_sdk import Orq
import os

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

    orq.identities.delete(id="<id>")

    # Use the SDK ...

Knowledge

List Knowledge

Returns a list of your knowledge bases. The knowledge bases are returned sorted by creation date, with the most recent knowledge bases appearing first
from orq_ai_sdk import Orq
import os

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

    res = orq.knowledge.list(limit=10)

    # Handle response
    print(res)

Create a Knowledge

Create a knowledge
from orq_ai_sdk import Orq
import os

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

    res = orq.knowledge.create(request={
        "type": "internal",
        "key": "<key>",
        "embedding_model": "<value>",
        "path": "Default",
    })

    # Handle response
    print(res)

Retrieve a Knowledge

Retrieve a knowledge base with the settings.
from orq_ai_sdk import Orq
import os

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

    res = orq.knowledge.retrieve(knowledge_id="<id>")

    # Handle response
    print(res)

Update a Knowledge

Updates a knowledge
from orq_ai_sdk import Orq
import os

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

    res = orq.knowledge.update(knowledge_id="<id>", request_body={
        "path": "Default",
        "type": "external",
    })

    # Handle response
    print(res)

Delete a Knowledge

Deletes a knowledge base. Deleting a knowledge base will delete all the datasources and chunks associated with it.
from orq_ai_sdk import Orq
import os

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

    orq.knowledge.delete(knowledge_id="<id>")

    # Use the SDK ...

Search Knowledge

Search a Knowledge Base and return the most similar chunks, along with their search and rerank scores. Note that all configuration changes made in the API will override the settings in the UI.
from orq_ai_sdk import Orq
import os

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

    res = orq.knowledge.search(knowledge_id="<id>", query="<value>", search_type="hybrid_search", rerank_config={
        "model": "cohere/rerank-multilingual-v3.0",
    })

    # Handle response
    print(res)

List Datasources

List all datasources
from orq_ai_sdk import Orq
import os

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

    res = orq.knowledge.list_datasources(knowledge_id="<id>", limit=50, status=[
        "completed",
        "failed",
    ])

    # Handle response
    print(res)

Create Datasource

Create a new datasource
from orq_ai_sdk import Orq
import os

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

    res = orq.knowledge.create_datasource(knowledge_id="<id>")

    # Handle response
    print(res)

Retrieve Datasource

Retrieve a datasource
from orq_ai_sdk import Orq
import os

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

    res = orq.knowledge.retrieve_datasource(knowledge_id="<id>", datasource_id="<id>")

    # Handle response
    print(res)

Delete Datasource

Deletes a datasource from a knowledge base. Deleting a datasource will remove it from the knowledge base and all associated chunks. This action is irreversible and cannot be undone.
from orq_ai_sdk import Orq
import os

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

    orq.knowledge.delete_datasource(knowledge_id="<id>", datasource_id="<id>")

    # Use the SDK ...

Update Datasource

Update a datasource
from orq_ai_sdk import Orq
import os

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

    res = orq.knowledge.update_datasource(knowledge_id="<id>", datasource_id="<id>", display_name="Tony_Roberts")

    # Handle response
    print(res)

Create Chunks

Create chunks for a datasource
from orq_ai_sdk import Orq
import os

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

    res = orq.knowledge.create_chunks(knowledge_id="<id>", datasource_id="<id>")

    # Handle response
    print(res)

List Chunks

List all chunks for a datasource
from orq_ai_sdk import Orq
import os

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

    res = orq.knowledge.list_chunks(knowledge_id="<id>", datasource_id="<id>", limit=10, status=[
        "completed",
        "failed",
    ])

    # Handle response
    print(res)

Delete Chunks

Delete multiple chunks
from orq_ai_sdk import Orq
import os

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

    res = orq.knowledge.delete_chunks(knowledge_id="<id>", datasource_id="<id>", chunk_ids=[
        "<value 1>",
        "<value 2>",
    ])

    # Handle response
    print(res)

List Chunks Paginated

List chunks with offset-based pagination
from orq_ai_sdk import Orq
import os

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

    res = orq.knowledge.list_chunks_paginated(knowledge_id="<id>", datasource_id="<id>", q="", limit=100, page=1)

    # Handle response
    print(res)

Get Chunks Count

Get chunks total count
from orq_ai_sdk import Orq
import os

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

    res = orq.knowledge.get_chunks_count(knowledge_id="<id>", datasource_id="<id>", q="")

    # Handle response
    print(res)

Update Chunk

Update a chunk
from orq_ai_sdk import Orq
import os

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

    res = orq.knowledge.update_chunk(chunk_id="<id>", datasource_id="<id>", knowledge_id="<id>")

    # Handle response
    print(res)

Delete Chunk

Delete a chunk
from orq_ai_sdk import Orq
import os

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

    orq.knowledge.delete_chunk(chunk_id="<id>", datasource_id="<id>", knowledge_id="<id>")

    # Use the SDK ...

Retrieve Chunk

Retrieve a chunk
from orq_ai_sdk import Orq
import os

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

    res = orq.knowledge.retrieve_chunk(chunk_id="<id>", datasource_id="<id>", knowledge_id="<id>")

    # Handle response
    print(res)

MemoryStores

List MemoryStores

Retrieves a paginated list of memory stores in the workspace. Use cursor-based pagination parameters to navigate through the results.
from orq_ai_sdk import Orq
import os

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

    res = orq.memory_stores.list(limit=10)

    # Handle response
    print(res)

Create a MemoryStore

Create memory store
from orq_ai_sdk import Orq
import os

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

    res = orq.memory_stores.create(request={
        "key": "<key>",
        "embedding_config": {
            "model": "cohere/embed-multilingual-light-v3.0",
        },
        "description": "unlike excluding soulful quirkily hmph baseboard whereas gee deserted",
        "path": "Default",
    })

    # Handle response
    print(res)

Retrieve a MemoryStore

Retrieves detailed information about a specific memory store, including its configuration and metadata.
from orq_ai_sdk import Orq
import os

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

    res = orq.memory_stores.retrieve(memory_store_key="<value>")

    # Handle response
    print(res)

Update a MemoryStore

Update the memory store configuration
from orq_ai_sdk import Orq
import os

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

    res = orq.memory_stores.update(memory_store_key="<value>", description="wherever cash since now exempt proliferate aha tabulate ack", path="Default")

    # Handle response
    print(res)

Delete a MemoryStore

Permanently delete a memory store, including memories and documents.
from orq_ai_sdk import Orq
import os

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

    orq.memory_stores.delete(memory_store_key="<value>")

    # Use the SDK ...

List Memories

Retrieves a paginated list of memories for the memory store
from orq_ai_sdk import Orq
import os

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

    res = orq.memory_stores.list_memories(memory_store_key="<value>", limit=10)

    # Handle response
    print(res)

Create Memory

Creates a new memory in the specified memory store.
from orq_ai_sdk import Orq
import os

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

    res = orq.memory_stores.create_memory(memory_store_key="<value>", entity_id="<id>")

    # Handle response
    print(res)

Retrieve Memory

Retrieves details of a specific memory by its ID
from orq_ai_sdk import Orq
import os

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

    res = orq.memory_stores.retrieve_memory(memory_store_key="<value>", memory_entity_id="<id>")

    # Handle response
    print(res)

Update Memory

Updates the details of a specific memory.
from orq_ai_sdk import Orq
import os

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

    res = orq.memory_stores.update_memory(memory_store_key="<value>", memory_entity_id="<id>")

    # Handle response
    print(res)

Delete Memory

Permanently deletes a specific memory. Use this endpoint to:
  • Remove a memory from the store
  • Clean up unused memories
  • Manage memory storage space
from orq_ai_sdk import Orq
import os

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

    orq.memory_stores.delete_memory(memory_store_key="<value>", memory_entity_id="<id>")

    # Use the SDK ...

List Documents

Retrieves a paginated list of documents associated with a specific memory.
from orq_ai_sdk import Orq
import os

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

    res = orq.memory_stores.list_documents(memory_store_key="<value>", memory_entity_id="<id>", limit=10)

    # Handle response
    print(res)

Create Document

Creates a new document in the specified memory.
from orq_ai_sdk import Orq
import os

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

    res = orq.memory_stores.create_document(memory_store_key="<value>", memory_entity_id="<id>", text="<value>")

    # Handle response
    print(res)

Retrieve Document

Retrieves details of a specific memory document by its ID.
from orq_ai_sdk import Orq
import os

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

    res = orq.memory_stores.retrieve_document(memory_store_key="<value>", memory_entity_id="<id>", document_id="<id>")

    # Handle response
    print(res)

Update Document

Updates the details of a specific memory document.
from orq_ai_sdk import Orq
import os

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

    res = orq.memory_stores.update_document(memory_store_key="<value>", memory_entity_id="<id>", document_id="<id>")

    # Handle response
    print(res)

Delete Document

Permanently deletes a specific memory document. Use this endpoint to:
  • Remove a document from a memory
  • Clean up unused documents
  • Manage document storage space
from orq_ai_sdk import Orq
import os

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

    orq.memory_stores.delete_document(memory_store_key="<value>", memory_entity_id="<id>", document_id="<id>")

    # Use the SDK ...

Orq SDK

Feedback Evaluation Remove

from orq_ai_sdk import Orq
import os

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

    orq.post_v2_feedback_evaluation_remove()

    # Use the SDK ...

Feedback Evaluation

from orq_ai_sdk import Orq
import os

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

    orq.post_v2_feedback_evaluation()

    # Use the SDK ...

Policies

List Policies

Returns a paginated list of policies for the current project.
from orq_ai_sdk import Orq
import os

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

    res = orq.policies.list(limit=10)

    # Handle response
    print(res)

Create a Policy

Creates a new router policy with model configuration, evaluators, retry settings, and limits.
from orq_ai_sdk import Orq
import os

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

    res = orq.policies.create(display_name="Zelda80")

    # Handle response
    print(res)

Delete a Policy

Deletes an existing policy by ID.
from orq_ai_sdk import Orq
import os

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

    orq.policies.delete(policy_id="<id>")

    # Use the SDK ...

Retrieve a Policy

Retrieves the details of an existing policy by ID.
from orq_ai_sdk import Orq
import os

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

    res = orq.policies.retrieve(policy_id="<id>")

    # Handle response
    print(res)

Update a Policy

Partially updates an existing policy. Only provided fields are updated.
from orq_ai_sdk import Orq
import os

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

    res = orq.policies.update(policy_id="<id>")

    # Handle response
    print(res)

Projects

List Projects

Returns a list of projects. Projects are sorted by creation date, with the most recently created projects appearing first.
from orq_ai_sdk import Orq
import os

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

    res = orq.projects.list()

    # Handle response
    print(res)

Create a Project

Creates a new project within the workspace. Projects organize resources like skills, deployments, and datasets.
from orq_ai_sdk import Orq
import os

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

    res = orq.projects.create()

    # Handle response
    print(res)

Retrieve a Project

Retrieves the details of an existing project by its unique project ID.
from orq_ai_sdk import Orq
import os

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

    res = orq.projects.get(project_id="<id>")

    # Handle response
    print(res)

Delete a Project

Delete a project
from orq_ai_sdk import Orq
import os

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

    res = orq.projects.delete(project_id="<id>")

    # Handle response
    print(res)

Update a Project

Updates the specified project by setting the values of the parameters passed.
from orq_ai_sdk import Orq
import os

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

    res = orq.projects.update(project_id_param="<value>")

    # Handle response
    print(res)

Prompts

List Prompts

Returns a list of your prompts. The prompts are returned sorted by creation date, with the most recent prompts appearing first
from orq_ai_sdk import Orq
import os

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

    res = orq.prompts.list(limit=10)

    # Handle response
    print(res)

Create a Prompt

Create a prompt
from orq_ai_sdk import Orq
import os

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

    res = orq.prompts.create(request={
        "display_name": "Raymundo83",
        "prompt": {
            "messages": [
                {
                    "role": "system",
                    "content": "You are a helpful assistant",
                },
                {
                    "role": "user",
                    "content": "What is the weather today?",
                },
            ],
            "model": "openai/gpt-4o",
            "max_tokens": 1000,
            "temperature": 0.7,
        },
        "path": "Default",
    })

    # Handle response
    print(res)

Retrieve a Prompt

Retrieves a prompt object
from orq_ai_sdk import Orq
import os

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

    res = orq.prompts.retrieve(id="<id>")

    # Handle response
    print(res)

Update a Prompt

Update a prompt
from orq_ai_sdk import Orq
import os

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

    res = orq.prompts.update(id="<id>", prompt={
        "messages": [
            {
                "role": "system",
                "content": "You are a helpful assistant",
            },
            {
                "role": "user",
                "content": "Hello!",
            },
        ],
        "model": "anthropic/claude-3-5-sonnet-20241022",
        "temperature": 0.5,
    }, path="Default")

    # Handle response
    print(res)

Delete a Prompt

Delete a prompt
from orq_ai_sdk import Orq
import os

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

    orq.prompts.delete(id="<id>")

    # Use the SDK ...

List Versions

Returns a list of your prompt versions. The prompt versions are returned sorted by creation date, with the most recent prompt versions appearing first
from orq_ai_sdk import Orq
import os

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

    res = orq.prompts.list_versions(prompt_id="<id>", limit=10)

    # Handle response
    print(res)

Get Version

Retrieves a specific version of a prompt by its ID and version ID.
from orq_ai_sdk import Orq
import os

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

    res = orq.prompts.get_version(prompt_id="<id>", version_id="<id>")

    # Handle response
    print(res)

Remoteconfigs

Retrieve a Remoteconfig

Retrieve a remote config
from orq_ai_sdk import Orq
import os

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

    res = orq.remoteconfigs.retrieve()

    # Handle response
    print(res)

Responses

Create a Response

Creates a model response for the given input. Returns a response object or a stream of server-sent events.
from orq_ai_sdk import Orq
import os

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

    res = orq.responses.create()

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

Retrieve a Response

Retrieves a previously created response by its ID.
from orq_ai_sdk import Orq
import os

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

    res = orq.responses.get(response_id="<id>")

    # Handle response
    print(res)

Router

Ocr

Extracts text content while maintaining document structure and hierarchy
from orq_ai_sdk import Orq
import os

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

    res = orq.router.ocr(model="Golf", document={
        "type": "document_url",
        "document_url": "https://fond-pants.net/",
    })

    # Handle response
    print(res)

Router.Audio.Speech

Create a Speech

Generates audio from the input text.
from orq_ai_sdk import Orq
import os

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

    orq.router.audio.speech.create(input="<value>", model="Grand Caravan", voice="<value>", response_format="mp3", speed=1, retry={
        "on_codes": [
            429,
            500,
            502,
            503,
            504,
        ],
    }, load_balancer={
        "type": "weight_based",
        "models": [
            {
                "model": "openai/gpt-4o",
                "weight": 0.7,
            },
        ],
    }, timeout={
        "call_timeout": 30000,
    }, orq={
        "retry": {
            "on_codes": [
                429,
                500,
                502,
                503,
                504,
            ],
        },
        "fallbacks": [
            {
                "model": "openai/gpt-4o-mini",
            },
        ],
        "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",
            ],
        },
        "thread": {
            "id": "thread_01ARZ3NDEKTSV4RRFFQ69G5FAV",
            "tags": [
                "customer-support",
                "priority-high",
            ],
        },
        "load_balancer": {
            "type": "weight_based",
            "models": [
                {
                    "model": "openai/gpt-4o",
                    "weight": 0.7,
                },
                {
                    "model": "anthropic/claude-3-5-sonnet",
                    "weight": 0.3,
                },
            ],
        },
        "timeout": {
            "call_timeout": 30000,
        },
    })

    # Use the SDK ...

Router.Audio.Transcriptions

Create a Transcription

Create transcription
from orq_ai_sdk import Orq
import os

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

    res = orq.router.audio.transcriptions.create(model="Malibu", enable_logging=True, diarize=False, tag_audio_events=True, timestamps_granularity="word", temperature=0.5, timestamp_granularities=[
        "word",
        "segment",
    ], retry={
        "on_codes": [
            429,
            500,
            502,
            503,
            504,
        ],
    }, load_balancer={
        "type": "weight_based",
        "models": [
            {
                "model": "openai/gpt-4o",
                "weight": 0.7,
            },
        ],
    }, timeout={
        "call_timeout": 30000,
    }, orq={
        "fallbacks": [
            {
                "model": "openai/gpt-4o-mini",
            },
        ],
        "retry": {
            "on_codes": [
                429,
                500,
                502,
                503,
                504,
            ],
        },
        "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",
            ],
        },
        "load_balancer": {
            "type": "weight_based",
            "models": [
                {
                    "model": "openai/gpt-4o",
                    "weight": 0.7,
                },
                {
                    "model": "anthropic/claude-3-5-sonnet",
                    "weight": 0.3,
                },
            ],
        },
        "timeout": {
            "call_timeout": 30000,
        },
    })

    # Handle response
    print(res)

Router.Audio.Translations

Create a Translation

Create translation
from orq_ai_sdk import Orq
import os

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

    res = orq.router.audio.translations.create(model="Impala", enable_logging=True, diarize=False, tag_audio_events=True, timestamps_granularity="word", temperature=0.5, retry={
        "on_codes": [
            429,
            500,
            502,
            503,
            504,
        ],
    }, load_balancer={
        "type": "weight_based",
        "models": [
            {
                "model": "openai/gpt-4o",
                "weight": 0.7,
            },
        ],
    }, timeout={
        "call_timeout": 30000,
    }, orq={
        "fallbacks": [
            {
                "model": "openai/gpt-4o-mini",
            },
        ],
        "retry": {
            "on_codes": [
                429,
                500,
                502,
                503,
                504,
            ],
        },
        "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",
            ],
        },
        "load_balancer": {
            "type": "weight_based",
            "models": [
                {
                    "model": "openai/gpt-4o",
                    "weight": 0.7,
                },
                {
                    "model": "anthropic/claude-3-5-sonnet",
                    "weight": 0.3,
                },
            ],
        },
        "timeout": {
            "call_timeout": 30000,
        },
    })

    # Handle response
    print(res)

Router.Chat.Completions

Create a Completion

Creates a model response for the given chat conversation with support for retries, fallbacks, prompts, and variables.
from orq_ai_sdk import Orq
import os

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

    res = orq.router.chat.completions.create(messages=[], model="Model 3", fallbacks=[
        {
            "model": "openai/gpt-4o-mini",
        },
    ], retry={
        "on_codes": [
            429,
            500,
            502,
            503,
            504,
        ],
    }, cache={
        "ttl": 3600,
        "type": "exact_match",
    }, load_balancer={
        "type": "weight_based",
        "models": [
            {
                "model": "openai/gpt-4o",
                "weight": 0.7,
            },
            {
                "model": "anthropic/claude-3-5-sonnet",
                "weight": 0.3,
            },
        ],
    }, timeout={
        "call_timeout": 30000,
    }, variables={
        "customer_name": "John Smith",
        "product_name": "Premium Plan",
    }, stream=False)

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

Router.Completions

Create a Completion

For sending requests to legacy completion models
from orq_ai_sdk import Orq
import os

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

    res = orq.router.completions.create(model="XC90", prompt="<value>", echo=False, frequency_penalty=0, max_tokens=16, presence_penalty=0, temperature=1, top_p=1, n=1, retry={
        "on_codes": [
            429,
            500,
            502,
            503,
            504,
        ],
    }, cache={
        "ttl": 3600,
        "type": "exact_match",
    }, load_balancer={
        "type": "weight_based",
        "models": [
            {
                "model": "openai/gpt-4o",
                "weight": 0.7,
            },
        ],
    }, timeout={
        "call_timeout": 30000,
    }, stream=False)

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

Router.Embeddings

Create an Embedding

Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms.
from orq_ai_sdk import Orq
import os

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

    res = orq.router.embeddings.create(input=[
        "<value 1>",
        "<value 2>",
    ], model="V90", encoding_format="float", fallbacks=[
        {
            "model": "openai/text-embedding-3-small",
        },
    ], retry={
        "on_codes": [
            429,
            500,
            502,
            503,
            504,
        ],
    }, cache={
        "ttl": 3600,
        "type": "exact_match",
    }, load_balancer={
        "type": "weight_based",
        "models": [
            {
                "model": "openai/gpt-4o",
                "weight": 0.7,
            },
        ],
    }, timeout={
        "call_timeout": 30000,
    }, orq={
        "fallbacks": [
            {
                "model": "openai/gpt-4o-mini",
            },
        ],
        "cache": {
            "ttl": 3600,
            "type": "exact_match",
        },
        "retry": {
            "on_codes": [
                429,
                500,
                502,
                503,
                504,
            ],
        },
        "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",
            ],
        },
        "load_balancer": {
            "type": "weight_based",
            "models": [
                {
                    "model": "openai/gpt-4o",
                    "weight": 0.7,
                },
                {
                    "model": "anthropic/claude-3-5-sonnet",
                    "weight": 0.3,
                },
            ],
        },
        "timeout": {
            "call_timeout": 30000,
        },
    })

    # Handle response
    print(res)

Router.Images.Edits

Create an Edit

Edit an Image
from orq_ai_sdk import Orq
import os

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

    res = orq.router.images.edits.create(model="LeBaron", prompt="<value>", n=1, retry={
        "on_codes": [
            429,
            500,
            502,
            503,
            504,
        ],
    }, cache={
        "ttl": 3600,
        "type": "exact_match",
    }, load_balancer={
        "type": "weight_based",
        "models": [
            {
                "model": "openai/gpt-4o",
                "weight": 0.7,
            },
        ],
    }, timeout={
        "call_timeout": 30000,
    }, orq={
        "retry": {
            "on_codes": [
                429,
                500,
                502,
                503,
                504,
            ],
        },
        "fallbacks": [
            {
                "model": "openai/gpt-4o-mini",
            },
        ],
        "prompt": {
            "id": "prompt_01ARZ3NDEKTSV4RRFFQ69G5FAV",
            "version": "latest",
        },
        "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",
            ],
        },
        "cache": {
            "ttl": 3600,
            "type": "exact_match",
        },
        "load_balancer": {
            "type": "weight_based",
            "models": [
                {
                    "model": "openai/gpt-4o",
                    "weight": 0.7,
                },
                {
                    "model": "anthropic/claude-3-5-sonnet",
                    "weight": 0.3,
                },
            ],
        },
        "timeout": {
            "call_timeout": 30000,
        },
    })

    # Handle response
    print(res)

Router.Images.Generations

Create a Generation

Create an Image
from orq_ai_sdk import Orq
import os

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

    res = orq.router.images.generations.create(prompt="<value>", model="2", n=1, retry={
        "on_codes": [
            429,
            500,
            502,
            503,
            504,
        ],
    }, cache={
        "ttl": 3600,
        "type": "exact_match",
    }, load_balancer={
        "type": "weight_based",
        "models": [],
    }, timeout={
        "call_timeout": 30000,
    }, orq={
        "retry": {
            "on_codes": [
                429,
                500,
                502,
                503,
                504,
            ],
        },
        "fallbacks": [
            {
                "model": "openai/gpt-4o-mini",
            },
        ],
        "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",
            ],
        },
        "cache": {
            "ttl": 3600,
            "type": "exact_match",
        },
        "load_balancer": {
            "type": "weight_based",
            "models": [
                {
                    "model": "openai/gpt-4o",
                    "weight": 0.7,
                },
                {
                    "model": "anthropic/claude-3-5-sonnet",
                    "weight": 0.3,
                },
            ],
        },
        "timeout": {
            "call_timeout": 30000,
        },
    })

    # Handle response
    print(res)

Router.Images.Variations

Create a Variation

Create an Image Variation
from orq_ai_sdk import Orq
import os

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

    res = orq.router.images.variations.create(model="Altima", n=1, response_format="url", size="1024x1024", retry={
        "on_codes": [
            429,
            500,
            502,
            503,
            504,
        ],
    }, cache={
        "ttl": 3600,
        "type": "exact_match",
    }, load_balancer={
        "type": "weight_based",
        "models": [],
    }, timeout={
        "call_timeout": 30000,
    }, orq={
        "retry": {
            "on_codes": [
                429,
                500,
                502,
                503,
                504,
            ],
        },
        "fallbacks": [
            {
                "model": "openai/gpt-4o-mini",
            },
        ],
        "prompt": {
            "id": "prompt_01ARZ3NDEKTSV4RRFFQ69G5FAV",
            "version": "latest",
        },
        "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",
            ],
        },
        "cache": {
            "ttl": 3600,
            "type": "exact_match",
        },
        "load_balancer": {
            "type": "weight_based",
            "models": [
                {
                    "model": "openai/gpt-4o",
                    "weight": 0.7,
                },
                {
                    "model": "anthropic/claude-3-5-sonnet",
                    "weight": 0.3,
                },
            ],
        },
        "timeout": {
            "call_timeout": 30000,
        },
    })

    # Handle response
    print(res)

Router.Moderations

Create a Moderation

Create moderation
from orq_ai_sdk import Orq
import os

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

    res = orq.router.moderations.create(input=[], model="Fiesta")

    # Handle response
    print(res)

Router.Rerank

Create a Rerank

Rerank a list of documents based on their relevance to a query.
from orq_ai_sdk import Orq
import os

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

    res = orq.router.rerank.create(query="<value>", documents=[
        "<value 1>",
    ], model="XTS", retry={
        "on_codes": [
            429,
            500,
            502,
            503,
            504,
        ],
    }, cache={
        "ttl": 3600,
        "type": "exact_match",
    }, load_balancer={
        "type": "weight_based",
        "models": [],
    }, timeout={
        "call_timeout": 30000,
    }, orq={
        "fallbacks": [
            {
                "model": "openai/gpt-4o-mini",
            },
        ],
        "cache": {
            "ttl": 3600,
            "type": "exact_match",
        },
        "retry": {
            "on_codes": [
                429,
                500,
                502,
                503,
                504,
            ],
        },
        "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",
            ],
        },
        "load_balancer": {
            "type": "weight_based",
            "models": [
                {
                    "model": "openai/gpt-4o",
                    "weight": 0.7,
                },
                {
                    "model": "anthropic/claude-3-5-sonnet",
                    "weight": 0.3,
                },
            ],
        },
        "timeout": {
            "call_timeout": 30000,
        },
    })

    # Handle response
    print(res)

RoutingRules

List RoutingRules

Returns a paginated list of routing rules for the current project, ordered by priority ascending.
from orq_ai_sdk import Orq
import os

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

    res = orq.routing_rules.list(limit=10)

    # Handle response
    print(res)

Create a RoutingRule

Creates a new routing rule with expression, models configuration, and priority settings.
from orq_ai_sdk import Orq
import os

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

    res = orq.routing_rules.create(display_name="Freeda_Beahan")

    # Handle response
    print(res)

Delete a RoutingRule

Deletes an existing routing rule by ID.
from orq_ai_sdk import Orq
import os

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

    orq.routing_rules.delete(routing_rule_id="<id>")

    # Use the SDK ...

Retrieve a RoutingRule

Retrieves the details of an existing routing rule by ID.
from orq_ai_sdk import Orq
import os

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

    res = orq.routing_rules.retrieve(routing_rule_id="<id>")

    # Handle response
    print(res)

Update a RoutingRule

Partially updates an existing routing rule. Only provided fields are updated.
from orq_ai_sdk import Orq
import os

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

    res = orq.routing_rules.update(routing_rule_id="<id>")

    # Handle response
    print(res)

Schedules

List Schedules

Lists all schedules attached to the specified agent, most recent first.
from orq_ai_sdk import Orq
import os

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

    res = orq.schedules.list(agent_key="<value>")

    # Handle response
    print(res)

Create a Schedule

Creates a schedule that runs the agent on a recurring or one-off cadence. The minimum firing interval is 1 hour for cron and interval; once schedules are exempt.

Delete a Schedule

Permanently removes a schedule from NATS, Mongo, and the Redis cache.
from orq_ai_sdk import Orq
import os

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

    orq.schedules.delete(agent_key="<value>", schedule_id="<id>")

    # Use the SDK ...

Retrieve a Schedule

Retrieves a single schedule by ID.
from orq_ai_sdk import Orq
import os

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

    res = orq.schedules.retrieve(agent_key="<value>", schedule_id="<id>")

    # Handle response
    print(res)

Update a Schedule

Partially updates a schedule. Any omitted field is left unchanged. Changing expression or type (or reactivating from inactive) re-publishes the NATS schedule and bumps generation; payload-only and agent_tag-only changes leave the firing cadence in place.

Trigger a Schedule

Runs the schedule’s payload immediately (≈10 seconds after the request, to stay above the NATS scheduler’s minimum deliver-at margin). The schedule’s regular cadence is unaffected. Inactive schedules return 400.
from orq_ai_sdk import Orq
import os

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

    res = orq.schedules.trigger(agent_key="<value>", schedule_id="<id>")

    # Handle response
    print(res)

Skills

List Skills

Returns a list of skills. Skills are sorted by creation date, with the most recently created skills appearing first.
from orq_ai_sdk import Orq
import os

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

    res = orq.skills.list()

    # Handle response
    print(res)

Create a Skill

Skills are modular instructions you can use to codify processes and conventions
from orq_ai_sdk import Orq
import os

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

    res = orq.skills.create()

    # Handle response
    print(res)

Retrieve a Skill

Retrieves an existing skill by its unique skill ID or its display name (display names are unique within a workspace).
from orq_ai_sdk import Orq
import os

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

    res = orq.skills.get(skill_id="<id>")

    # Handle response
    print(res)

Delete a Skill

Delete a skill
from orq_ai_sdk import Orq
import os

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

    res = orq.skills.delete(skill_id="<id>")

    # Handle response
    print(res)

Update a Skill

Updates the specified skill by setting the values of the parameters passed.
from orq_ai_sdk import Orq
import os

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

    res = orq.skills.update(skill_id_param="<value>")

    # Handle response
    print(res)

Tools

List Tools

Lists all workspace tools. By default, returns all tools in a single response. Set limit to enable cursor-based pagination with starting_after and ending_before.
from orq_ai_sdk import Orq
import os

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

    res = orq.tools.list(limit=300)

    # Handle response
    print(res)

Create a Tool

Creates a new tool in the workspace.
import orq_ai_sdk
from orq_ai_sdk import Orq
import os

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

    res = orq.tools.create(request=orq_ai_sdk.RequestBodyJSONSchemaTool(
        path="Default",
        key="<key>",
        description="runway border pro mortally recount accredit promptly",
        status="live",
        type="json_schema",
        json_schema=orq_ai_sdk.RequestBodyJSONSchema(
            name="<value>",
            description="lovable past madly uh-huh by",
            schema_=orq_ai_sdk.RequestBodySchema(
                type="<value>",
                properties={
                    "key": "<value>",
                },
                required=[],
            ),
        ),
    ))

    # Handle response
    print(res)

Update a Tool

Updates a tool in the workspace.
import orq_ai_sdk
from orq_ai_sdk import Orq
import os

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

    res = orq.tools.update(tool_id="<id>", request_body=orq_ai_sdk.UpdateFunctionTool(
        path="Default",
        status="live",
        type="function",
    ))

    # Handle response
    print(res)

Delete a Tool

Deletes a tool by key.
from orq_ai_sdk import Orq
import os

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

    orq.tools.delete(tool_id="<id>")

    # Use the SDK ...

Retrieve a Tool

Retrieves a tool by id.
from orq_ai_sdk import Orq
import os

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

    res = orq.tools.retrieve(tool_id="<id>")

    # Handle response
    print(res)

Tools Versions

Returns version history for a specific tool
from orq_ai_sdk import Orq
import os

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

    res = orq.tools.get_v2_tools_tool_id_versions(tool_id="<id>", limit=10)

    # Handle response
    print(res)

Tools Versions

Returns a specific version of a tool
from orq_ai_sdk import Orq
import os

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

    res = orq.tools.get_v2_tools_tool_id_versions_version_id_(tool_id="<id>", version_id="<id>")

    # Handle response
    print(res)

Deployments.Metrics

Create a Metric [deprecated]

Add metrics to a deployment
from orq_ai_sdk import Orq
import os

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

    res = orq.deployments.metrics.create(id="<id>")

    # Handle response
    print(res)