Prompts
Update a Prompt
Update a prompt by ID with the provided fields.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-sonnet-5",
"temperature": 0.5,
}, path="Default")
# 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.prompts.update({
id: "<id>",
requestBody: {
prompt: {
messages: [
{
role: "system",
content: "You are a helpful assistant",
},
{
role: "user",
content: "Hello!",
},
],
model: "anthropic/claude-sonnet-5",
temperature: 0.5,
},
path: "Default",
},
});
console.log(result);
}
run();
Show Parameters
Show Parameters
{
"id": str, # required
"owner": Optional[str],
"domain_id": Optional[str],
"created": Optional[str],
"updated": Optional[str],
"created_by_id": Optional[str],
"updated_by_id": Optional[str],
"display_name": Optional[str],
"description": Optional[str],
"prompt": { # optional
"messages": List[Union[UpdatePromptMessagesSystemMessage, UpdatePromptMessagesUserMessage, UpdatePromptMessagesAssistantMessage, UpdatePromptMessagesToolMessage]], # optional
"model": Optional[str],
"name": Optional[str],
"audio": { # optional
"voice": Literal["alloy", "echo", "fable", "onyx", "nova", "shimmer"], # required
"format_": Literal["wav", "mp3", "flac", "opus", "pcm16"], # required
},
"frequency_penalty": Optional[float],
"max_tokens": Optional[int],
"max_completion_tokens": Optional[int],
"logprobs": Optional[bool],
"top_logprobs": Optional[int],
"n": Optional[int],
"presence_penalty": Optional[float],
"response_format": { # optional
# one of: UpdatePromptResponseFormatText, UpdatePromptResponseFormatJSONObject, UpdatePromptResponseFormatJSONSchema
"type": Union[Union[Literal["text"], Literal["json_object"]], Literal["json_schema"]], # required
"json_schema": { # required (variant-specific)
"description": Optional[str],
"name": str, # required
"schema_": Optional[Any],
"strict": Optional[bool],
},
},
"reasoning_effort": Optional[Literal["none", "instant", "minimal", "low", "medium", "high", "xhigh", "max"]],
"verbosity": Optional[str],
"seed": Optional[float],
"stop": Union[str, List[str]], # optional
"stream_options": { # optional
"include_usage": Optional[bool],
},
"thinking": { # optional
# one of: ThinkingConfigDisabledSchema, ThinkingConfigEnabledSchema, ThinkingConfigAdaptiveSchema, ThinkingConfigBetweenToolsSchema
"type": Union[Union[Union[Literal["disabled"], Literal["enabled"]], Literal["adaptive"]], Literal["between_tools"]], # required
"budget_tokens": Union[float, Optional[float]], # required (variant-specific)
"thinking_level": Optional[Literal["minimal", "low", "medium", "high"]],
"display": Optional[Literal["summarized", "omitted", "updates"]],
},
"temperature": Optional[float],
"top_p": Optional[float],
"top_k": Optional[float],
"tool_choice": { # optional
# one of: UpdatePromptToolChoice1, UpdatePromptToolChoice2
"type": Optional[Literal["function"]],
"function": { # required (variant-specific)
"name": str, # required
},
},
"parallel_tool_calls": Optional[bool],
"modalities": List[Literal["text", "audio"]], # optional
"guardrails": [{ # optional
"id": Union[Literal["orq_pii_detection", "orq_secret_detection", "orq_sexual_moderation", "orq_harmful_moderation"], str], # required
"execute_on": Literal["input", "output"], # required
}],
"plugins": List[Union[PIIRedactionPlugin, ResponseHealingPlugin, TraceScrubbingPlugin]], # optional
"fallback_on_codes": List[int], # optional
"fallbacks": [{ # optional
"model": str, # required
}],
"retry": { # optional
"count": Optional[float],
"on_codes": List[float], # optional
},
"cache": { # optional
"ttl": Optional[float],
"type": Literal["exact_match"], # required
},
"load_balancer": { # optional
# one of: UpdatePromptLoadBalancer1
"type": Literal["weight_based"], # required
"models": [{ # required
"model": str, # required
"weight": Optional[float],
}],
},
"timeout": { # optional
"call_timeout": float, # required
},
"cache_control": { # optional
"type": Literal["ephemeral"], # required
"ttl": Optional[Literal["5m", "1h"]],
},
"prompt_cache_key": Optional[str],
},
"metadata": { # optional
"use_cases": List[Literal["Agents simulations", "Agents", "API interaction", "Autonomous Agents", "Chatbots", "Classification", "Code understanding", "Code writing", "Conversation", "Documents QA", "Evaluation", "Extraction", "Multi-modal", "Self-checking", "Sentiment analysis", "SQL", "Summarization", "Tagging", "Translation (document)", "Translation (sentences)"]], # optional
"language": Optional[Literal["Chinese", "Dutch", "English", "French", "German", "Russian", "Spanish"]],
},
"path": Optional[str],
}
{
id: string; // required
requestBody?: {
owner?: string;
domainId?: string;
created?: string;
updated?: string;
createdById?: string;
updatedById?: string;
displayName?: string;
description?: string;
prompt?: {
messages?: (UpdatePromptMessagesSystemMessage | UpdatePromptMessagesUserMessage | UpdatePromptMessagesAssistantMessage | UpdatePromptMessagesToolMessage)[];
model?: string;
name?: string;
audio?: {
voice: "alloy" | "echo" | "fable" | "onyx" | "nova" | "shimmer"; // required
format: "wav" | "mp3" | "flac" | "opus" | "pcm16"; // required
};
frequencyPenalty?: number;
maxTokens?: number;
maxCompletionTokens?: number;
logprobs?: boolean;
topLogprobs?: number;
n?: number;
presencePenalty?: number;
responseFormat?: {
// one of: UpdatePromptResponseFormatText, UpdatePromptResponseFormatJSONObject, UpdatePromptResponseFormatJSONSchema
type: "text" | "json_object" | "json_schema"; // required
jsonSchema: { // required (variant-specific)
description?: string;
name: string; // required
schema?: any;
strict?: boolean;
};
};
reasoningEffort?: "none" | "instant" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
verbosity?: string;
seed?: number;
stop?: string | string[];
streamOptions?: {
includeUsage?: boolean;
};
thinking?: {
// one of: ThinkingConfigDisabledSchema, ThinkingConfigEnabledSchema, ThinkingConfigAdaptiveSchema, ThinkingConfigBetweenToolsSchema
type: "disabled" | "enabled" | "adaptive" | "between_tools"; // required
budgetTokens: number; // required (variant-specific)
thinkingLevel?: "minimal" | "low" | "medium" | "high";
display?: "summarized" | "omitted" | "updates";
};
temperature?: number;
topP?: number;
topK?: number;
toolChoice?: {
// one of: UpdatePromptToolChoice1, UpdatePromptToolChoice2
type?: "function";
function: { // required (variant-specific)
name: string; // required
};
};
parallelToolCalls?: boolean;
modalities?: ("text" | "audio")[];
guardrails?: {
id: "orq_pii_detection" | "orq_secret_detection" | "orq_sexual_moderation" | "orq_harmful_moderation" | string; // required
executeOn: "input" | "output"; // required
}[];
plugins?: (PIIRedactionPlugin | ResponseHealingPlugin | TraceScrubbingPlugin)[];
fallbackOnCodes?: number[];
fallbacks?: {
model: string; // required
}[];
retry?: {
count?: number;
onCodes?: number[];
};
cache?: {
ttl?: number;
type: "exact_match"; // required
};
loadBalancer?: {
// one of: UpdatePromptLoadBalancer1
type: "weight_based"; // required
models: { // required
model: string; // required
weight?: number;
}[];
};
timeout?: {
callTimeout: number; // required
};
cacheControl?: {
type: "ephemeral"; // required
ttl?: "5m" | "1h";
};
promptCacheKey?: string;
};
metadata?: {
useCases?: ("Agents simulations" | "Agents" | "API interaction" | "Autonomous Agents" | "Chatbots" | "Classification" | "Code understanding" | "Code writing" | "Conversation" | "Documents QA" | "Evaluation" | "Extraction" | "Multi-modal" | "Self-checking" | "Sentiment analysis" | "SQL" | "Summarization" | "Tagging" | "Translation (document)" | "Translation (sentences)")[];
language?: "Chinese" | "Dutch" | "English" | "French" | "German" | "Russian" | "Spanish";
};
path?: string;
};
}
Show Response
Show Response
{
"id": str,
"type": Literal["prompt"],
"owner": str,
"domain_id": str,
"created": str,
"updated": str,
"created_by_id": Optional[str],
"updated_by_id": Optional[str],
"display_name": str,
"description": Optional[str],
"prompt_config": { # optional
"stream": Optional[bool],
"model": Optional[str],
"model_db_id": Optional[str],
"model_type": Optional[Literal["chat", "completion", "embedding", "image", "tts", "stt", "rerank", "ocr", "moderation", "classify", "vision"]],
"model_parameters": { # optional
"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": { # optional
# one of: UpdatePromptResponseFormat1, UpdatePromptResponseFormat2, UpdatePromptResponseFormat3, UpdatePromptResponseFormat4, UpdatePromptResponseFormat5, UpdatePromptResponseFormat6
"type": Union[Union[Literal["json_schema"], Literal["json_object"]], Literal["text"]],
"display_name": Optional[str],
"json_schema": {
"name": str,
"description": Optional[str],
"strict": Optional[bool],
"schema_": Dict[str, Any],
},
},
"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", "xhigh", "max"]],
"budget_tokens": Optional[float],
"verbosity": Optional[Literal["low", "medium", "high"]],
"thinking_level": Optional[Literal["minimal", "low", "medium", "high"]],
},
"provider": Optional[Literal["openai", "groq", "cohere", "azure", "aws", "google", "google-ai", "huggingface", "togetherai", "perplexity", "anthropic", "leonardoai", "fal", "nvidia", "jina", "elevenlabs", "litellm", "cerebras", "openailike", "bytedance", "mistral", "deepseek", "moonshotai", "zai", "minimax", "xai", "alibaba", "tensorix", "scaleway", "hcompany", "inception", "particle", "munito", "inceptron", "wafer", "poolside", "tencent", "nebius", "fireworks", "baseten", "reson8", "meta", "greenpt", "liquid", "typesafe", "berget", "cloudflare", "slack", "orq"]],
"integration_id": Optional[str],
"version": Optional[str],
"messages": [{
"role": Literal["system", "developer", "assistant", "user", "exception", "tool", "prompt", "correction", "expected_output"],
"content": Union[str, List[UpdatePromptContentPromptsResponse2]],
"tool_calls": [{ # optional
"id": Optional[str],
"index": Optional[float],
"type": Literal["function"],
"function": {
"name": str,
"arguments": str,
},
}],
"tool_call_id": Optional[str],
}],
},
"prompt": {
"name": Optional[str],
"audio": { # optional
"voice": Literal["alloy", "echo", "fable", "onyx", "nova", "shimmer"],
"format_": Literal["wav", "mp3", "flac", "opus", "pcm16"],
},
"frequency_penalty": Optional[float],
"max_tokens": Optional[int],
"max_completion_tokens": Optional[int],
"logprobs": Optional[bool],
"top_logprobs": Optional[int],
"n": Optional[int],
"presence_penalty": Optional[float],
"response_format": { # optional
# one of: UpdatePromptResponseFormatPromptsText, UpdatePromptResponseFormatPromptsJSONObject, UpdatePromptResponseFormatPromptsResponse200JSONSchema
"type": Union[Union[Literal["text"], Literal["json_object"]], Literal["json_schema"]],
"json_schema": {
"description": Optional[str],
"name": str,
"schema_": Optional[Any],
"strict": Optional[bool],
},
},
"reasoning_effort": Optional[Literal["none", "instant", "minimal", "low", "medium", "high", "xhigh", "max"]],
"verbosity": Optional[str],
"seed": Optional[float],
"stop": Union[str, List[str]], # optional
"stream_options": { # optional
"include_usage": Optional[bool],
},
"thinking": { # optional
# one of: ThinkingConfigDisabledSchema, ThinkingConfigEnabledSchema, ThinkingConfigAdaptiveSchema, ThinkingConfigBetweenToolsSchema
"type": Union[Union[Union[Literal["disabled"], Literal["enabled"]], Literal["adaptive"]], Literal["between_tools"]],
"budget_tokens": Union[float, Optional[float]],
"thinking_level": Optional[Literal["minimal", "low", "medium", "high"]],
"display": Optional[Literal["summarized", "omitted", "updates"]],
},
"temperature": Optional[float],
"top_p": Optional[float],
"top_k": Optional[float],
"tool_choice": { # optional
# one of: UpdatePromptToolChoicePrompts1, UpdatePromptToolChoicePrompts2
"type": Optional[Literal["function"]],
"function": {
"name": str,
},
},
"parallel_tool_calls": Optional[bool],
"modalities": List[Literal["text", "audio"]], # optional
"guardrails": [{ # optional
"id": Union[Literal["orq_pii_detection", "orq_secret_detection", "orq_sexual_moderation", "orq_harmful_moderation"], str],
"execute_on": Literal["input", "output"],
}],
"plugins": List[Union[PIIRedactionPlugin, ResponseHealingPlugin, TraceScrubbingPlugin]], # optional
"fallback_on_codes": List[int], # optional
"fallbacks": [{ # optional
"model": str,
}],
"retry": { # optional
"count": Optional[float],
"on_codes": List[float], # optional
},
"cache": { # optional
"ttl": Optional[float],
"type": Literal["exact_match"],
},
"load_balancer": { # optional
# one of: UpdatePromptLoadBalancerPrompts1
"type": Literal["weight_based"],
"models": [{
"model": str,
"weight": Optional[float],
}],
},
"timeout": { # optional
"call_timeout": float,
},
"cache_control": { # optional
"type": Literal["ephemeral"],
"ttl": Optional[Literal["5m", "1h"]],
},
"prompt_cache_key": Optional[str],
"messages": List[Union[UpdatePromptMessagesPromptsSystemMessage, UpdatePromptMessagesPromptsUserMessage, UpdatePromptMessagesPromptsAssistantMessage, UpdatePromptMessagesPromptsToolMessage]], # optional
"model": Optional[str],
"version": Optional[str],
},
"metadata": { # optional
"use_cases": List[Literal["Agents simulations", "Agents", "API interaction", "Autonomous Agents", "Chatbots", "Classification", "Code understanding", "Code writing", "Conversation", "Documents QA", "Evaluation", "Extraction", "Multi-modal", "Self-checking", "Sentiment analysis", "SQL", "Summarization", "Tagging", "Translation (document)", "Translation (sentences)"]], # optional
"language": Optional[Literal["Chinese", "Dutch", "English", "French", "German", "Russian", "Spanish"]],
},
}
{
id: string;
type: "prompt";
owner: string;
domainId: string;
created: string;
updated: string;
createdById?: string;
updatedById?: string;
displayName: string;
description?: string;
promptConfig?: {
stream?: boolean;
model?: string;
modelDbId?: string;
modelType?: "chat" | "completion" | "embedding" | "image" | "tts" | "stt" | "rerank" | "ocr" | "moderation" | "classify" | "vision";
modelParameters?: {
temperature?: number;
maxTokens?: number;
topK?: number;
topP?: number;
frequencyPenalty?: number;
presencePenalty?: number;
numImages?: number;
seed?: number;
format?: "url" | "b64_json" | "text" | "json_object";
dimensions?: string;
quality?: string;
style?: string;
responseFormat?: {
// one of: UpdatePromptResponseFormat1, UpdatePromptResponseFormat2, UpdatePromptResponseFormat3, UpdatePromptResponseFormat4, UpdatePromptResponseFormat5, UpdatePromptResponseFormat6
type: "json_schema" | "json_object" | "text";
displayName?: string;
jsonSchema: {
name: string;
description?: string;
strict?: boolean;
schema: Record<string, any>;
};
};
cacheControl?: {
type: "ephemeral";
ttl?: "5m" | "1h";
};
photoRealVersion?: "v1" | "v2";
encodingFormat?: "float" | "base64";
reasoningEffort?: "none" | "disable" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
budgetTokens?: number;
verbosity?: "low" | "medium" | "high";
thinkingLevel?: "minimal" | "low" | "medium" | "high";
};
provider?: "openai" | "groq" | "cohere" | "azure" | "aws" | "google" | "google-ai" | "huggingface" | "togetherai" | "perplexity" | "anthropic" | "leonardoai" | "fal" | "nvidia" | "jina" | "elevenlabs" | "litellm" | "cerebras" | "openailike" | "bytedance" | "mistral" | "deepseek" | "moonshotai" | "zai" | "minimax" | "xai" | "alibaba" | "tensorix" | "scaleway" | "hcompany" | "inception" | "particle" | "munito" | "inceptron" | "wafer" | "poolside" | "tencent" | "nebius" | "fireworks" | "baseten" | "reson8" | "meta" | "greenpt" | "liquid" | "typesafe" | "berget" | "cloudflare" | "slack" | "orq";
integrationId?: string;
version?: string;
messages: {
role: "system" | "developer" | "assistant" | "user" | "exception" | "tool" | "prompt" | "correction" | "expected_output";
content: string | UpdatePromptContentPromptsResponse2[];
toolCalls?: {
id?: string;
index?: number;
type: "function";
function: {
name: string;
arguments: string;
};
}[];
toolCallId?: string;
}[];
};
prompt: {
name?: string;
audio?: {
voice: "alloy" | "echo" | "fable" | "onyx" | "nova" | "shimmer";
format: "wav" | "mp3" | "flac" | "opus" | "pcm16";
};
frequencyPenalty?: number;
maxTokens?: number;
maxCompletionTokens?: number;
logprobs?: boolean;
topLogprobs?: number;
n?: number;
presencePenalty?: number;
responseFormat?: {
// one of: UpdatePromptResponseFormatPromptsText, UpdatePromptResponseFormatPromptsJSONObject, UpdatePromptResponseFormatPromptsResponse200JSONSchema
type: "text" | "json_object" | "json_schema";
jsonSchema: {
description?: string;
name: string;
schema?: any;
strict?: boolean;
};
};
reasoningEffort?: "none" | "instant" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
verbosity?: string;
seed?: number;
stop?: string | string[];
streamOptions?: {
includeUsage?: boolean;
};
thinking?: {
// one of: ThinkingConfigDisabledSchema, ThinkingConfigEnabledSchema, ThinkingConfigAdaptiveSchema, ThinkingConfigBetweenToolsSchema
type: "disabled" | "enabled" | "adaptive" | "between_tools";
budgetTokens: number;
thinkingLevel?: "minimal" | "low" | "medium" | "high";
display?: "summarized" | "omitted" | "updates";
};
temperature?: number;
topP?: number;
topK?: number;
toolChoice?: {
// one of: UpdatePromptToolChoicePrompts1, UpdatePromptToolChoicePrompts2
type?: "function";
function: {
name: string;
};
};
parallelToolCalls?: boolean;
modalities?: ("text" | "audio")[];
guardrails?: {
id: "orq_pii_detection" | "orq_secret_detection" | "orq_sexual_moderation" | "orq_harmful_moderation" | string;
executeOn: "input" | "output";
}[];
plugins?: (PIIRedactionPlugin | ResponseHealingPlugin | TraceScrubbingPlugin)[];
fallbackOnCodes?: number[];
fallbacks?: {
model: string;
}[];
retry?: {
count?: number;
onCodes?: number[];
};
cache?: {
ttl?: number;
type: "exact_match";
};
loadBalancer?: {
// one of: UpdatePromptLoadBalancerPrompts1
type: "weight_based";
models: {
model: string;
weight?: number;
}[];
};
timeout?: {
callTimeout: number;
};
cacheControl?: {
type: "ephemeral";
ttl?: "5m" | "1h";
};
promptCacheKey?: string;
messages?: (UpdatePromptMessagesPromptsSystemMessage | UpdatePromptMessagesPromptsUserMessage | UpdatePromptMessagesPromptsAssistantMessage | UpdatePromptMessagesPromptsToolMessage)[];
model?: string;
version?: string;
};
metadata?: {
useCases?: ("Agents simulations" | "Agents" | "API interaction" | "Autonomous Agents" | "Chatbots" | "Classification" | "Code understanding" | "Code writing" | "Conversation" | "Documents QA" | "Evaluation" | "Extraction" | "Multi-modal" | "Self-checking" | "Sentiment analysis" | "SQL" | "Summarization" | "Tagging" | "Translation (document)" | "Translation (sentences)")[];
language?: "Chinese" | "Dutch" | "English" | "French" | "German" | "Russian" | "Spanish";
};
}
Show Variant types
Show Variant types
UpdatePromptContentPromptsResponse2
{
# one of: UpdatePrompt21, UpdatePrompt22, UpdatePrompt23
"type": Union[Union[Literal["text"], Literal["image_url"]], Literal["file"]],
"text": str,
"image_url": {
"id": Optional[str],
"url": str,
"detail": Optional[str],
},
"file": {
"file_data": Optional[str],
"uri": Optional[str],
"mime_type": Optional[str],
"filename": Optional[str],
},
}
{
// one of: UpdatePrompt21, UpdatePrompt22, UpdatePrompt23
type: "text" | "image_url" | "file";
text: string;
imageUrl: {
id?: string;
url: string;
detail?: string;
};
file: {
fileData?: string;
uri?: string;
mimeType?: string;
filename?: string;
};
}