LangSmith Prompt icon

LangSmith Prompt

Fill in a prompt template stored in LangSmith

LangSmith Prompt

AI-generated

Overview

This node, named "LangSmith Prompt," allows users to fill in a prompt template stored in their LangSmith account by substituting parameters dynamically. It fetches a prompt template by its name from LangSmith and replaces placeholders within the template with user-provided values. This is useful for automating text generation workflows where prompts need to be customized on the fly based on input data.

Common scenarios:

  • Dynamically generating prompts for AI language models based on variable inputs.
  • Automating content creation where templates are reused with different parameters.
  • Integrating LangSmith prompt templates into larger automation workflows in n8n.

Example:
If you have a prompt template named "WelcomeMessage" that contains "Hello {name}, welcome to {company}!", you can use this node to substitute {name} and {company} with actual values like "Alice" and "Acme Corp" respectively, producing the final prompt text.

Properties

Name Meaning
Prompt Name The name of the prompt template stored in your LangSmith account to retrieve and fill.
Input Parameters A collection of key-value pairs where each key corresponds to a placeholder in the template, and the value is what will replace it.
  • Input Parameters supports multiple entries, each requiring:
    • Name: The placeholder name in the template (e.g., name).
    • Value: The string to substitute in place of the placeholder.

Output

The node outputs an array containing one item with a JSON object. The JSON object has a single property whose key is the prompt name and whose value is the filled-in prompt string after substitution.

Example output JSON structure:

{
  "WelcomeMessage": "Hello Alice, welcome to Acme Corp!"
}

No binary data output is produced by this node.

Dependencies

  • Requires an API key credential for LangSmith to authenticate requests.
  • Uses internal helper functions to fetch the prompt template by name and perform the substitution.
  • The node depends on network access to communicate with the LangSmith service.

Troubleshooting

  • Prompt not found error: If the specified prompt name does not exist in the LangSmith account, the node throws an error stating Prompt with name "<promptName>" not found. Verify the prompt name spelling and existence in your LangSmith account.
  • Credential issues: Ensure the API key credential is correctly configured and valid; otherwise, authentication errors may occur.
  • Parameter mismatch: If required placeholders in the prompt template are not provided in the input parameters, the resulting prompt may contain unsubstituted placeholders or cause unexpected results.

Links and References

Discussion