06 Experiments
Workshop source
Workshop material is maintained in the public langfuse/langfuse-workshop repository. Use the repository for the runnable app, checkpoint branches, and local setup.
Learner guide: 06 Experiments
Instructor notes
- The key idea is reuse: the experiment runner calls the same
runSupportConversation(...)as the web app. - Contrast deterministic scoring (
keyword_overlap) with LLM-as-a-judge scoring (correctness) โ both as callbacks onrunExperiment. - Point at the semantic-equivalence judge prompt in
scripts/run-dataset.ts: expected output is the source of truth; paraphrases pass; missing material meaning fails. - Call out why this chapter avoids Langfuse Platform evaluators as the primary path: configuring one needs existing experiment data to preview mappings, which blocks a clean first run.
- The correctness judge uses the learner's
OPENAI_API_KEY/OPENAI_MODEL. Session 4's Langfuse default evaluator model is not required here. - Emphasize that both scores should appear in the console summary when
npm run dataset:runfinishes. - Keep concurrency at one for workshops so traces and the final run summary are easy to follow.
- Before running the dataset, confirm both the OpenAI and Langfuse credentials point to active projects. The runner can finish with exit code 0 after skipping every item, so always check that the console prints experiment results rather than only SDK errors.
- Optional bonus only if you have time: show that Platform evaluators can still target experiment observations after the first run exists.
Demo rhythm
- Skim the numbered sections in
scripts/run-dataset.ts. - Point out both callback evaluators in the
evaluatorsarray. - Run
npm run dataset:run. - Open the run table, per-item traces, and chart view โ both scores should already be present.
- (Optional) Mention Platform evaluators / Check Correctness as a later add-on once experiment data exists.
Watch for
- Learners trying to set up Check Correctness in the UI before the first run. Redirect them to the script callbacks; platform setup is bonus-only.
- Do not use
expectedKeywordsas the correctness reference. That field belongs tokeyword_overlap; correctness usesidealAnswer. 401 The project you are requesting has been archivedfollowed byNo experiment results to displaymeans the OpenAI key belongs to an archived project. ReplaceOPENAI_API_KEYlocally with a key from an active project, then rerun.- Missing
correctnessin the console usually means the judge call failed (bad key, model, or JSON parse). Check the terminal error rather than refreshing Langfuse for a pending platform score.
Was this page helpful?