Create a new commit for an existing prompt.
createCommit(
promptIdentifier: string,
object: any,
options: __type
): Promise<string>| Name | Type | Description |
|---|---|---|
promptIdentifier* | string | The identifier of the prompt. Can be in the format:
|
object* | any | The prompt object/manifest to commit (e.g., ChatPromptTemplate, messages array, etc.) |
options | __type | Optional configuration for the commit |
import { ChatPromptTemplate } from "@langchain/core/prompts";
// Create a commit with a new version of the prompt
const template = ChatPromptTemplate.fromMessages([
["system", "You are a helpful assistant."],
["human", "{input}"]
]);
const commitUrl = await client.createCommit("my-prompt", template);
console.log(`Commit created: ${commitUrl}`);
// Create a commit based on a specific parent commit
const commitUrl2 = await client.createCommit("my-prompt", template, {
parentCommitHash: "abc123def456"
});