Skip to content

Langfuse

Abstract

Langfuse is an open-source platform for tracing and evaluating LLM applications.

Capabilities

  • Trace each model request;
  • Prompt and response logs;
  • Quality assessment of responses;
  • Metrics for cost and latency;
  • Self-hosted or cloud.

Use Cases

  • Debugging RAG and agents;
  • Production monitoring;
  • Quality evaluation of generations;
  • LLMOps.

Why It Matters

When an application works with a model, it's important to see more than just 'works/not working':

  • What went into the model;
  • What it responded with;
  • How much it cost;
  • Where the response was poor.

Getting Started

pip install langfuse

Minimal setup:

from langfuse import Langfuse

langfuse = Langfuse(
    public_key="pk-...",
    secret_key="sk-...",
)

trace = langfuse.trace(name="my-llm-call")
trace.generation(
    name="gpt-4o",
    input="User question",
    output="Model response",
    model="gpt-4o",
)

Requests will appear in the dashboard: input, output, model, and cost are visible.

See Also