Create a prompt 创建提示
Navigate to the Prompts section in the left-hand sidebar or from the application homepage.
Click the "+ Prompt" button to enter the Playground. The dropdown next to the button gives you a choice between a chat style prompt and an instructional prompt - chat is the default.
导航至左侧边栏或应用程序主页的“提示”部分。单击“+提示”按钮进入游乐场。按钮旁边的下拉菜单让您可以在聊天样式提示和指导提示之间进行选择 - 聊天是默认设置。
Compose your prompt
撰写您的提示
After choosing a prompt type, you're brought to the playground to develop your prompt.
On the left is an editable view of the prompt. You can add more messages, change the template format (f-string or mustache), and add an output schema (which makes your prompt a StructuredPrompt type).
选择提示类型后,您将被带到游乐场来开发提示。左侧是提示的可编辑视图。您可以添加更多消息、更改模板格式(f 字符串或小胡子)并添加输出架构(这使您的提示成为 StructuredPrompt 类型)。
To the right, we can enter sample inputs for our prompt variables and then run our prompt against a model.
在右侧,我们可以为提示变量输入示例输入,然后针对模型运行提示。
(If you haven't yet, you'll need to enter an API key for whichever model you want to run your prompt with.)
(如果您还没有输入 API 密钥,则需要输入您想要运行提示的模型的 API 密钥。)
To see the response from the model, click "Start".
要查看模型的响应,请单击“开始”。
Save your prompt
保存您的提示
To save your prompt, click the "Save as" button, name your prompt, and decide if you want it to be "private" or "public".
Private prompts are only visible to your workspace, while public prompts are discoverable to anyone in the LangChain Hub.
Click save to create your prompt.
要保存提示,请单击“另存为”按钮,为提示命名,然后决定是“私有”还是“公共”。私人提示仅对您的工作区可见,而公共提示对 LangChain Hub 中的任何人都可见。单击“保存”以创建提示。
The model and configuration you select in the Playground settings will be saved with the prompt. When you reopen the prompt, the model and configuration will automatically load from the saved version.
您在 Playground 设置中选择的模型和配置将随提示一起保存。当您重新打开提示时,模型和配置将自动从保存的版本加载。
The first time you create a public prompt, you'll be asked to set a LangChain Hub handle. All your public prompts will be linked to this handle. In a shared workspace, this handle will be set for the whole workspace.
第一次创建公共提示时,系统会要求您设置 LangChain Hub 句柄。您的所有公共提示都将链接到此句柄。在共享工作区中,将为整个工作区设置此句柄。
View your prompts
查看您的提示
You've just created your first prompt! View a table of your prompts in the prompts tab.
您刚刚创建了第一个提示!在提示选项卡中查看提示表。
Add metadata
添加元数据
To add metadata to your prompt, click the prompt and then click the "Edit" pencil icon next to the name.
This brings you to where you can add additional information about the prompt, including a description, a README, and use cases.
For public prompts this information will be visible to anyone who views your prompt in the LangChain Hub.
要将元数据添加到提示中,请单击提示,然后单击名称旁边的“编辑”铅笔图标。您可以在此处添加有关提示的其他信息,包括说明、自述文件和用例。对于公共提示,任何在 LangChain Hub 中查看您的提示的人都可以看到此信息。