Langfuse icon

Langfuse

Interact with Langfuse

Overview

This node integrates with Langfuse, a service for managing and executing prompts. It allows users to select a predefined prompt by name or ID and provide variables to customize the prompt execution. The node compiles the selected prompt with the given variables and outputs the resulting compiled prompt text.

Common scenarios include:

  • Automating prompt generation workflows where prompts are stored and managed in Langfuse.
  • Dynamically customizing prompts based on input data or workflow context.
  • Integrating Langfuse prompt compilation into larger automation pipelines.

For example, a user might select a prompt named "WelcomeMessage" and supply variables like {userName: "Alice"} to generate a personalized welcome message dynamically.

Properties

Name Meaning
Prompt Name or ID The name or ID of the prompt to use. Choose from a list loaded dynamically from Langfuse, or specify via expression.
Variables A collection of variable assignments to be used when compiling the prompt. Each variable has a name and value.

Output

The node outputs JSON data containing the compiled prompt text under the field compiledChatPrompt. The output is structured as an array of items, each with a JSON object:

[
  {
    "json": {
      "compiledChatPrompt": "<compiled prompt string>"
    }
  }
]

There is no binary data output.

Dependencies

  • Requires an API key credential for Langfuse to authenticate requests.
  • Uses Langfuse API endpoints to fetch available prompts and compile them.
  • The node depends on the external Langfuse service being accessible and properly configured.

Troubleshooting

  • Common issues:

    • Invalid or missing API credentials will cause authentication failures.
    • Specifying a prompt name or ID that does not exist will result in errors fetching or compiling the prompt.
    • Incorrectly formatted variables may cause compilation to fail or produce unexpected results.
  • Error messages and resolutions:

    • Authentication errors: Verify the API key credential is correctly set up in n8n.
    • Prompt not found: Ensure the prompt name or ID matches one available in Langfuse.
    • Variable assignment errors: Check that variables are provided as name-value pairs and match expected prompt parameters.

Links and References

Discussion