LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
LangSmith
  • Client
  • Run Trees
  • Traceable
  • Evaluation
  • Schemas
  • Langchain
  • Jest
  • Vitest
  • Wrappers
  • Anonymizer
  • Jestlike
  • Vercel
  • Anthropic
  • Sandbox
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

LangSmith
ClientRun TreesTraceableEvaluationSchemasLangchainJestVitestWrappersAnonymizerJestlikeVercelAnthropicSandbox
Language
Theme
JavaScriptlangsmithclientClientcreateCommit
Method●Since v0.1

createCommit

Create a new commit for an existing prompt.

Copy
createCommit(
  promptIdentifier: string,
  object: any,
  options: __type
): Promise<string>

Parameters

NameTypeDescription
promptIdentifier*string

The identifier of the prompt. Can be in the format:

  • "promptName" (for private prompts, owner defaults to "-")
  • "owner/promptName" (for prompts with explicit owner)
object*any

The prompt object/manifest to commit (e.g., ChatPromptTemplate, messages array, etc.)

options__type

Optional configuration for the commit

Example

Copy
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"
});
View source on GitHub