Skip to content

Latest commit

 

History

History
188 lines (135 loc) · 40.2 KB

File metadata and controls

188 lines (135 loc) · 40.2 KB

DeploymentsSDK

(deployments)

Overview

Available Operations

all

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

Example Usage

from orq_poc_python_multi_env_version import Orq
import os

with Orq(
    api_key=os.getenv("ORQ_API_KEY", ""),
) as s:
    res = s.deployments.all()

    if res is not None:
        # handle response
        pass

Parameters

Parameter Type Required Description
limit Optional[float] A limit on the number of objects to be returned. Limit can range between 1 and 50, and the default is 10
after Optional[str] A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 20 objects, ending with ed33dade-ae32-4959-8c5c-7ae4aad748b5, your subsequent call can include after=ed33dade-ae32-4959-8c5c-7ae4aad748b5 in order to fetch the next page of the list.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.DeploymentsResponseBody

Errors

Error Type Status Code Content Type
models.HonoAPIError 500 application/json
models.APIError 4XX, 5XX */*

invalidate

Explicitly invalidate a cache of a deployment

Example Usage

from orq_poc_python_multi_env_version import Orq
import os

with Orq(
    api_key=os.getenv("ORQ_API_KEY", ""),
) as s:
    s.deployments.invalidate(deployment_id="e1106c66-dcfb-4003-a0e1-3c49405187d4")

    # Use the SDK ...

Parameters

Parameter Type Required Description
deployment_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.APIError 4XX, 5XX */*

get_config

Retrieve the deployment configuration

Example Usage

from orq_poc_python_multi_env_version import Orq
import os

with Orq(
    api_key=os.getenv("ORQ_API_KEY", ""),
) as s:
    res = s.deployments.get_config(key="<key>")

    if res is not None:
        # handle response
        pass

Parameters

Parameter Type Required Description
key str ✔️ The deployment id to invoke
inputs Dict[str, models.DeploymentGetConfigInputs] Key-value pairs variables to replace in your prompts. If a variable is not provided that is defined in the prompt, the default variables are used.
context Dict[str, Any] Key-value pairs that match your data model and fields declared in your configuration matrix. If you send multiple prompt keys, the context will be applied to the evaluation of each key.
prefix_messages List[models.DeploymentGetConfigPrefixMessages] A list of messages to include after the System message, but before the User and Assistant pairs configured in your deployment.
messages List[models.DeploymentGetConfigMessages] A list of messages to send to the deployment.
file_ids List[str] A list of file IDs that are associated with the deployment request.
metadata Dict[str, Any] Key-value pairs that you want to attach to the log generated by this request.
chain_id Optional[str] Unique ID that identifies a chaining operation. This is useful for tracking a chain of completions across multiple
conversation_id Optional[str] Unique ID that identifies a chat conversation. This is useful for tracking the same conversation across multiple requests
user_id Optional[models.DeploymentGetConfigUserID] Unique ID that identifies a user. This is useful for tracking the same user across multiple requests
deployment_id Optional[str] Unique ID that identifies a deployment entity.
deployment_variant_id Optional[str] Unique ID that identifies a specific variant of a deployment.
extra_params Dict[str, Any] Utilized for passing additional parameters to the model provider. Exercise caution when using this feature, as the included parameters will overwrite any parameters specified in the deployment prompt configuration.
invoke_options Optional[models.DeploymentGetConfigInvokeOptions] N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.DeploymentGetConfigResponseBody

Errors

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

invoke

Invoke a deployment with a given payload

Example Usage

from orq_poc_python_multi_env_version import Orq
import os

with Orq(
    api_key=os.getenv("ORQ_API_KEY", ""),
) as s:
    res = s.deployments.invoke(key="<key>")

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

Parameters

Parameter Type Required Description
key str ✔️ The deployment id to invoke
stream Optional[bool] If set, partial message content will be sent. Tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message.
inputs Dict[str, models.Inputs] Key-value pairs variables to replace in your prompts. If a variable is not provided that is defined in the prompt, the default variables are used.
context Dict[str, Any] Key-value pairs that match your data model and fields declared in your configuration matrix. If you send multiple prompt keys, the context will be applied to the evaluation of each key.
prefix_messages List[models.PrefixMessages] A list of messages to include after the System message, but before the User and Assistant pairs configured in your deployment.
messages List[models.Messages] A list of messages to send to the deployment.
file_ids List[str] A list of file IDs that are associated with the deployment request.
metadata Dict[str, Any] Key-value pairs that you want to attach to the log generated by this request.
chain_id Optional[str] Unique ID that identifies a chaining operation. This is useful for tracking a chain of completions across multiple
conversation_id Optional[str] Unique ID that identifies a chat conversation. This is useful for tracking the same conversation across multiple requests
user_id Optional[models.UserID] Unique ID that identifies a user. This is useful for tracking the same user across multiple requests
deployment_id Optional[str] Unique ID that identifies a deployment entity.
deployment_variant_id Optional[str] Unique ID that identifies a specific variant of a deployment.
extra_params Dict[str, Any] Utilized for passing additional parameters to the model provider. Exercise caution when using this feature, as the included parameters will overwrite any parameters specified in the deployment prompt configuration.
invoke_options Optional[models.InvokeOptions] N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.DeploymentInvokeResponse

Errors

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