LangChain Hub
The LangChain Hub component fetches a prompt published on that hub, looking it up by its name, and delivers it as text ready to use in your flow. If the prompt has gaps in curly braces, the component creates a field for each one, so you can fill them in with data from the flow.
It is useful when your team already keeps and maintains its prompts on LangChain Hub: the flow always uses the published version and you don’t have to copy the text by hand into each flow.
When to use it
- Your team maintains its assistants’ instructions on LangChain Hub and you want your flows to always use the same ones.
- You want to reuse in NappAI a prompt someone has already published, instead of rewriting it.
- Several flows share the same instructions and you want to change them in one place.
Configuration
| Field | What it does |
|---|---|
| Credential (required) | The credential of the Langsmith & Langchain API service. Pick one with Choose an option or create one with Add new credential. More in Credentials. |
| LangChain Hub Prompt | The name of the prompt on the hub, in the form owner/prompt-name. It comes with an example name: replace it with the one of the prompt you want to use. |
Prompt gaps
After typing the name, press the refresh button of the LangChain Hub Prompt field. The component downloads the prompt and creates a field for each gap in curly braces it contains, named after the gap. You can type each of those fields in the panel or connect it to the text output of another component.
After refreshing, the full text of the prompt appears in the help of the LangChain Hub Prompt field, so you can check it is the one you expected.
Output
Build Prompt is the text of the prompt with the gaps filled in. If the prompt has several parts, each one appears on its own line, preceded by System: for the system instructions and User: for the user message. Connect it to a text input, such as the Input of an agent or the input of an AI model.
Example
The marketing team of Viajes Alameda has published on LangChain Hub a prompt to write destination descriptions, with a {destination} gap:
- Add the LangChain Hub component and choose the Langsmith & Langchain API credential.
- In LangChain Hub Prompt type the prompt’s name and press the refresh button. The destination field appears.
- Connect to destination the text that arrives from a Chat Input.
- Connect Build Prompt to the input of an AI model.
When the team improves the prompt on the hub, the flow uses the new version without changing anything in NappAI.