Langfuse Lead Qualifier

GTM lead-qualification experiment using AI, observability and evaluation.

Type Open Source GTM Tool
Node.jsOpenAI APILangfuseOpenTelemetryJSON Schema

Using Langfuse to make the output quality of an AI-assisted workflow testable and improvable while qualifying B2B travel companies by industry relevance, business model and API or infrastructure orientation.

Langfuse Lead Qualifier
15 / 15
Correct classifications in the V3 benchmark

The problem

In V1, both classification and reasoning were delegated to the LLM, so results changed from one run to another. Accuracy began at 66.7%; a more explicit rubric raised it to 86.7–93.3%, but variability remained. V3 moved signals, segment classification and recommended action into deterministic code. The LLM keeps only fit_score and qualitative reasoning. On a benchmark of 15 simulated companies, the architecture produced 15/15 correct classifications.

Why Langfuse

Once an LLM enters a workflow, a second question appears: how do you know whether its behaviour is improving or getting worse?

Langfuse Lead Qualifier company dataset
Example companies used in the benchmark.

The solution

The project simulates B2B lead qualification for a hypothetical SaaS company selling API infrastructure to travel businesses. Each company is evaluated for travel or hospitality relevance, B2B model and API, integration or infrastructure orientation. The output is segment, fit_score, reason and next_action.

Langfuse provides tracing, prompt versioning, a benchmark dataset, experiments, automated evaluators and quantitative comparison between prompt versions.

What I built

COMPANY
?
DATA / SIGNALS
?
DETERMINISTIC RULES ? segment and next action
?
LLM ? fit score and reasoning
?
OUTPUT

Langfuse observes the workflow through tracing, prompt versions, datasets, experiments and evaluations.

Engineering choices

  • Hybrid deterministic and LLM architecture: code determines stable business signals, segment and next action; the LLM supplies only fit score and qualitative reasoning.
  • Node.js and JavaScript ES Modules keep the runtime light.
  • Controlled OpenAI layer: gpt-4o-mini runs with temperature: 0.
  • Structured output: a strict JSON Schema restricts the model to fit_score and reason.
  • External prompt management: the production prompt is versioned in Langfuse rather than hard-coded.
  • OpenTelemetry and Langfuse tracing make model calls observable.
  • Separate benchmark dataset: test companies remain separate from application logic.

Outcome

In the V3 benchmark the workflow achieved 15 correct classifications out of 15. The key result is the separation of deterministic business rules from probabilistic reasoning.