Prompts
Every Prompts method in the Confident AI Python and TypeScript SDKs.
Overview
The Confident AI SDK exposes every Prompt method on the platform. This page documents how to call these methods in all supported languages. See the introduction to install the SDK and set your API key.
Prompt
client.prompt() returns a Prompt object that stands for one prompt. This object stores the fields listed below, and passes the prompt's id to every method called on it, so you don't need to pass the id nor the stored fields as arguments.
push is the exception, because it sends the stored fields rather than calling a route that names the id. Open the object with alias to call it.
from confident_ai import ConfidentAI
client = ConfidentAI()
prompt = client.prompt(prompt_id="<PROMPT-ID>")Properties
These are the fields a Prompt stores. A method that loads the prompt fills them in, and a method that saves it sends whichever of them you have set, so set them before you save and read them after you load.
| Parameter | Type | Description |
|---|---|---|
prompt_id | Optional[str] | The unique id of the prompt. |
text | Optional[str] | This is the text content of the prompt. |
alias | Optional[str] | This is the alias of the prompt, which is unique within your project. |
id | Optional[str] | This is the id of the commit pulled, generated by Confident AI, not to be confused with the prompt id, the version number, or the commit hash. |
hash | Optional[str] | This is the commit hash of the prompt pulled. |
version | Optional[str] | The version number of the prompt, present when the commit pulled has been released as a version. |
label | Optional[str] | The user-defined label of the version pulled, present when the version carries one. |
type | Optional[PromptType] | See PromptType. |
interpolation_type | Optional[PromptInterpolationType] | See PromptInterpolationType. |
model_settings | Optional[ModelSettings] | See ModelSettings. |
output_type | Optional[PromptOutputType] | See PromptOutputType. |
output_schema | Optional[OutputSchema] | See OutputSchema. |
tools | Optional[List[Tool]] | This is the list of tools available to the prompt. See Tool. |
messages | Optional[List[PromptMessage]] | This is the list of messages that make up the prompt. See PromptMessage. |
import { ConfidentAI } from "confident-ai";
const client = new ConfidentAI();
const prompt = client.prompt("<PROMPT-ID>");Properties
These are the fields a Prompt stores. A method that loads the prompt fills them in, and a method that saves it sends whichever of them you have set, so set them before you save and read them after you load.
| Parameter | Type | Description |
|---|---|---|
promptId | string | The unique id of the prompt. |
text | string | This is the text content of the prompt. |
alias | string | This is the alias of the prompt, which is unique within your project. |
id | string | This is the id of the commit pulled, generated by Confident AI, not to be confused with the prompt id, the version number, or the commit hash. |
hash | string | This is the commit hash of the prompt pulled. |
version | string | The version number of the prompt, present when the commit pulled has been released as a version. |
label | string | The user-defined label of the version pulled, present when the version carries one. |
type | PromptType | See PromptType. |
interpolationType | PromptInterpolationType | See PromptInterpolationType. |
modelSettings | ModelSettings | See ModelSettings. |
outputType | PromptOutputType | See PromptOutputType. |
outputSchema | OutputSchema | See OutputSchema. |
tools | Tool[] | This is the list of tools available to the prompt. See Tool. |
messages | PromptMessage[] | This is the list of messages that make up the prompt. See PromptMessage. |
Methods
Push Prompt
Creates a new commit for the prompt with the given alias, creating the prompt first when it does not exist. Send text for a text prompt or messages for a messages prompt, not both.
from confident_ai import ConfidentAI
client = ConfidentAI()
prompt = client.prompt(alias="greeting")
result = prompt.push(branch="main")For async mode, call a_push and await it as shown below:
result = await prompt.a_push(...)Parameters
| Parameter | Type | Description |
|---|---|---|
branch | Optional[str] | The name of the branch to push the new commit to. The branch is created from main when it does not exist yet. |
import { ConfidentAI } from "confident-ai";
const client = new ConfidentAI();
const prompt = client.prompt(undefined, { alias: "greeting" });
const result = await prompt.push({ branch: "main" });Parameters
| Parameter | Type | Description |
|---|---|---|
branch | string | The name of the branch to push the new commit to. The branch is created from main when it does not exist yet. |
Returns
This method returns an object of type PushPromptResult.
Pull Prompt
Pull the prompt from Confident AI, and keep it current.
Pass at most one of commit, version, label. The commit that comes back is cached on disk and re-pulled in the background every refresh seconds, so editing the prompt on Confident AI reaches a running process without a deploy.
from confident_ai import ConfidentAI
client = ConfidentAI()
prompt = client.prompt(prompt_id="<PROMPT-ID>")
result = prompt.pull(
commit="<COMMIT>",
branch="main",
refresh=60,
fallback_to_cache=True,
write_to_cache=True,
default_to_cache=True,
)For async mode, call a_pull and await it as shown below:
result = await prompt.a_pull(...)Parameters
| Parameter | Type | Description |
|---|---|---|
commit | Optional[str] | The hash of the commit to pull. Defaults to latest. |
version | Optional[str] | The version number of the prompt to pull. |
label | Optional[str] | The label of the version to pull. |
branch | Optional[str] | The name of the branch to read from. Defaults to main when omitted. Only valid with commit. |
refresh | Optional[int] | How often, in seconds, to re-pull the prompt in the background. 0 turns off the refresh and the cache together, so that every pull calls the API — which is what you want while you are still editing the prompt. Defaults to 60. |
fallback_to_cache | bool | Serve the cached commit when the API cannot be reached, instead of raising. Defaults to True. |
write_to_cache | bool | Write the pulled commit to the cache. The background refresh writes it either way. Defaults to True. |
default_to_cache | bool | Return the cached commit when there is one, rather than waiting for the API. Defaults to True. |
import { ConfidentAI } from "confident-ai";
const client = new ConfidentAI();
const prompt = client.prompt("<PROMPT-ID>");
const result = await prompt.pull(
{
commit: "<COMMIT>",
branch: "main",
refresh: 60,
fallbackToCache: true,
writeToCache: true,
defaultToCache: true
},
);Parameters
| Parameter | Type | Description |
|---|---|---|
commit | string | The hash of the commit to pull. Defaults to latest. |
version | string | The version number of the prompt to pull. |
label | string | The label of the version to pull. |
branch | string | The name of the branch to read from. Defaults to main when omitted. Only valid with commit. |
refresh | number | How often, in seconds, to re-pull the prompt in the background. 0 turns off the refresh and the cache together, so that every pull calls the API — which is what you want while you are still editing the prompt. Defaults to 60. |
fallbackToCache | boolean | Serve the cached commit when the API cannot be reached, instead of raising. Defaults to true. |
writeToCache | boolean | Write the pulled commit to the cache. The background refresh writes it either way. Defaults to true. |
defaultToCache | boolean | Return the cached commit when there is one, rather than waiting for the API. Defaults to true. |
Returns
This method returns an object of type Prompt.
Interpolate Prompt
Render the prompt's template with values, without calling the API.
Returns the interpolated text for a text prompt, and the interpolated messages for a messages prompt.
from confident_ai import ConfidentAI
client = ConfidentAI()
prompt = client.prompt(prompt_id="<PROMPT-ID>")
prompt.pull()
result = prompt.interpolate()Parameters
| Parameter | Type | Description |
|---|---|---|
**values | Any | — |
import { ConfidentAI } from "confident-ai";
const client = new ConfidentAI();
const prompt = client.prompt("<PROMPT-ID>");
await prompt.pull();
const result = await prompt.interpolate();Parameters
| Parameter | Type | Description |
|---|---|---|
values | Record<string, unknown> | — |
Returns
This method returns an object of type InterpolatedPrompt.
Methods (Stateless)
These methods take every argument themselves, so a caller reaches them through client.prompts without opening a Prompt first.
List Prompts
Lists all the prompts in your Confident AI project.
from confident_ai import ConfidentAI
client = ConfidentAI()
result = client.prompts.list()For async mode, call a_list and await it as shown below:
result = await client.prompts.a_list(...)import { ConfidentAI } from "confident-ai";
const client = new ConfidentAI();
const result = await client.prompts.list();Returns
This method returns an object of type PromptList.
Push Text Prompt
Creates a new commit for the prompt with the given alias, creating the prompt first when it does not exist. Send text for a text prompt or messages for a messages prompt, not both.
Pushes a commit to a text prompt. interpolationType defaults to FSTRING when omitted.
from confident_ai import ConfidentAI
from confident_ai.common import ModelProvider
from confident_ai.prompts import ModelSettings
from confident_ai.prompts import OutputSchema
from confident_ai.prompts import OutputSchemaField
from confident_ai.prompts import PromptInterpolationType
from confident_ai.prompts import PromptOutputType
from confident_ai.prompts import PushTextPrompt
from confident_ai.prompts import ReasoningEffort
from confident_ai.prompts import StructuredSchema
from confident_ai.prompts import Tool
from confident_ai.prompts import ToolMode
from confident_ai.prompts import Verbosity
client = ConfidentAI()
result = client.prompts.push(
prompt=PushTextPrompt(
text="Hello, {{name}}! How can I help you today?",
alias="greeting",
interpolation_type=PromptInterpolationType.MUSTACHE,
model_settings=ModelSettings(
provider=ModelProvider.OPEN_AI,
name="gpt-4o",
temperature=0.7,
max_tokens=1024,
top_p=1,
top_k=40,
frequency_penalty=0,
presence_penalty=0,
stop_sequence=["\n\nHuman:", "###"],
reasoning_effort=ReasoningEffort.MINIMAL,
verbosity=Verbosity.LOW
),
output_type=PromptOutputType.TEXT,
output_schema=OutputSchema(
name="Greeting",
fields=[
OutputSchemaField(
id="<FIELD-ID>",
name="greeting",
type=...,
required=True,
parent_id="<PARENT-ID>"
)
]
),
tools=[
Tool(
id="<TOOL-ID>",
name="get_customer_name",
description="Looks up the customer's name by id.",
mode=ToolMode.ALLOW_ADDITIONAL,
structured_schema=StructuredSchema(
id="<STRUCTURED-SCHEMA-ID>",
name="GetCustomerNameInput",
fields=[
...
]
)
)
],
branch="main"
),
)For async mode, call a_push and await it as shown below:
result = await client.prompts.a_push(...)Parameters
| Parameter | Type | Description |
|---|---|---|
prompt | PushPromptRequest | Required. The commit to push. Send text for a text prompt or messages for a messages prompt, never both. The kind must match the existing prompt's type. Pass a PushTextPrompt or a PushMessagesPrompt. See PushPromptRequest. |
import { ConfidentAI } from "confident-ai";
import { ModelProvider } from "confident-ai/common";
import {
PromptInterpolationType,
PromptOutputType,
ReasoningEffort,
ToolMode,
Verbosity,
} from "confident-ai/prompts";
const client = new ConfidentAI();
const result = await client.prompts.push(
{
text: "Hello, {{name}}! How can I help you today?",
alias: "greeting",
interpolationType: PromptInterpolationType.MUSTACHE,
modelSettings: {
provider: ModelProvider.OPEN_AI,
name: "gpt-4o",
temperature: 0.7,
maxTokens: 1024,
topP: 1,
topK: 40,
frequencyPenalty: 0,
presencePenalty: 0,
stopSequence: ["\n\nHuman:", "###"],
reasoningEffort: ReasoningEffort.MINIMAL,
verbosity: Verbosity.LOW
},
outputType: PromptOutputType.TEXT,
outputSchema: {
name: "Greeting",
fields: [
{
id: "<FIELD-ID>",
name: "greeting",
type: {},
required: true,
parentId: "<PARENT-ID>"
}
]
},
tools: [
{
id: "<TOOL-ID>",
name: "get_customer_name",
description: "Looks up the customer's name by id.",
mode: ToolMode.ALLOW_ADDITIONAL,
structuredSchema: {
id: "<STRUCTURED-SCHEMA-ID>",
name: "GetCustomerNameInput",
fields: [
{}
]
}
}
],
branch: "main"
},
);Parameters
| Parameter | Type | Description |
|---|---|---|
prompt | PushPromptRequest | Required. The commit to push. Send text for a text prompt or messages for a messages prompt, never both. The kind must match the existing prompt's type. Pass a PushTextPrompt or a PushMessagesPrompt. See PushPromptRequest. |
Returns
This method returns an object of type PushPromptResult.
Push Messages Prompt
Creates a new commit for the prompt with the given alias, creating the prompt first when it does not exist. Send text for a text prompt or messages for a messages prompt, not both.
Pushes a commit to a messages prompt. interpolationType defaults to FSTRING when omitted.
from confident_ai import ConfidentAI
from confident_ai.common import ModelProvider
from confident_ai.prompts import ModelSettings
from confident_ai.prompts import OutputSchema
from confident_ai.prompts import OutputSchemaField
from confident_ai.prompts import PromptInterpolationType
from confident_ai.prompts import PromptOutputType
from confident_ai.prompts import PushMessagesPrompt
from confident_ai.prompts import ReasoningEffort
from confident_ai.prompts import StructuredSchema
from confident_ai.prompts import Tool
from confident_ai.prompts import ToolMode
from confident_ai.prompts import Verbosity
client = ConfidentAI()
result = client.prompts.push(
prompt=PushMessagesPrompt(
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{
"role": "user",
"content": "Hello, {{name}}! How can I help you today?"
}
],
alias="greeting",
interpolation_type=PromptInterpolationType.MUSTACHE,
model_settings=ModelSettings(
provider=ModelProvider.OPEN_AI,
name="gpt-4o",
temperature=0.7,
max_tokens=1024,
top_p=1,
top_k=40,
frequency_penalty=0,
presence_penalty=0,
stop_sequence=["\n\nHuman:", "###"],
reasoning_effort=ReasoningEffort.MINIMAL,
verbosity=Verbosity.LOW
),
output_type=PromptOutputType.TEXT,
output_schema=OutputSchema(
name="Greeting",
fields=[
OutputSchemaField(
id="<FIELD-ID>",
name="greeting",
type=...,
required=True,
parent_id="<PARENT-ID>"
)
]
),
tools=[
Tool(
id="<TOOL-ID>",
name="get_customer_name",
description="Looks up the customer's name by id.",
mode=ToolMode.ALLOW_ADDITIONAL,
structured_schema=StructuredSchema(
id="<STRUCTURED-SCHEMA-ID>",
name="GetCustomerNameInput",
fields=[
...
]
)
)
],
branch="main"
),
)For async mode, call a_push and await it as shown below:
result = await client.prompts.a_push(...)Parameters
| Parameter | Type | Description |
|---|---|---|
prompt | PushPromptRequest | Required. The commit to push. Send text for a text prompt or messages for a messages prompt, never both. The kind must match the existing prompt's type. Pass a PushTextPrompt or a PushMessagesPrompt. See PushPromptRequest. |
import { ConfidentAI } from "confident-ai";
import { ModelProvider } from "confident-ai/common";
import {
PromptInterpolationType,
PromptOutputType,
ReasoningEffort,
ToolMode,
Verbosity,
} from "confident-ai/prompts";
const client = new ConfidentAI();
const result = await client.prompts.push(
{
messages: [
{ role: "system", content: "You are a helpful assistant." },
{
role: "user",
content: "Hello, {{name}}! How can I help you today?"
}
],
alias: "greeting",
interpolationType: PromptInterpolationType.MUSTACHE,
modelSettings: {
provider: ModelProvider.OPEN_AI,
name: "gpt-4o",
temperature: 0.7,
maxTokens: 1024,
topP: 1,
topK: 40,
frequencyPenalty: 0,
presencePenalty: 0,
stopSequence: ["\n\nHuman:", "###"],
reasoningEffort: ReasoningEffort.MINIMAL,
verbosity: Verbosity.LOW
},
outputType: PromptOutputType.TEXT,
outputSchema: {
name: "Greeting",
fields: [
{
id: "<FIELD-ID>",
name: "greeting",
type: {},
required: true,
parentId: "<PARENT-ID>"
}
]
},
tools: [
{
id: "<TOOL-ID>",
name: "get_customer_name",
description: "Looks up the customer's name by id.",
mode: ToolMode.ALLOW_ADDITIONAL,
structuredSchema: {
id: "<STRUCTURED-SCHEMA-ID>",
name: "GetCustomerNameInput",
fields: [
{}
]
}
}
],
branch: "main"
},
);Parameters
| Parameter | Type | Description |
|---|---|---|
prompt | PushPromptRequest | Required. The commit to push. Send text for a text prompt or messages for a messages prompt, never both. The kind must match the existing prompt's type. Pass a PushTextPrompt or a PushMessagesPrompt. See PushPromptRequest. |
Returns
This method returns an object of type PushPromptResult.
Get By Label
Retrieves the prompt version carrying label.
from confident_ai import ConfidentAI
client = ConfidentAI()
result = client.prompts.get_by_label(
prompt_id="<PROMPT-ID>",
label="production",
)For async mode, call a_get_by_label and await it as shown below:
result = await client.prompts.a_get_by_label(...)Parameters
| Parameter | Type | Description |
|---|---|---|
prompt_id | str | Required. The unique id of the prompt. |
label | str | Required. The label of the version to pull. |
import { ConfidentAI } from "confident-ai";
const client = new ConfidentAI();
const result = await client.prompts.getByLabel("<PROMPT-ID>", "production");Parameters
| Parameter | Type | Description |
|---|---|---|
promptId | string | Required. The unique id of the prompt. |
label | string | Required. The label of the version to pull. |
Returns
This method returns an object of type Prompt.
Get By Commit
Retrieves the prompt commit with the given hash. The commit is looked up on main unless a branch is given.
from confident_ai import ConfidentAI
client = ConfidentAI()
result = client.prompts.get_by_commit(
prompt_id="<PROMPT-ID>",
hash="bab04ce",
branch="main",
)For async mode, call a_get_by_commit and await it as shown below:
result = await client.prompts.a_get_by_commit(...)Parameters
| Parameter | Type | Description |
|---|---|---|
prompt_id | str | Required. The unique id of the prompt. |
hash | str | Required. The hash of the commit to pull. |
branch | Optional[str] | The name of the branch to read from. Defaults to main when omitted. |
import { ConfidentAI } from "confident-ai";
const client = new ConfidentAI();
const result = await client.prompts.getByCommit(
"<PROMPT-ID>",
"bab04ce",
{ branch: "main" },
);Parameters
| Parameter | Type | Description |
|---|---|---|
promptId | string | Required. The unique id of the prompt. |
hash | string | Required. The hash of the commit to pull. |
branch | string | The name of the branch to read from. Defaults to main when omitted. |
Returns
This method returns an object of type Prompt.
Get By Version
Retrieves the prompt commit released as version.
from confident_ai import ConfidentAI
client = ConfidentAI()
result = client.prompts.get_by_version(
prompt_id="<PROMPT-ID>",
version="00.00.01",
)For async mode, call a_get_by_version and await it as shown below:
result = await client.prompts.a_get_by_version(...)Parameters
| Parameter | Type | Description |
|---|---|---|
prompt_id | str | Required. The unique id of the prompt. |
version | str | Required. The version number of the prompt to pull. |
import { ConfidentAI } from "confident-ai";
const client = new ConfidentAI();
const result = await client.prompts.getByVersion("<PROMPT-ID>", "00.00.01");Parameters
| Parameter | Type | Description |
|---|---|---|
promptId | string | Required. The unique id of the prompt. |
version | string | Required. The version number of the prompt to pull. |
Returns
This method returns an object of type Prompt.
Types
ModelProvider
This is the provider of the model.
class ModelProvider(Enum):
OPEN_AI = "OPEN_AI"
CUSTOM = "CUSTOM"
CONFIDENT_AI = "CONFIDENT_AI"
BEDROCK = "BEDROCK"
ANTHROPIC = "ANTHROPIC"
GEMINI = "GEMINI"
X_AI = "X_AI"
DEEPSEEK = "DEEPSEEK"
MOONSHOT_AI = "MOONSHOT_AI"
VERTEX_AI = "VERTEX_AI"
AZURE = "AZURE"
MISTRAL = "MISTRAL"
PERPLEXITY = "PERPLEXITY"
OPEN_ROUTER = "OPEN_ROUTER"
PORTKEY = "PORTKEY"
LITE_LLM = "LITE_LLM"
TRUE_FOUNDRY = "TRUE_FOUNDRY"
HUGGING_FACE = "HUGGING_FACE"
TYPE_SAFE = "TYPE_SAFE"
FAL = "FAL"enum ModelProvider {
OPEN_AI = "OPEN_AI",
CUSTOM = "CUSTOM",
CONFIDENT_AI = "CONFIDENT_AI",
BEDROCK = "BEDROCK",
ANTHROPIC = "ANTHROPIC",
GEMINI = "GEMINI",
X_AI = "X_AI",
DEEPSEEK = "DEEPSEEK",
MOONSHOT_AI = "MOONSHOT_AI",
VERTEX_AI = "VERTEX_AI",
AZURE = "AZURE",
MISTRAL = "MISTRAL",
PERPLEXITY = "PERPLEXITY",
OPEN_ROUTER = "OPEN_ROUTER",
PORTKEY = "PORTKEY",
LITE_LLM = "LITE_LLM",
TRUE_FOUNDRY = "TRUE_FOUNDRY",
HUGGING_FACE = "HUGGING_FACE",
TYPE_SAFE = "TYPE_SAFE",
FAL = "FAL",
}OPEN_AI · CUSTOM · CONFIDENT_AI · BEDROCK · ANTHROPIC · GEMINI · X_AI · DEEPSEEK · MOONSHOT_AI · VERTEX_AI · AZURE · MISTRAL · PERPLEXITY · OPEN_ROUTER · PORTKEY · LITE_LLM · TRUE_FOUNDRY · HUGGING_FACE · TYPE_SAFE · FAL
ModelSettings
This is the model settings the prompt was authored for.
class ModelSettings:
provider: Optional[ModelProvider] = None
name: Optional[str] = None
temperature: Optional[float] = None
max_tokens: Optional[float] = Field(default=None, alias="maxTokens")
top_p: Optional[float] = Field(default=None, alias="topP")
top_k: Optional[float] = Field(default=None, alias="topK")
frequency_penalty: Optional[float] = Field(default=None, alias="frequencyPenalty")
presence_penalty: Optional[float] = Field(default=None, alias="presencePenalty")
stop_sequence: Optional[List[str]] = Field(default=None, alias="stopSequence")
reasoning_effort: Optional[ReasoningEffort] = Field(default=None, alias="reasoningEffort")
verbosity: Optional[Verbosity] = NoneproviderOptional[ModelProvider]
See ModelProvider.
nameOptional[str]
This is the name of the model.
Example: "gpt-4o"
temperatureOptional[float]
This controls randomness in the model's output. Higher values make output more random.
Example: 0.7
max_tokensOptional[float]
This is the maximum number of tokens to generate.
Example: 1024
top_pOptional[float]
This controls diversity via nucleus sampling. Lower values focus on more likely tokens.
Example: 1
top_kOptional[float]
This limits sampling to the K most likely tokens at each step.
Example: 40
frequency_penaltyOptional[float]
This is the penalty for tokens based on their frequency in the text so far.
Example: 0
presence_penaltyOptional[float]
This is the penalty for tokens based on whether they appear in the text so far.
Example: 0
stop_sequenceOptional[List[str]]
This is the sequences where the model will stop generating further tokens.
Example: ["\n\nHuman:","###"]
reasoning_effortOptional[ReasoningEffort]
See ReasoningEffort.
verbosityOptional[Verbosity]
See Verbosity.
interface ModelSettings {
provider?: ModelProvider;
name?: string;
temperature?: number;
maxTokens?: number;
topP?: number;
topK?: number;
frequencyPenalty?: number;
presencePenalty?: number;
stopSequence?: string[];
reasoningEffort?: ReasoningEffort;
verbosity?: Verbosity;
}providerModelProvider
See ModelProvider.
namestring
This is the name of the model.
Example: "gpt-4o"
temperaturenumber
This controls randomness in the model's output. Higher values make output more random.
Example: 0.7
maxTokensnumber
This is the maximum number of tokens to generate.
Example: 1024
topPnumber
This controls diversity via nucleus sampling. Lower values focus on more likely tokens.
Example: 1
topKnumber
This limits sampling to the K most likely tokens at each step.
Example: 40
frequencyPenaltynumber
This is the penalty for tokens based on their frequency in the text so far.
Example: 0
presencePenaltynumber
This is the penalty for tokens based on whether they appear in the text so far.
Example: 0
stopSequencestring[]
This is the sequences where the model will stop generating further tokens.
Example: ["\n\nHuman:","###"]
reasoningEffortReasoningEffort
See ReasoningEffort.
verbosityVerbosity
See Verbosity.
OutputSchema
This is the output schema definition, used when outputType is SCHEMA.
class OutputSchema:
name: str
fields: List[OutputSchemaField]namestrRequired
This is the name of the output schema.
Example: "Greeting"
fieldsList[OutputSchemaField]Required
This is the array of fields that define the output schema structure.
See OutputSchemaField.
interface OutputSchema {
name: string;
fields: OutputSchemaField[];
}namestringRequired
This is the name of the output schema.
Example: "Greeting"
fieldsOutputSchemaField[]Required
This is the array of fields that define the output schema structure.
See OutputSchemaField.
OutputSchemaField
class OutputSchemaField:
id: Optional[str] = None
name: str
type: SchemaDataType
required: Optional[bool] = None
parent_id: Optional[str] = Field(default=None, alias="parentId")idOptional[str]
This is the unique identifier for the schema field. Use it as the parentId of nested fields.
Example: "<FIELD-ID>"
namestrRequired
This is the name of the schema field.
Example: "greeting"
typeSchemaDataTypeRequired
See SchemaDataType.
requiredOptional[bool]
This indicates whether the field is required in the output.
Example: true
parent_idOptional[str]
This is the id of the parent field for nested structures, or null for a top-level field.
interface OutputSchemaField {
id?: string;
name: string;
type: SchemaDataType;
required?: boolean;
parentId?: string | null;
}idstring
This is the unique identifier for the schema field. Use it as the parentId of nested fields.
Example: "<FIELD-ID>"
namestringRequired
This is the name of the schema field.
Example: "greeting"
typeSchemaDataTypeRequired
See SchemaDataType.
requiredboolean
This indicates whether the field is required in the output.
Example: true
parentIdstring | null
This is the id of the parent field for nested structures, or null for a top-level field.
Prompt
A single commit of a prompt, as pulled by version, commit hash, or label. It carries text when the prompt is a text prompt and messages when it is a messages prompt, never both.
Prompt = Union[
TextPrompt,
MessagesPrompt,
]type Prompt =
| TextPrompt
| MessagesPrompt;A Prompt is one of the shapes below. Send the fields of one of them, never a mix of both.
A pulled prompt whose content is a single text template.
class TextPrompt:
text: str
alias: str
id: str
hash: str
version: Optional[str] = None
label: Optional[str] = None
type: PromptType
interpolation_type: PromptInterpolationType = Field(alias="interpolationType")
model_settings: Optional[ModelSettings] = Field(default=None, alias="modelSettings")
output_type: PromptOutputType = Field(alias="outputType")
output_schema: Optional[OutputSchema] = Field(default=None, alias="outputSchema")
tools: Optional[List[Tool]] = NonetextstrRequired
This is the text content of the prompt.
Example: "Hello, {{name}}! How can I help you today?"
aliasstrRequired
This is the alias of the prompt, which is unique within your project.
Example: "greeting"
idstrRequired
This is the id of the commit pulled, generated by Confident AI, not to be confused with the prompt id, the version number, or the commit hash.
Example: "<COMMIT-ID>"
hashstrRequired
This is the commit hash of the prompt pulled.
Example: "bab04ce"
versionOptional[str]
The version number of the prompt, present when the commit pulled has been released as a version.
Example: "00.00.01"
labelOptional[str]
The user-defined label of the version pulled, present when the version carries one.
Example: "production"
typePromptTypeRequired
See PromptType.
interpolation_typePromptInterpolationTypeRequired
model_settingsOptional[ModelSettings]
See ModelSettings.
output_typePromptOutputTypeRequired
See PromptOutputType.
output_schemaOptional[OutputSchema]
See OutputSchema.
toolsOptional[List[Tool]]
This is the list of tools available to the prompt.
See Tool.
interface TextPrompt {
text: string;
alias: string;
id: string;
hash: string;
version?: string;
label?: string;
type: PromptType;
interpolationType: PromptInterpolationType;
modelSettings?: ModelSettings;
outputType: PromptOutputType;
outputSchema?: OutputSchema;
tools?: Tool[];
}textstringRequired
This is the text content of the prompt.
Example: "Hello, {{name}}! How can I help you today?"
aliasstringRequired
This is the alias of the prompt, which is unique within your project.
Example: "greeting"
idstringRequired
This is the id of the commit pulled, generated by Confident AI, not to be confused with the prompt id, the version number, or the commit hash.
Example: "<COMMIT-ID>"
hashstringRequired
This is the commit hash of the prompt pulled.
Example: "bab04ce"
versionstring
The version number of the prompt, present when the commit pulled has been released as a version.
Example: "00.00.01"
labelstring
The user-defined label of the version pulled, present when the version carries one.
Example: "production"
typePromptTypeRequired
See PromptType.
interpolationTypePromptInterpolationTypeRequired
modelSettingsModelSettings
See ModelSettings.
outputTypePromptOutputTypeRequired
See PromptOutputType.
outputSchemaOutputSchema
See OutputSchema.
toolsTool[]
This is the list of tools available to the prompt.
See Tool.
A pulled prompt whose content is a list of messages.
class MessagesPrompt:
messages: List[PromptMessage]
alias: str
id: str
hash: str
version: Optional[str] = None
label: Optional[str] = None
type: PromptType
interpolation_type: PromptInterpolationType = Field(alias="interpolationType")
model_settings: Optional[ModelSettings] = Field(default=None, alias="modelSettings")
output_type: PromptOutputType = Field(alias="outputType")
output_schema: Optional[OutputSchema] = Field(default=None, alias="outputSchema")
tools: Optional[List[Tool]] = NonemessagesList[PromptMessage]Required
This is the list of messages that make up the prompt.
See PromptMessage.
Example: [{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"Hello, {{name}}! How can I help you today?"}]
aliasstrRequired
This is the alias of the prompt, which is unique within your project.
Example: "greeting"
idstrRequired
This is the id of the commit pulled, generated by Confident AI, not to be confused with the prompt id, the version number, or the commit hash.
Example: "<COMMIT-ID>"
hashstrRequired
This is the commit hash of the prompt pulled.
Example: "bab04ce"
versionOptional[str]
The version number of the prompt, present when the commit pulled has been released as a version.
Example: "00.00.01"
labelOptional[str]
The user-defined label of the version pulled, present when the version carries one.
Example: "production"
typePromptTypeRequired
See PromptType.
interpolation_typePromptInterpolationTypeRequired
model_settingsOptional[ModelSettings]
See ModelSettings.
output_typePromptOutputTypeRequired
See PromptOutputType.
output_schemaOptional[OutputSchema]
See OutputSchema.
toolsOptional[List[Tool]]
This is the list of tools available to the prompt.
See Tool.
interface MessagesPrompt {
messages: PromptMessage[];
alias: string;
id: string;
hash: string;
version?: string;
label?: string;
type: PromptType;
interpolationType: PromptInterpolationType;
modelSettings?: ModelSettings;
outputType: PromptOutputType;
outputSchema?: OutputSchema;
tools?: Tool[];
}messagesPromptMessage[]Required
This is the list of messages that make up the prompt.
See PromptMessage.
Example: [{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"Hello, {{name}}! How can I help you today?"}]
aliasstringRequired
This is the alias of the prompt, which is unique within your project.
Example: "greeting"
idstringRequired
This is the id of the commit pulled, generated by Confident AI, not to be confused with the prompt id, the version number, or the commit hash.
Example: "<COMMIT-ID>"
hashstringRequired
This is the commit hash of the prompt pulled.
Example: "bab04ce"
versionstring
The version number of the prompt, present when the commit pulled has been released as a version.
Example: "00.00.01"
labelstring
The user-defined label of the version pulled, present when the version carries one.
Example: "production"
typePromptTypeRequired
See PromptType.
interpolationTypePromptInterpolationTypeRequired
modelSettingsModelSettings
See ModelSettings.
outputTypePromptOutputTypeRequired
See PromptOutputType.
outputSchemaOutputSchema
See OutputSchema.
toolsTool[]
This is the list of tools available to the prompt.
See Tool.
PromptInterpolationType
The type of interpolation format used in the prompt to insert dynamic variables.
class PromptInterpolationType(Enum):
MUSTACHE = "MUSTACHE"
MUSTACHE_WITH_SPACE = "MUSTACHE_WITH_SPACE"
FSTRING = "FSTRING"
DOLLAR_BRACKETS = "DOLLAR_BRACKETS"
JINJA = "JINJA"enum PromptInterpolationType {
MUSTACHE = "MUSTACHE",
MUSTACHE_WITH_SPACE = "MUSTACHE_WITH_SPACE",
FSTRING = "FSTRING",
DOLLAR_BRACKETS = "DOLLAR_BRACKETS",
JINJA = "JINJA",
}MUSTACHE · MUSTACHE_WITH_SPACE · FSTRING · DOLLAR_BRACKETS · JINJA
PromptList
class PromptList:
prompts: List[PromptSummary]promptsList[PromptSummary]Required
This is the list of prompts in your project.
See PromptSummary.
interface PromptList {
prompts: PromptSummary[];
}promptsPromptSummary[]Required
This is the list of prompts in your project.
See PromptSummary.
PromptMessage
class PromptMessage:
role: str
content: strrolestrRequired
This is the role of the message, which can be user, assistant, system, or developer.
Example: "user"
contentstrRequired
This is the text content of the message.
Example: "Hello, {{name}}! How can I help you today?"
interface PromptMessage {
role: string;
content: string;
}rolestringRequired
This is the role of the message, which can be user, assistant, system, or developer.
Example: "user"
contentstringRequired
This is the text content of the message.
Example: "Hello, {{name}}! How can I help you today?"
PromptOutputType
The type of output expected from the prompt.
class PromptOutputType(Enum):
TEXT = "TEXT"
JSON = "JSON"
SCHEMA = "SCHEMA"enum PromptOutputType {
TEXT = "TEXT",
JSON = "JSON",
SCHEMA = "SCHEMA",
}TEXT · JSON · SCHEMA
PromptSummary
A prompt as it appears in your project's prompt list, without any version content.
class PromptSummary:
id: str
alias: str
type: PromptTypeidstrRequired
This is the unique id of the prompt.
Example: "<PROMPT-ID>"
aliasstrRequired
This is the alias of the prompt, which is unique within your project.
Example: "greeting"
typePromptTypeRequired
See PromptType.
interface PromptSummary {
id: string;
alias: string;
type: PromptType;
}idstringRequired
This is the unique id of the prompt.
Example: "<PROMPT-ID>"
aliasstringRequired
This is the alias of the prompt, which is unique within your project.
Example: "greeting"
typePromptTypeRequired
See PromptType.
PromptType
This is the type of the prompt, which can be either a simple text or a list of messages.
class PromptType(Enum):
TEXT = "TEXT"
LIST = "LIST"enum PromptType {
TEXT = "TEXT",
LIST = "LIST",
}TEXT · LIST
PushPromptRequest
The commit to push. Send text for a text prompt or messages for a messages prompt, never both. The kind must match the existing prompt's type.
PushPromptRequest = Union[
PushTextPrompt,
PushMessagesPrompt,
]type PushPromptRequest =
| PushTextPrompt
| PushMessagesPrompt;A PushPromptRequest is one of the shapes below. Send the fields of one of them, never a mix of both.
Pushes a commit to a text prompt. interpolationType defaults to FSTRING when omitted.
class PushTextPrompt:
text: str
alias: str
interpolation_type: Optional[PromptInterpolationType] = Field(default=None, alias="interpolationType")
model_settings: Optional[ModelSettings] = Field(default=None, alias="modelSettings")
output_type: Optional[PromptOutputType] = Field(default=None, alias="outputType")
output_schema: Optional[OutputSchema] = Field(default=None, alias="outputSchema")
tools: Optional[List[Tool]] = None
branch: Optional[str] = NonetextstrRequired
The text content of the prompt.
Example: "Hello, {{name}}! How can I help you today?"
aliasstrRequired
The alias of the prompt, unique within your project. A new prompt is created when no prompt with this alias exists.
Example: "greeting"
interpolation_typeOptional[PromptInterpolationType]
model_settingsOptional[ModelSettings]
See ModelSettings.
output_typeOptional[PromptOutputType]
See PromptOutputType.
output_schemaOptional[OutputSchema]
See OutputSchema.
toolsOptional[List[Tool]]
This is the list of tools to make available to the prompt.
See Tool.
branchOptional[str]
The name of the branch to push the new commit to. The branch is created from main when it does not exist yet.
Example: "main"
interface PushTextPrompt {
text: string;
alias: string;
interpolationType?: PromptInterpolationType;
modelSettings?: ModelSettings;
outputType?: PromptOutputType;
outputSchema?: OutputSchema;
tools?: Tool[];
branch?: string;
}textstringRequired
The text content of the prompt.
Example: "Hello, {{name}}! How can I help you today?"
aliasstringRequired
The alias of the prompt, unique within your project. A new prompt is created when no prompt with this alias exists.
Example: "greeting"
interpolationTypePromptInterpolationType
modelSettingsModelSettings
See ModelSettings.
outputTypePromptOutputType
See PromptOutputType.
outputSchemaOutputSchema
See OutputSchema.
toolsTool[]
This is the list of tools to make available to the prompt.
See Tool.
branchstring
The name of the branch to push the new commit to. The branch is created from main when it does not exist yet.
Example: "main"
Pushes a commit to a messages prompt. interpolationType defaults to FSTRING when omitted.
class PushMessagesPrompt:
messages: List[PromptMessage]
alias: str
interpolation_type: Optional[PromptInterpolationType] = Field(default=None, alias="interpolationType")
model_settings: Optional[ModelSettings] = Field(default=None, alias="modelSettings")
output_type: Optional[PromptOutputType] = Field(default=None, alias="outputType")
output_schema: Optional[OutputSchema] = Field(default=None, alias="outputSchema")
tools: Optional[List[Tool]] = None
branch: Optional[str] = NonemessagesList[PromptMessage]Required
The list of messages that make up the prompt.
See PromptMessage.
Example: [{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"Hello, {{name}}! How can I help you today?"}]
aliasstrRequired
The alias of the prompt, unique within your project. A new prompt is created when no prompt with this alias exists.
Example: "greeting"
interpolation_typeOptional[PromptInterpolationType]
model_settingsOptional[ModelSettings]
See ModelSettings.
output_typeOptional[PromptOutputType]
See PromptOutputType.
output_schemaOptional[OutputSchema]
See OutputSchema.
toolsOptional[List[Tool]]
This is the list of tools to make available to the prompt.
See Tool.
branchOptional[str]
The name of the branch to push the new commit to. The branch is created from main when it does not exist yet.
Example: "main"
interface PushMessagesPrompt {
messages: PromptMessage[];
alias: string;
interpolationType?: PromptInterpolationType;
modelSettings?: ModelSettings;
outputType?: PromptOutputType;
outputSchema?: OutputSchema;
tools?: Tool[];
branch?: string;
}messagesPromptMessage[]Required
The list of messages that make up the prompt.
See PromptMessage.
Example: [{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"Hello, {{name}}! How can I help you today?"}]
aliasstringRequired
The alias of the prompt, unique within your project. A new prompt is created when no prompt with this alias exists.
Example: "greeting"
interpolationTypePromptInterpolationType
modelSettingsModelSettings
See ModelSettings.
outputTypePromptOutputType
See PromptOutputType.
outputSchemaOutputSchema
See OutputSchema.
toolsTool[]
This is the list of tools to make available to the prompt.
See Tool.
branchstring
The name of the branch to push the new commit to. The branch is created from main when it does not exist yet.
Example: "main"
PushPromptResult
class PushPromptResult:
prompt_id: str = Field(alias="promptId")
hash: strprompt_idstrRequired
This is the id of the prompt generated by Confident AI, not to be confused with the alias you supplied.
Example: "<PROMPT-ID>"
hashstrRequired
This is the hash of the commit created by this push, not to be confused with a version number.
Example: "bab04ce"
interface PushPromptResult {
promptId: string;
hash: string;
}promptIdstringRequired
This is the id of the prompt generated by Confident AI, not to be confused with the alias you supplied.
Example: "<PROMPT-ID>"
hashstringRequired
This is the hash of the commit created by this push, not to be confused with a version number.
Example: "bab04ce"
ReasoningEffort
This is the level of reasoning effort for the model.
class ReasoningEffort(Enum):
MINIMAL = "MINIMAL"
LOW = "LOW"
MEDIUM = "MEDIUM"
HIGH = "HIGH"enum ReasoningEffort {
MINIMAL = "MINIMAL",
LOW = "LOW",
MEDIUM = "MEDIUM",
HIGH = "HIGH",
}MINIMAL · LOW · MEDIUM · HIGH
SchemaDataType
This is the data type of a schema field.
class SchemaDataType(Enum):
OBJECT = "OBJECT"
ARRAY = "ARRAY"
STRING = "STRING"
FLOAT = "FLOAT"
INTEGER = "INTEGER"
BOOLEAN = "BOOLEAN"
NULL = "NULL"enum SchemaDataType {
OBJECT = "OBJECT",
ARRAY = "ARRAY",
STRING = "STRING",
FLOAT = "FLOAT",
INTEGER = "INTEGER",
BOOLEAN = "BOOLEAN",
NULL = "NULL",
}OBJECT · ARRAY · STRING · FLOAT · INTEGER · BOOLEAN · NULL
StructuredSchema
This is the schema for your tool's input.
class StructuredSchema:
id: Optional[str] = None
name: Optional[str] = None
fields: List[StructuredSchemaField]idOptional[str]
This is the id of the schema assigned by Confident AI.
Example: "<STRUCTURED-SCHEMA-ID>"
nameOptional[str]
This is the name of the schema.
Example: "GetCustomerNameInput"
fieldsList[StructuredSchemaField]Required
This is the array of fields that define the tool's input structure.
interface StructuredSchema {
id?: string;
name?: string | null;
fields: StructuredSchemaField[];
}idstring
This is the id of the schema assigned by Confident AI.
Example: "<STRUCTURED-SCHEMA-ID>"
namestring | null
This is the name of the schema.
Example: "GetCustomerNameInput"
fieldsStructuredSchemaField[]Required
This is the array of fields that define the tool's input structure.
StructuredSchemaField
class StructuredSchemaField:
id: str
name: Optional[str] = None
description: Optional[str] = None
type: SchemaDataType
required: Optional[bool] = None
parent_id: Optional[str] = Field(default=None, alias="parentId")idstrRequired
This is the unique identifier for the schema field. Use it as the parentId of nested fields.
Example: "<FIELD-ID>"
nameOptional[str]
This is the name of the schema field.
Example: "customerId"
descriptionOptional[str]
This is the description of the schema field.
Example: "The id of the customer to look up."
typeSchemaDataTypeRequired
See SchemaDataType.
requiredOptional[bool]
This indicates whether the field is required in the input.
Example: true
parent_idOptional[str]
This is the id of the parent field for nested structures, or null for a top-level field.
interface StructuredSchemaField {
id: string;
name?: string | null;
description?: string | null;
type: SchemaDataType;
required?: boolean;
parentId?: string | null;
}idstringRequired
This is the unique identifier for the schema field. Use it as the parentId of nested fields.
Example: "<FIELD-ID>"
namestring | null
This is the name of the schema field.
Example: "customerId"
descriptionstring | null
This is the description of the schema field.
Example: "The id of the customer to look up."
typeSchemaDataTypeRequired
See SchemaDataType.
requiredboolean
This indicates whether the field is required in the input.
Example: true
parentIdstring | null
This is the id of the parent field for nested structures, or null for a top-level field.
Tool
class Tool:
id: Optional[str] = None
name: str
description: Optional[str] = None
mode: ToolMode
structured_schema: StructuredSchema = Field(alias="structuredSchema")idOptional[str]
This is the id of the tool assigned by Confident AI.
Example: "<TOOL-ID>"
namestrRequired
This is the name of the tool.
Example: "get_customer_name"
descriptionOptional[str]
This is the description of the tool.
Example: "Looks up the customer's name by id."
modeToolModeRequired
See ToolMode.
structured_schemaStructuredSchemaRequired
See StructuredSchema.
interface Tool {
id?: string;
name: string;
description?: string | null;
mode: ToolMode;
structuredSchema: StructuredSchema;
}idstring
This is the id of the tool assigned by Confident AI.
Example: "<TOOL-ID>"
namestringRequired
This is the name of the tool.
Example: "get_customer_name"
descriptionstring | null
This is the description of the tool.
Example: "Looks up the customer's name by id."
modeToolModeRequired
See ToolMode.
structuredSchemaStructuredSchemaRequired
See StructuredSchema.
ToolMode
This is the mode for your tool input fields, which controls whether fields outside the schema are allowed.
class ToolMode(Enum):
ALLOW_ADDITIONAL = "ALLOW_ADDITIONAL"
NO_ADDITIONAL = "NO_ADDITIONAL"
STRICT = "STRICT"enum ToolMode {
ALLOW_ADDITIONAL = "ALLOW_ADDITIONAL",
NO_ADDITIONAL = "NO_ADDITIONAL",
STRICT = "STRICT",
}ALLOW_ADDITIONAL · NO_ADDITIONAL · STRICT
Verbosity
This is the verbosity level for model output.
class Verbosity(Enum):
LOW = "LOW"
MEDIUM = "MEDIUM"
HIGH = "HIGH"enum Verbosity {
LOW = "LOW",
MEDIUM = "MEDIUM",
HIGH = "HIGH",
}LOW · MEDIUM · HIGH
Last updated on