Skip to content

Commit 41851f1

Browse files
authored
Consolidate LS manage prompts dropdown pages (#154)
1 parent 9158c5b commit 41851f1

File tree

4 files changed

+114
-116
lines changed

4 files changed

+114
-116
lines changed

src/langsmith/langchain-hub.mdx

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/langsmith/manage-prompts.mdx

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
---
2+
title: Manage prompts
3+
sidebarTitle: Manage prompts
4+
---
5+
6+
LangSmith provides several tools to help you manage your [_prompts_](/langsmith/prompt-engineering-overview) effectively. This page describes the following features:
7+
8+
- [Commit tags](#commit-tags) for version control and environment management.
9+
- [Webhook triggers](#trigger-a-webhook-on-prompt-commit) for automating workflows when prompts are updated.
10+
- [Public prompt hub](#public-prompt-hub) for discovering and using community-created prompts.
11+
12+
## Commit tags
13+
14+
[_Commit tags_](/langsmith/prompt-engineering-overview#tags) are labels that reference a specific [_commit_](/langsmith/prompt-engineering-overview#commits) in your prompt's version history. They help you mark significant versions and control which versions run in different environments. By referencing tags rather than commit IDs in your code, you can update which version is being used without modifying the code itself.
15+
16+
Each tag references exactly one commit, though you can reassign a tag to point to a different commit.
17+
18+
Use cases for commit tags can include:
19+
20+
- **Environment-specific tags**: Mark commits for `production` or `staging` environments, which allows you to switch between different versions without changing your code.
21+
- **Version control**: Mark stable versions of your prompts, for example, `v1`, `v2`, which lets you reference specific versions in your code and track changes over time.
22+
- **Collaboration**: Mark versions ready for review, which enables you to share specific versions with collaborators and get feedback.
23+
24+
### Create a tag
25+
26+
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.
27+
28+
![](/langsmith/images/commits-tab.png) ![](/langsmith/images/create-new-prompt-tag.png)
29+
30+
### Move a tag
31+
32+
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.
33+
34+
![](/langsmith/images/move-prompt-tag.png)
35+
36+
### Delete a tag
37+
38+
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.
39+
40+
### Use tags in code
41+
42+
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.
43+
44+
Here is an example of pulling a prompt by tag in Python:
45+
46+
```python
47+
prompt = client.pull_prompt("joke-generator:prod")
48+
# If prod tag points to commit a1b2c3d4, this is equivalent to:
49+
prompt = client.pull_prompt("joke-generator:a1b2c3d4")
50+
```
51+
52+
For more information on how to use prompts in code, refer to [Managing prompts programmatically](/langsmith/manage-prompts-programmatically).
53+
54+
## Trigger a webhook on prompt commit
55+
56+
You can configure a webhook to be triggered whenever a commit is made to a prompt.
57+
58+
Some common use cases of this include:
59+
60+
* Triggering a CI/CD pipeline when prompts are updated.
61+
* Synchronizing prompts with a GitHub repository.
62+
* Notifying team members about prompt modifications.
63+
64+
### Configure a webhook
65+
66+
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.
67+
68+
Add a webhook URL and any required headers.
69+
70+
<Note>
71+
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](https://forum.langchain.com/).
72+
</Note>
73+
74+
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.
75+
76+
The sample payload is a JSON object with the following fields:
77+
78+
- `prompt_id`: The ID of the prompt that was committed.
79+
- `prompt_name`: The name of the prompt that was committed.
80+
- `commit_hash`: The commit hash of the prompt.
81+
- `created_at`: The date of the commit.
82+
- `created_by`: The author of the commit.
83+
- `manifest`: The manifest of the prompt.
84+
85+
### Trigger the webhook
86+
87+
Commit to a prompt to trigger the webhook you've configured.
88+
89+
#### Use the Playground
90+
91+
If you do this in the Playground, you'll be prompted to deselect the webhooks you'd like to avoid triggering.
92+
93+
![](/langsmith/images/commit-prompt-playground.png)
94+
95+
#### Using the API
96+
97+
If you commit via the API, you can specify to skip triggering the webhook by setting the `skip_webhooks` parameter to `true` or to an array of webhook ids to ignore. Refer to the [API docs](https://api.smith.langchain.com/redoc#tag/commits/operation/create_commit_api_v1_commits__owner___repo__post) for more information.
98+
99+
## Public prompt hub
100+
101+
LangSmith's public prompt hub is a collection of prompts that have been created by the LangChain community that you can use for reference.
102+
103+
<Note>
104+
Note that prompts are user-generated and unverified. LangChain does not review or endorse public prompts, use these at your own risk. Use of Prompt Hub is subject to our [Terms of Service](https://www.langchain.com/terms-of-service).
105+
</Note>
106+
107+
Navigate to the **Prompts** section of the left-hand sidebar and click on **Browse all Public Prompts in the LangChain Hub**.
108+
109+
Here you'll find all of the publicly listed prompts in the LangChain Hub. You can search for prompts by name, handle, use cases, descriptions, or models. You can fork prompts to your personal organization, view the prompt's details, and run the prompt in the Playground. You can [pull any public prompt into your code](/langsmith/manage-prompts-programmatically) using the SDK.
110+
111+
To view prompts tied to your workspace, visit the **Prompts** tab in the sidebar.
112+
113+
![](/langsmith/images/prompts-tab.png)
114+

src/langsmith/prompt-tags.mdx

Lines changed: 0 additions & 51 deletions
This file was deleted.

src/langsmith/trigger-webhook.mdx

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)