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
JavaScriptlangsmithclientClientpromptExists
Method●Since v0.1

promptExists

Check if a prompt exists.

Copy
promptExists(promptIdentifier: string): Promise<boolean>

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)

Example

Copy
// Check if a prompt exists before creating a commit
if (await client.promptExists("my-prompt")) {
  await client.createCommit("my-prompt", template);
} else {
  await client.createPrompt("my-prompt");
}
View source on GitHub