(deployments)
- list - List all deployments
- get_config - Get config
- invoke - Invoke
- stream - Stream
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()
assert res is not None
# Handle response
print(res)
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 |
starting_after |
Optional[str] | ➖ | A cursor for use in pagination. starting_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 01JJ1HDHN79XAS7A01WB3HYSDB , your subsequent call can include after=01JJ1HDHN79XAS7A01WB3HYSDB in order to fetch the next page of the list. |
ending_before |
Optional[str] | ➖ | A cursor for use in pagination. ending_before is an object ID that defines your place in the list. For instance, if you make a list request and receive 20 objects, starting with 01JJ1HDHN79XAS7A01WB3HYSDB , your subsequent call can include before=01JJ1HDHN79XAS7A01WB3HYSDB in order to fetch the previous page of the list. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.DeploymentsResponseBody
Error Type | Status Code | Content Type |
---|---|---|
models.HonoAPIError | 500 | application/json |
models.APIError | 4XX, 5XX | */* |
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>")
assert res is not None
# Handle response
print(res)
Parameter | Type | Required | Description |
---|---|---|---|
key |
str | ✔️ | The deployment key 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. |
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. |
documents |
List[models.DeploymentGetConfigDocuments] | ➖ | A list of relevant documents that evaluators and guardrails can cite to evaluate the user input or the model response based on your deployment settings. |
invoke_options |
Optional[models.DeploymentGetConfigInvokeOptions] | ➖ | N/A |
thread |
Optional[models.DeploymentGetConfigThread] | ➖ | N/A |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.DeploymentGetConfigResponseBody
Error Type | Status Code | Content Type |
---|---|---|
models.APIError | 4XX, 5XX | */* |
Invoke a deployment with a given payload
from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.deployments.invoke(key="<key>")
assert res is not None
# Handle response
print(res)
Parameter | Type | Required | Description |
---|---|---|---|
key |
str | ✔️ | The deployment key to invoke |
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. |
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. |
documents |
List[models.Documents] | ➖ | A list of relevant documents that evaluators and guardrails can cite to evaluate the user input or the model response based on your deployment settings. |
invoke_options |
Optional[models.InvokeOptions] | ➖ | N/A |
thread |
Optional[models.Thread] | ➖ | N/A |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.DeploymentInvokeResponseBody
Error Type | Status Code | Content Type |
---|---|---|
models.APIError | 4XX, 5XX | */* |
Stream deployment generation. Only supported for completions and chat completions.
from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.deployments.stream(key="<key>")
assert res is not None
with res as event_stream:
for event in event_stream:
# handle event
print(event, flush=True)
Parameter | Type | Required | Description |
---|---|---|---|
key |
str | ✔️ | The deployment key to invoke |
inputs |
Dict[str, models.DeploymentStreamInputs] | ➖ | 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.DeploymentStreamPrefixMessages] | ➖ | A list of messages to include after the System message, but before the User and Assistant pairs configured in your deployment. |
messages |
List[models.DeploymentStreamMessages] | ➖ | 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. |
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. |
documents |
List[models.DeploymentStreamDocuments] | ➖ | A list of relevant documents that evaluators and guardrails can cite to evaluate the user input or the model response based on your deployment settings. |
invoke_options |
Optional[models.DeploymentStreamInvokeOptions] | ➖ | N/A |
thread |
Optional[models.DeploymentStreamThread] | ➖ | N/A |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Error Type | Status Code | Content Type |
---|---|---|
models.APIError | 4XX, 5XX | */* |