LangSmith 提供多种工具来帮助您有效地管理提示。本页描述以下功能:

提交标签

提交标签是引用提示版本历史中特定提交的标签。它们帮助您标记重要版本并控制哪些版本在不同环境中运行。通过在代码中引用标签而不是提交 ID,您可以更新正在使用的版本,而无需修改代码本身。 每个标签引用恰好一个提交,尽管您可以重新分配标签以指向不同的提交。
不要与资源标签混淆:提交标签特定于提示版本控制,并引用提示历史中的单个提交。资源标签是用于组织工作区资源(如项目、数据集和提示)的键值对。虽然两者都可以使用类似的命名约定(如 prodstaging),但提交标签控制提示的哪个版本运行,而资源标签帮助您组织和过滤工作区中的资源。

Create a tag

To create a tag, navigate to the Commits tab for a prompt. Click on the tag icon next to the commit you want to tag. Click New Tag and enter a name for the tag.

Move a tag

To point a tag to a different commit, click on the tag icon next to the destination commit, and select the tag you want to move. This will automatically update the tag to point to the new commit.

Delete a tag

To delete a tag, click on the delete icon next to the tag you want to delete. This will delete the tag altogether and it will no longer be associated with any commit.

Use tags in code

Tags provide a stable way to reference specific versions of your prompts in code. Instead of using commit hashes directly, you can reference tags that can be updated without changing your code. Here is an example of pulling a prompt by tag in Python:
prompt = client.pull_prompt("joke-generator:prod")
# If prod tag points to commit a1b2c3d4, this is equivalent to:
prompt = client.pull_prompt("joke-generator:a1b2c3d4")
For more information on how to use prompts in code, refer to Managing prompts programmatically.

Trigger a webhook on prompt commit

You can configure a webhook to be triggered whenever a commit is made to a prompt. Some common use cases of this include:
  • Triggering a CI/CD pipeline when prompts are updated.
  • Synchronizing prompts with a GitHub repository.
  • Notifying team members about prompt modifications.

Configure a webhook

Navigate to the Prompts section in the left-hand sidebar or from the application homepage. In the top right corner, click on the + Webhook button. Add a webhook URL and any required headers.
You can only configure one webhook per workspace. If you want to configure multiple per workspace or set up a different webhook for each prompt, let us know in the LangChain Forum.
To test out your webhook, click the Send test notification button. This will send a test notification to the webhook URL you provided with a sample payload. The sample payload is a JSON object with the following fields:
  • prompt_id: The ID of the prompt that was committed.
  • prompt_name: The name of the prompt that was committed.
  • commit_hash: The commit hash of the prompt.
  • created_at: The date of the commit.
  • created_by: The author of the commit.
  • manifest: The manifest of the prompt.

Trigger the webhook

向某个提示提交更改即可触发已配置的 Webhook。 如果在 Playground 中执行此操作,系统会提示您取消选择不希望触发的 Webhook。 如果通过 API 提交,可以将 skip_webhooks 参数设置为 true 或指定需要忽略的 webhook id 数组,以跳过相应 Webhook。详情请参阅 API 文档

Public prompt hub

LangSmith 的公共提示库收录了 LangChain 社区创建的提示,可供您参考。
提示均由用户创建,未经 LangChain 审核或背书,使用时请自行承担风险。使用 Prompt Hub 需遵守我们的服务条款
Navigate to the Prompts section of the left-hand sidebar and click on Browse all Public Prompts in the LangChain Hub. 在这里可以浏览 LangChain Hub 上所有公开的提示。您可以按名称、作者、用例、描述或模型等条件搜索;也可以将提示 fork 到自己的组织,查看详细信息,并在 Playground 中运行。还可以通过 SDK 将任何公开提示拉取到您的代码中 要查看与工作区关联的提示,请访问侧边栏中的 Prompts 标签页。
Connect these docs programmatically to Claude, VSCode, and more via MCP for real-time answers.