Commits
Overview
The Confident AI SDK exposes every Commit 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.
Methods
List Commits
Lists the commits of the prompt, newest first. Pass branch to list only the commits reachable from that branch.
from confident_ai import ConfidentAI
client = ConfidentAI()
prompt = client.prompt(prompt_id="<PROMPT-ID>")
result = prompt.list_commits(branch="main")For async mode, call a_list_commits and await it as shown below:
result = await prompt.a_list_commits(...)Parameters
| Parameter | Type | Description |
|---|---|---|
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 prompt = client.prompt("<PROMPT-ID>");
const result = await prompt.listCommits({ branch: "main" });Parameters
| Parameter | Type | Description |
|---|---|---|
branch | string | The name of the branch to read from. Defaults to main when omitted. |
Returns
This method returns an object of type PromptCommitList.
Methods (Stateless)
These methods take every argument themselves, so a caller reaches them through client.prompts without opening a Prompt first.
Get Commits
Lists the commits of the prompt, newest first. Pass branch to list only the commits reachable from that branch.
from confident_ai import ConfidentAI
client = ConfidentAI()
result = client.prompts.get_commits(prompt_id="<PROMPT-ID>", branch="main")For async mode, call a_get_commits and await it as shown below:
result = await client.prompts.a_get_commits(...)Parameters
| Parameter | Type | Description |
|---|---|---|
prompt_id | str | Required. The unique id of the prompt. |
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.getCommits(
"<PROMPT-ID>",
{ branch: "main" },
);Parameters
| Parameter | Type | Description |
|---|---|---|
promptId | string | Required. The unique id of the prompt. |
branch | string | The name of the branch to read from. Defaults to main when omitted. |
Returns
This method returns an object of type PromptCommitList.
Types
PromptCommit
class PromptCommit:
id: str
hash: str
message: stridstrRequired
The id of a commit generated by Confident AI, not to be confused with the prompt id or the commit hash.
Example: "<COMMIT-ID>"
hashstrRequired
The hash of a commit generated by Confident AI.
Example: "bab04ce"
messagestrRequired
The message associated with a commit, not to be confused with a prompt's messages.
Example: "Committed from API"
interface PromptCommit {
id: string;
hash: string;
message: string;
}idstringRequired
The id of a commit generated by Confident AI, not to be confused with the prompt id or the commit hash.
Example: "<COMMIT-ID>"
hashstringRequired
The hash of a commit generated by Confident AI.
Example: "bab04ce"
messagestringRequired
The message associated with a commit, not to be confused with a prompt's messages.
Example: "Committed from API"
PromptCommitList
class PromptCommitList:
commits: List[PromptCommit]commitsList[PromptCommit]Required
This is the list of commits on the prompt, newest first.
See PromptCommit.
interface PromptCommitList {
commits: PromptCommit[];
}commitsPromptCommit[]Required
This is the list of commits on the prompt, newest first.
See PromptCommit.
Last updated on