Skip to content

Latest commit

 

History

History
820 lines (585 loc) · 69.9 KB

File metadata and controls

820 lines (585 loc) · 69.9 KB

Models

Overview

Available Operations

create

Creates a new custom model for the workspace. Provider credentials in the configuration are encrypted using the workspace encryption key before being persisted.

Example Usage

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.models.create(configuration={

    }, display_name="Albert_Emmerich25", has_functions=False, id="<id>", input_cost=2127.52, metadata=orq_ai_sdk.ModelMetadata(
        is_private=False,
    ), model_developer="<value>", model_family="<value>", model_id="<id>", model_type="<value>", output_cost=5446.0, parameters=[
        {
            "config": {

            },
            "name": "<value>",
            "parameter": "<value>",
            "parameter_type": "<value>",
        },
    ], provider="<value>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
configuration Dict[str, Any] ✔️ N/A
display_name str ✔️ N/A
has_functions bool ✔️ N/A
id str ✔️ N/A
input_cost float ✔️ N/A
metadata models.ModelMetadata ✔️ N/A
model_developer str ✔️ N/A
model_family str ✔️ N/A
model_id str ✔️ N/A
model_type str ✔️ N/A
output_cost float ✔️ N/A
parameters List[models.CreateModelParameter] ✔️ N/A
provider str ✔️ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.ModelCreateResponseBody

Errors

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

create_aws_bedrock

Registers an AWS Bedrock inference profile as a custom model for the workspace. Credentials are resolved at request time via either the integration reference or pod-identity — nothing is stored with the model.

Example Usage

from orq_ai_sdk import Orq
import os


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

    res = orq.models.create_aws_bedrock(auth_mode="<value>", display_name="Shanon.Wintheiser", model_developer="<value>", model_id="<id>", region="<value>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
auth_mode str ✔️ N/A
display_name str ✔️ N/A
model_developer str ✔️ N/A
model_id str ✔️ N/A
region str ✔️ N/A
assume_role_arn Optional[str] ➖ N/A
assume_role_external_id Optional[str] ➖ N/A
autorouter_id Optional[str] ➖ N/A
autorouter_version Optional[str] ➖ N/A
cache_read_cost Optional[float] ➖ N/A
cache_write_cost Optional[float] ➖ N/A
description Optional[str] ➖ N/A
has_reasoning Optional[bool] ➖ N/A
input_cost Optional[float] ➖ N/A
integration_id Optional[str] ➖ N/A
max_tokens Optional[int] ➖ N/A
model_family Optional[str] ➖ N/A
model_type Optional[str] ➖ N/A
output_cost Optional[float] ➖ N/A
supports_adaptive_reasoning Optional[bool] ➖ N/A
supports_extended_thinking Optional[bool] ➖ N/A
supports_json_mode Optional[bool] ➖ N/A
supports_json_schema Optional[bool] ➖ N/A
supports_strict_tool Optional[bool] ➖ N/A
supports_tool_calling Optional[bool] ➖ N/A
supports_vision Optional[bool] ➖ N/A
temperature Optional[float] ➖ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.ModelCreateAwsBedrockResponseBody

Errors

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

validate_aws_bedrock

Performs a live Bedrock Converse probe to verify the inference profile ARN and credentials, then best-effort enriches the response from known system models.

Example Usage

from orq_ai_sdk import Orq
import os


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

    orq.models.validate_aws_bedrock(auth_mode="<value>", inference_profile_arn="<value>", region="<value>")

    # Use the SDK ...

Parameters

Parameter Type Required Description
auth_mode str ✔️ N/A
inference_profile_arn str ✔️ N/A
region str ✔️ N/A
assume_role_arn Optional[str] ➖ N/A
assume_role_external_id Optional[str] ➖ N/A
integration_id Optional[str] ➖ N/A
model_type Optional[str] ➖ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Errors

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

update_aws_bedrock

Updates an AWS Bedrock custom model. ARN changes are format-validated (live AWS validation lives in the dedicated validate endpoint). Configuration and metadata are spread-merged. Parameters are replaced only when the request produces a non-empty list.

Example Usage

from orq_ai_sdk import Orq
import os


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

    res = orq.models.update_aws_bedrock(id="<id>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
id str ✔️ The ID of the model
assume_role_arn Optional[str] ➖ N/A
assume_role_external_id Optional[str] ➖ N/A
autorouter_id Optional[str] ➖ N/A
autorouter_version Optional[str] ➖ N/A
cache_read_cost Optional[float] ➖ N/A
cache_write_cost Optional[float] ➖ N/A
description Optional[str] ➖ N/A
display_name Optional[str] ➖ N/A
has_reasoning Optional[bool] ➖ N/A
input_cost Optional[float] ➖ N/A
max_tokens Optional[int] ➖ N/A
model_developer Optional[str] ➖ N/A
model_family Optional[str] ➖ N/A
model_id Optional[str] ➖ N/A
output_cost Optional[float] ➖ N/A
region Optional[str] ➖ N/A
supports_adaptive_reasoning Optional[bool] ➖ N/A
supports_extended_thinking Optional[bool] ➖ N/A
supports_json_mode Optional[bool] ➖ N/A
supports_json_schema Optional[bool] ➖ N/A
supports_strict_tool Optional[bool] ➖ N/A
supports_tool_calling Optional[bool] ➖ N/A
supports_vision Optional[bool] ➖ N/A
temperature Optional[float] ➖ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.ModelUpdateAwsBedrockResponseBody

Errors

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

azure_foundry_deployments

Lists Azure Foundry deployments under the given base_url and joins each entry with the Orq master-data row. Only OpenAI-developed deployments in succeeded state with chat/completion/embedding/vision model types are returned.

Example Usage

from orq_ai_sdk import Orq
import os


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

    res = orq.models.azure_foundry_deployments(api_key="<value>", base_url="https://admired-overcoat.info", provider="<value>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
api_key str ✔️ N/A
base_url str ✔️ N/A https://project.openai.azure.com/openai/v1
provider str ✔️ N/A
api_version Optional[str] ➖ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.ModelAzureFoundryDeploymentsResponseBody

Errors

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

import_litellm

Bulk-imports a list of LiteLLM model definitions into the workspace model garden.

Example Usage

from orq_ai_sdk import Orq
import os


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

    res = orq.models.import_litellm(request=[
        {
            "litellm_params": {
                "merge_reasoning_content_in_choices": False,
                "model": "CX-9",
                "use_in_pass_through": False,
                "use_litellm_proxy": False,
            },
            "model_info": {
                "db_model": True,
                "id": "<id>",
                "key": "<key>",
                "litellm_provider": "<value>",
                "mode": "<value>",
            },
            "model_name": "<value>",
        },
    ])

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
request List[models.LiteLLMModel] ✔️ The request object to use for the request.
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

List[models.ModelDocument]

Errors

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

list_litellm

Fetches the list of models from the LiteLLM instance configured for the workspace. Requires a stored LiteLLM integration.

Example Usage

from orq_ai_sdk import Orq
import os


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

    res = orq.models.list_litellm()

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

List[Dict[str, Any]]

Errors

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

create_openai_like

Creates a custom model backed by any OpenAI-compatible endpoint. The handler probes the target API with the supplied credentials before persisting the model.

Example Usage

from orq_ai_sdk import Orq
import os


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

    res = orq.models.create_openai_like(api_key="<value>", base_url="https://guilty-cap.org/", display_name="Richard.Beatty45", model_id="<id>", model_type="<value>", region="<value>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
api_key str ✔️ N/A
base_url str ✔️ N/A
display_name str ✔️ N/A
model_id str ✔️ N/A
model_type str ✔️ N/A
region str ✔️ N/A
cache_read_cost Optional[float] ➖ N/A
cache_write_cost Optional[float] ➖ N/A
cost_per_image Optional[float] ➖ N/A
description Optional[str] ➖ N/A
has_reasoning Optional[bool] ➖ N/A
input_cost Optional[float] ➖ N/A
max_tokens Optional[int] ➖ N/A
output_cost Optional[float] ➖ N/A
supports_image_edit Optional[bool] ➖ N/A
supports_strict_tool Optional[bool] ➖ N/A
supports_tool_calling Optional[bool] ➖ N/A
supports_vision Optional[bool] ➖ N/A
temperature Optional[float] ➖ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.ModelCreateOpenAILikeResponseBody

Errors

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

update_openai_like

Updates an OpenAI-compatible custom model. Live-re-probes the target API when base_url or model_id changes, using the stored encrypted api_key. Metadata is merged (existing preserved, new overrides).

Example Usage

from orq_ai_sdk import Orq
import os


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

    res = orq.models.update_openai_like(id="<id>", display_name="Verlie82", model_type="<value>", region="<value>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
id str ✔️ The ID of the model
display_name str ✔️ N/A GPT-4o Compatible
model_type str ✔️ N/A
region str ✔️ N/A
base_url Optional[str] ➖ N/A
cache_read_cost Optional[float] ➖ N/A
cache_write_cost Optional[float] ➖ N/A
cost_per_image Optional[float] ➖ N/A
description Optional[str] ➖ N/A
has_reasoning Optional[bool] ➖ N/A
input_cost Optional[float] ➖ N/A
max_tokens Optional[int] ➖ N/A
model_id Optional[str] ➖ N/A
output_cost Optional[float] ➖ N/A
supports_image_edit Optional[bool] ➖ N/A
supports_strict_tool Optional[bool] ➖ N/A
supports_tool_calling Optional[bool] ➖ N/A
supports_vision Optional[bool] ➖ N/A
temperature Optional[float] ➖ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.ModelUpdateOpenAILikeResponseBody

Errors

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

validate

Validates a provider endpoint by performing a minimal live probe. Currently supports Azure OpenAI. Response includes the resolved region, whether the model is known to Orq, and either the full model document or a synthesized default.

Example Usage

from orq_ai_sdk import Orq
import os


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

    orq.models.validate(api_key="<value>", provider="<value>")

    # Use the SDK ...

Parameters

Parameter Type Required Description
api_key str ✔️ N/A
provider str ✔️ N/A
api_version Optional[str] ➖ N/A
base_url Optional[str] ➖ N/A
deployment_name Optional[str] ➖ N/A
endpoint Optional[str] ➖ N/A
subtype Optional[str] ➖ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Errors

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

create_vertex

Registers a Google Vertex AI model as a custom model for the workspace. The service account credentials are probed against Vertex AI with a minimal GenerateContent call before persisting.

Example Usage

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.models.create_vertex(configuration=orq_ai_sdk.VertexConfiguration(
        location="<value>",
        model_configuration=orq_ai_sdk.VertexModelConfiguration(
            capabilities=orq_ai_sdk.VertexCapabilities(
                structured_output=True,
                support_tool_calling=False,
                vision=True,
            ),
            id="<id>",
            input_cost=6100.6,
            output_cost=4860.06,
            parameters=orq_ai_sdk.VertexParameters(
                max_tokens=orq_ai_sdk.VertexParamRangeInt(
                    max=816266,
                    min=370614,
                ),
                temperature=orq_ai_sdk.VertexParamRange(
                    max=1989.61,
                    min=8564.64,
                ),
                top_p=orq_ai_sdk.VertexParamRange(
                    max=3250.24,
                    min=8051.01,
                ),
            ),
        ),
        project_id="<id>",
        service_account={
            "key": "<value>",
            "key1": "<value>",
            "key2": "<value>",
        },
    ), display_name="Birdie_Bailey-Abernathy")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
configuration models.VertexConfiguration ✔️ N/A
display_name str ✔️ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.ModelCreateVertexResponseBody

Errors

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

delete

Deletes a custom model from the workspace. System models cannot be deleted. Returns 200 with an explanatory message if the model is a system model or is still referenced by experiments.

Example Usage

from orq_ai_sdk import Orq
import os


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

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

    # Use the SDK ...

Parameters

Parameter Type Required Description
id str ✔️ The ID of the model
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Errors

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

update

Updates a custom model. Only fields present in the request body are modified, except for metadata and parameters, which are fully replaced when present (preserved from the legacy handler's behavior).

Example Usage

from orq_ai_sdk import Orq
import os


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

    res = orq.models.update(id="<id>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
id str ✔️ The ID of the model
display_name Optional[str] ➖ N/A
has_functions Optional[bool] ➖ N/A
input_cost Optional[float] ➖ N/A
metadata Optional[models.ModelMetadata] ➖ N/A
model_type Optional[str] ➖ N/A
output_cost Optional[float] ➖ N/A
parameters List[models.UpdateModelParameter] ➖ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.ModelUpdateResponseBody

Errors

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

enable

Adds the model to the workspace's enabled set. Idempotent — re-enabling an already-enabled model returns 204 with no state change.

Example Usage

from orq_ai_sdk import Orq
import os


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

    orq.models.enable(model_id="<id>")

    # Use the SDK ...

Parameters

Parameter Type Required Description
model_id str ✔️ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Errors

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

disable

Removes the model from the workspace's enabled set. Idempotent — disabling an already-disabled model returns 204.

Example Usage

from orq_ai_sdk import Orq
import os


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

    orq.models.disable(model_id="<id>")

    # Use the SDK ...

Parameters

Parameter Type Required Description
model_id str ✔️ The ID of the model to disable
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Errors

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

list

Lists all models available through the AI Router. Returns each model in OpenAI-compatible shape with its provider, ID, and creation timestamp.

Example Usage

from orq_ai_sdk import Orq
import os


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

    res = orq.models.list()

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.ListModelsResponseBody

Errors

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