LLM Playground
Test and iterate on your prompts directly in the Langfuse Prompt Playground. Tweak the prompt and model parameters to see how different models respond to these input changes. This allows you to quickly iterate on your prompts and optimize them for the best results in your LLM app without having to switch between tools or use any code.
![]()
Core features
Side-by-Side Comparison View
Compare multiple prompt variants alongside each other. Execute them all at once or focus on a single variant. Each variant keeps its own LLM settings, variables, tool definitions, and placeholders so you can immediately see the impact of every change.
Playground with one window. Click âNew split windowâ to copy it, open the copy's âVariablesâ and change language from typescript to go, then click âRun Allâ to run both windows at once and compare their outputs. Close the copy with âRemove windowâ.
Open your prompt in the playground
You can open a prompt you created with Langfuse Prompt Management in the playground.
Prompts > movie-critic, version 3. Click âPlaygroundâ > âFresh playgroundâ, fill the variables criticlevel (expert) and movie (Dune: Part Two) in the Variables panel and click âSubmitâ to get the model's answer in Output.
Save your prompt to Prompt Management
When you're satisfied with your prompt, you can save it to Prompt Management by clicking the save button.
Playground with a chat prompt. Click âSave as promptâ in the window header > âSave as new promptâ. The new-prompt form opens with the playground's messages; enter the name movie-critic-chat, keep âSet the production labelâ checked and click âCreate promptâ. It lands on version 1 with the production and latest labels.
Open a generation in the playground
You can open a generation from Langfuse Observability in the playground: select the generation in a trace, then choose Add to â Playground â Fresh playground. The playground opens with the generation's messages and model settings.
Trace detail with a qa-answer generation selected. Click âAdd toâ in the observation header > âPlaygroundâ > âFresh playgroundâ; the playground opens with the generation's system and user messages and model settings. Click âSubmitâ to rerun it.
Tool calling and structured outputs
The Langfuse Playground supports tool calling and structured output schemas, enabling you to define, test, and validate LLM executions that rely on tool calls and enforce specific response formats.
Currently, Langfuse supports opening tool-type observations in the playground only when they are in the OpenAI ChatML format. If youâd like to see support for additional formats, feel free to add your request to our public roadmap.
Tool Calling
- Define custom tools with JSON schema definitions
- Test prompts relying on tools in real-time by mocking tool responses
- Save tool definitions to your project
Structured Output
- Enforce response formats using JSON schemas
- Save schemas to your project
- Jump into the playground from your OpenAI generation using structured output
Add prompt variables
You can add prompt variables in the playground to simulate different inputs to your prompt.
![]()
Use your favorite model
You can use your favorite model by adding the API key for the model you want to use in the Langfuse project settings. Learn how to set up an LLM connection.
![]()
Optionally, many LLM providers allow for additional parameters when invoking a model. You can pass these parameters in the playground when toggling "Additional Options" in the model selection dropdown. Read this documentation about additional provider options for more information.
Related Resources
- For structured regression testing of prompt and model variants on datasets, use Experiments.
GitHub Discussions
Last updated on