Deployments
Invoke a Deployment
Invoke a deployment with a given payloadfrom orq_ai_sdk import Orq
import os
with Orq(
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)
import { Orq } from "@orq-ai/node";
const orq = new Orq({
apiKey: process.env["ORQ_API_KEY"] ?? "",
});
async function run() {
const result = await orq.deployments.invoke({
key: "<key>",
identity: {
id: "contact_01ARZ3NDEKTSV4RRFFQ69G5FAV",
displayName: "Jane Doe",
email: "jane.doe@example.com",
metadata: [
{
"department": "Engineering",
"role": "Senior Developer",
},
],
logoUrl: "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: {
fileName: "refund_policy.pdf",
fileType: "application/pdf",
pageNumber: 1,
},
},
{
text: "Premium members receive free shipping on all orders over $50.",
metadata: {
fileName: "membership_benefits.md",
fileType: "text/markdown",
},
},
],
});
console.log(result);
}
run();
Show Parameters
Show Parameters
{
"key": str, # required
"stream": Optional[bool],
"inputs": Dict[str, Any],
"context": Dict[str, Any],
"prefix_messages": Union[SystemMessage, DeveloperMessage, UserMessage, AssistantMessage, ToolMessage],
"messages": Union[MessagesSystemMessage, MessagesDeveloperMessage, MessagesUserMessage, MessagesAssistantMessage, MessagesToolMessage],
"identity": { # optional
"id": str, # required
"display_name": Optional[str],
"email": Optional[str],
"metadata": List[Dict[str, Any]],
"logo_url": Optional[str],
"tags": List[str],
},
"file_ids": List[str],
"metadata": Dict[str, Any],
"extra_params": Dict[str, Any],
"documents": { # optional
"text": str, # required
"metadata": { # optional
"file_name": Optional[str],
"file_type": Optional[str],
"page_number": Optional[float],
},
},
"invoke_options": { # optional
"include_retrievals": Optional[bool],
"include_usage": Optional[bool],
"mock_response": Optional[str],
},
"thread": { # optional
"id": str, # required
"tags": List[str],
},
"knowledge_filter": Union[Dict[str, KnowledgeFilter1], KnowledgeFilterAnd, KnowledgeFilterOr],
}
{
key: string; // required
stream?: boolean;
inputs?: Record<string, any>;
context?: Record<string, any>;
prefixMessages?: string;
messages?: string;
identity?: {
id: string; // required
displayName?: string;
email?: string;
metadata?: Record<string, any>[];
logoUrl?: string;
tags?: string[];
};
fileIds?: string[];
metadata?: Record<string, any>;
extraParams?: Record<string, any>;
documents?: {
text: string; // required
metadata?: {
fileName?: string;
fileType?: string;
pageNumber?: number;
};
};
invokeOptions?: {
includeRetrievals?: boolean;
includeUsage?: boolean;
mockResponse?: string;
};
thread?: {
id: string; // required
tags?: string[];
};
knowledgeFilter?: string;
}
Show Response
Show Response
{
"id": str,
"created": date,
"object": Literal["chat", "completion", "image"],
"model": str,
"provider": Literal["openai", "groq", "cohere", "azure", "aws", "google", "google-ai", "huggingface", "togetherai", "perplexity", "anthropic", "leonardoai", "fal", "nvidia", "jina", "elevenlabs", "cerebras", "openailike", "bytedance", "mistral", "deepseek", "moonshotai", "zai", "minimax", "xai", "alibaba", "tensorix", "scaleway", "hcompany", "inceptron", "wafer", "slack", "orq"],
"is_final": bool,
"integration_id": Optional[str],
"telemetry": {
"trace_id": str,
"span_id": str,
},
"finalized": date,
"system_fingerprint": OptionalNullable[str],
"retrievals": { # optional
"document": str,
"metadata": {
"file_name": str,
"page_number": Nullable[float],
"file_type": str,
"rerank_score": Optional[float],
"search_score": float,
},
},
"provider_response": Optional[Any],
"usage": { # optional
"total_tokens": Optional[float],
"prompt_tokens": Optional[float],
"completion_tokens": Optional[float],
"prompt_tokens_details": { # optional
"cached_tokens": OptionalNullable[float],
},
"completion_tokens_details": { # optional
"reasoning_tokens": OptionalNullable[float],
},
},
"choices": {
"index": float,
"message": Union[Message1, Message2, Message3],
"finish_reason": OptionalNullable[str],
},
}
{
id: string;
created: Date;
object: string;
model: string;
provider: string;
isFinal: boolean;
integrationId?: string;
telemetry: {
traceId: string;
spanId: string;
};
finalized?: Date;
systemFingerprint?: string;
retrievals?: {
document: string;
metadata: {
fileName: string;
pageNumber: number;
fileType: string;
rerankScore?: number;
searchScore: number;
};
};
providerResponse?: any;
usage?: {
totalTokens?: number;
promptTokens?: number;
completionTokens?: number;
promptTokensDetails?: {
cachedTokens?: number;
};
completionTokensDetails?: {
reasoningTokens?: number;
};
};
choices: {
index: number;
message: string;
finishReason?: string;
};
}
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)
import { Orq } from "@orq-ai/node";
const orq = new Orq({
apiKey: process.env["ORQ_API_KEY"] ?? "",
});
async function run() {
const result = await orq.deployments.list({});
console.log(result);
}
run();
Show Parameters
Show Parameters
{
"limit": Optional[int],
"starting_after": Optional[str],
"ending_before": Optional[str],
}
{
limit?: number;
startingAfter?: string;
endingBefore?: string;
}
Show Response
Show Response
{
"object": Literal["list"],
"data": {
"id": str,
"created": str,
"updated": str,
"key": str,
"description": str,
"prompt_config": {
"tools": {
"display_name": Optional[str],
"type": Literal["function"],
"function": {
"name": str,
"description": Optional[str],
"strict": Optional[bool],
"parameters": {
"type": DeploymentsDeploymentsResponse200Type,
"properties": Dict[str, Any],
"required": List[str],
"additional_properties": Optional[Literal[False]],
},
},
"id": Optional[float],
},
"model": str,
"model_type": Literal["chat", "completion", "embedding", "image", "tts", "stt", "rerank", "ocr", "moderation", "vision"],
"model_parameters": {
"temperature": Optional[float],
"max_tokens": Optional[float],
"top_k": Optional[float],
"top_p": Optional[float],
"frequency_penalty": Optional[float],
"presence_penalty": Optional[float],
"num_images": Optional[float],
"seed": Optional[float],
"format_": Optional[Literal["url", "b64_json", "text", "json_object"]],
"dimensions": Optional[str],
"quality": Optional[str],
"style": Optional[str],
"response_format": Union[DeploymentsResponseFormat1, DeploymentsResponseFormat2, DeploymentsResponseFormat3, DeploymentsResponseFormat4, DeploymentsResponseFormat5, DeploymentsResponseFormat6],
"cache_control": { # optional
"type": Literal["ephemeral"],
"ttl": Optional[Literal["5m", "1h"]],
},
"photo_real_version": Optional[Literal["v1", "v2"]],
"encoding_format": Optional[Literal["float", "base64"]],
"reasoning_effort": Optional[Literal["none", "disable", "minimal", "low", "medium", "high"]],
"budget_tokens": Optional[float],
"verbosity": Optional[Literal["low", "medium", "high"]],
"thinking_level": Optional[Literal["low", "medium", "high"]],
},
"provider": Literal["openai", "groq", "cohere", "azure", "aws", "google", "google-ai", "huggingface", "togetherai", "perplexity", "anthropic", "leonardoai", "fal", "nvidia", "jina", "elevenlabs", "cerebras", "openailike", "bytedance", "mistral", "deepseek", "moonshotai", "zai", "minimax", "xai", "alibaba", "tensorix", "scaleway", "hcompany", "inceptron", "wafer", "slack", "orq"],
"messages": {
"role": Literal["system", "developer", "assistant", "user", "exception", "tool", "prompt", "correction", "expected_output"],
"content": Union[str, List[DeploymentsContent2]],
"tool_calls": { # optional
"id": Optional[str],
"index": Optional[float],
"type": Literal["function"],
"function": {
"name": str,
"arguments": str,
},
},
"tool_call_id": OptionalNullable[str],
},
},
"version": str,
},
"has_more": bool,
}
{
object: string;
data: {
id: string;
created: string;
updated: string;
key: string;
description: string;
promptConfig: {
tools: {
displayName?: string;
type: string;
function: {
name: string;
description?: string;
strict?: boolean;
parameters: {
type: string;
properties: Record<string, any>;
required?: string[];
additionalProperties?: false;
};
};
id?: number;
};
model: string;
modelType: string;
modelParameters: {
temperature?: number;
maxTokens?: number;
topK?: number;
topP?: number;
frequencyPenalty?: number;
presencePenalty?: number;
numImages?: number;
seed?: number;
format?: string;
dimensions?: string;
quality?: string;
style?: string;
responseFormat?: string;
cacheControl?: {
type: string;
ttl?: string;
};
photoRealVersion?: string;
encodingFormat?: string;
reasoningEffort?: string;
budgetTokens?: number;
verbosity?: string;
thinkingLevel?: string;
};
provider: string;
messages: {
role: string;
content: string;
toolCalls?: {
id?: string;
index?: number;
type: string;
function: {
name: string;
arguments: string;
};
};
toolCallId?: string;
};
};
version: string;
};
hasMore: boolean;
}
Get Config
Retrieve the deployment configurationfrom 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)
import { Orq } from "@orq-ai/node";
const orq = new Orq({
apiKey: process.env["ORQ_API_KEY"] ?? "",
});
async function run() {
const result = await orq.deployments.getConfig({
key: "<key>",
identity: {
id: "contact_01ARZ3NDEKTSV4RRFFQ69G5FAV",
displayName: "Jane Doe",
email: "jane.doe@example.com",
metadata: [
{
"department": "Engineering",
"role": "Senior Developer",
},
],
logoUrl: "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: {
fileName: "refund_policy.pdf",
fileType: "application/pdf",
pageNumber: 1,
},
},
{
text: "Premium members receive free shipping on all orders over $50.",
metadata: {
fileName: "membership_benefits.md",
fileType: "text/markdown",
},
},
],
});
console.log(result);
}
run();
Show Parameters
Show Parameters
{
"key": str, # required
"inputs": Dict[str, Any],
"context": Dict[str, Any],
"prefix_messages": Union[PrefixMessagesSystemMessage, PrefixMessagesDeveloperMessage, PrefixMessagesUserMessage, PrefixMessagesAssistantMessage, PrefixMessagesToolMessage],
"messages": Union[DeploymentGetConfigMessagesSystemMessage, DeploymentGetConfigMessagesDeveloperMessage, DeploymentGetConfigMessagesUserMessage, DeploymentGetConfigMessagesAssistantMessage, DeploymentGetConfigMessagesToolMessage],
"identity": { # optional
"id": str, # required
"display_name": Optional[str],
"email": Optional[str],
"metadata": List[Dict[str, Any]],
"logo_url": Optional[str],
"tags": List[str],
},
"file_ids": List[str],
"metadata": Dict[str, Any],
"extra_params": Dict[str, Any],
"documents": { # optional
"text": str, # required
"metadata": { # optional
"file_name": Optional[str],
"file_type": Optional[str],
"page_number": Optional[float],
},
},
"invoke_options": { # optional
"include_retrievals": Optional[bool],
"include_usage": Optional[bool],
"mock_response": Optional[str],
},
"thread": { # optional
"id": str, # required
"tags": List[str],
},
"knowledge_filter": Union[Dict[str, DeploymentGetConfigKnowledgeFilter1], DeploymentGetConfigKnowledgeFilterAnd, DeploymentGetConfigKnowledgeFilterOr],
}
{
key: string; // required
inputs?: Record<string, any>;
context?: Record<string, any>;
prefixMessages?: string;
messages?: string;
identity?: {
id: string; // required
displayName?: string;
email?: string;
metadata?: Record<string, any>[];
logoUrl?: string;
tags?: string[];
};
fileIds?: string[];
metadata?: Record<string, any>;
extraParams?: Record<string, any>;
documents?: {
text: string; // required
metadata?: {
fileName?: string;
fileType?: string;
pageNumber?: number;
};
};
invokeOptions?: {
includeRetrievals?: boolean;
includeUsage?: boolean;
mockResponse?: string;
};
thread?: {
id: string; // required
tags?: string[];
};
knowledgeFilter?: string;
}
Show Response
Show Response
{
"id": str,
"provider": str,
"model": str,
"type": Optional[Literal["chat", "completion", "embedding", "image", "tts", "stt", "rerank", "ocr", "moderation", "vision"]],
"version": str,
"messages": {
"role": Literal["system", "developer", "assistant", "user", "exception", "tool", "prompt", "correction", "expected_output"],
"content": Union[str, List[DeploymentGetConfigContentDeploymentsResponse2]],
"tool_calls": { # optional
"id": Optional[str],
"index": Optional[float],
"type": Literal["function"],
"function": {
"name": str,
"arguments": str,
},
},
"tool_call_id": OptionalNullable[str],
},
"parameters": {
"temperature": Optional[float],
"max_tokens": Optional[float],
"top_k": Optional[float],
"top_p": Optional[float],
"frequency_penalty": Optional[float],
"presence_penalty": Optional[float],
"num_images": Optional[float],
"seed": Optional[float],
"format_": Optional[Literal["url", "b64_json", "text", "json_object"]],
"dimensions": Optional[str],
"quality": Optional[str],
"style": Optional[str],
"response_format": Union[ResponseFormat1, ResponseFormat2, ResponseFormat3, ResponseFormat4, ResponseFormat5, ResponseFormat6],
"cache_control": { # optional
"type": Literal["ephemeral"],
"ttl": Optional[Literal["5m", "1h"]],
},
"photo_real_version": Optional[Literal["v1", "v2"]],
"encoding_format": Optional[Literal["float", "base64"]],
"reasoning_effort": Optional[Literal["none", "disable", "minimal", "low", "medium", "high"]],
"budget_tokens": Optional[float],
"verbosity": Optional[Literal["low", "medium", "high"]],
"thinking_level": Optional[Literal["low", "medium", "high"]],
},
"tools": { # optional
"type": Literal["function"],
"function": {
"name": str,
"description": Optional[str],
"parameters": Dict[str, Any],
},
},
}
{
id: string;
provider: string;
model: string;
type?: string;
version: string;
messages: {
role: string;
content: string;
toolCalls?: {
id?: string;
index?: number;
type: string;
function: {
name: string;
arguments: string;
};
};
toolCallId?: string;
};
parameters: {
temperature?: number;
maxTokens?: number;
topK?: number;
topP?: number;
frequencyPenalty?: number;
presencePenalty?: number;
numImages?: number;
seed?: number;
format?: string;
dimensions?: string;
quality?: string;
style?: string;
responseFormat?: string;
cacheControl?: {
type: string;
ttl?: string;
};
photoRealVersion?: string;
encodingFormat?: string;
reasoningEffort?: string;
budgetTokens?: number;
verbosity?: string;
thinkingLevel?: string;
};
tools?: {
type: string;
function: {
name: string;
description?: string;
parameters?: Record<string, any>;
};
};
}
Stream a Deployment
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>", 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)
import { Orq } from "@orq-ai/node";
const orq = new Orq({
apiKey: process.env["ORQ_API_KEY"] ?? "",
});
async function run() {
const result = await orq.deployments.stream({
key: "<key>",
identity: {
id: "contact_01ARZ3NDEKTSV4RRFFQ69G5FAV",
displayName: "Jane Doe",
email: "jane.doe@example.com",
metadata: [
{
"department": "Engineering",
"role": "Senior Developer",
},
],
logoUrl: "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: {
fileName: "refund_policy.pdf",
fileType: "application/pdf",
pageNumber: 1,
},
},
{
text: "Premium members receive free shipping on all orders over $50.",
metadata: {
fileName: "membership_benefits.md",
fileType: "text/markdown",
},
},
],
});
for await (const event of result) {
console.log(event);
}
}
run();
Show Parameters
Show Parameters
{
"key": str, # required
"inputs": Dict[str, Any],
"context": Dict[str, Any],
"prefix_messages": Union[DeploymentStreamPrefixMessagesSystemMessage, DeploymentStreamPrefixMessagesDeveloperMessage, DeploymentStreamPrefixMessagesUserMessage, DeploymentStreamPrefixMessagesAssistantMessage, DeploymentStreamPrefixMessagesToolMessage],
"messages": Union[DeploymentStreamMessagesSystemMessage, DeploymentStreamMessagesDeveloperMessage, DeploymentStreamMessagesUserMessage, DeploymentStreamMessagesAssistantMessage, DeploymentStreamMessagesToolMessage],
"identity": { # optional
"id": str, # required
"display_name": Optional[str],
"email": Optional[str],
"metadata": List[Dict[str, Any]],
"logo_url": Optional[str],
"tags": List[str],
},
"file_ids": List[str],
"metadata": Dict[str, Any],
"extra_params": Dict[str, Any],
"documents": { # optional
"text": str, # required
"metadata": { # optional
"file_name": Optional[str],
"file_type": Optional[str],
"page_number": Optional[float],
},
},
"invoke_options": { # optional
"include_retrievals": Optional[bool],
"include_usage": Optional[bool],
"mock_response": Optional[str],
},
"thread": { # optional
"id": str, # required
"tags": List[str],
},
"knowledge_filter": Union[Dict[str, DeploymentStreamKnowledgeFilter1], DeploymentStreamKnowledgeFilterAnd, DeploymentStreamKnowledgeFilterOr],
}
{
key: string; // required
inputs?: Record<string, any>;
context?: Record<string, any>;
prefixMessages?: string;
messages?: string;
identity?: {
id: string; // required
displayName?: string;
email?: string;
metadata?: Record<string, any>[];
logoUrl?: string;
tags?: string[];
};
fileIds?: string[];
metadata?: Record<string, any>;
extraParams?: Record<string, any>;
documents?: {
text: string; // required
metadata?: {
fileName?: string;
fileType?: string;
pageNumber?: number;
};
};
invokeOptions?: {
includeRetrievals?: boolean;
includeUsage?: boolean;
mockResponse?: string;
};
thread?: {
id: string; // required
tags?: string[];
};
knowledgeFilter?: string;
}