Langfuse、ドキュメントチャットボットの評価設定を公開
本文の状態
日本語全文を表示中
詳細モードで約12分の本文を読めます。
同じ出来事の情報源
この情報源を基点に整理
Langfuse Engineering
Langfuse Engineering は、ドキュメントチャットボットの評価設定を公開し、ゼロから設計するのではなく既存のベストプラクティスを流用して継続的な改善を行うべきだと提案している。
AI深層分析を開く2026年8月4日 14:21
AI深層分析
キーポイント
カスタム評価の再定義
「カスタム」とはゼロからの開発を意味せず、チャットボットのような一般的なユースケースでは既存の解決策を流用すべきであると主張する。
AIエンジニアリングループの実践
プロダクションの動作追跡、モニタリング、レビュー済みサンプルによるデータセット化、実験実行という一連のサイクルでシステムを改善するアプローチを示す。
トレーシングとコンテキスト設計
単なる出力ではなく、各ステップでの入力・出力やツール使用を追跡し、ユーザーIDやセッションIDを通じて文脈を保持するトレーシングの重要性を説く。
レビュー対象の特定基準
ユーザーが反論・不満を示す、質問が範囲外である、またはシステムへの批判や怒りが見られる場合、そのチャット履歴を重点的に見直す。
LLM-as-a-judgeによる自動検出
Langfuseの管理型評価ライブラリを用いて、反論や範囲外質問などを自動的に検出し、手動レビューの負担を減らす。
重要な引用
"custom" doesn't mean "from scratch."
Tracing is the foundation for everything else: no traces means no monitoring, no clear issue investigation, and no foundation for good datasets.
Ready to copy.
Those are two very different fixes.
編集コメントを表示
編集コメント
「カスタム」という言葉が誤解を招きやすい状況を、具体的な実装例を通じて明確にしている点が評価できる。開発現場では「独自性」の追求が優先されがちだが、この記事は成熟したユースケースにおける効率化と標準化の重要性を説いている。
Source Article
元記事を日本語で読む
本文に関係しない購読案内、埋め込み通知、サイト内プロモーションは除いています。
2026 年 7 月 22 日
評価(eval)は、アプリごとにカスタマイズする必要があります。少なくとも一部はそうすべきです。しかし、多くの部分はコピーして使うべきであり、実際にそうしています。ここでは、当社のドキュメントチャットボットの評価設定をそのまま公開します。

Annabell Schäfer
「カスタム評価を作れ」と言う人は多いでしょう。確かにその通りですが、「カスタム」=「ゼロから作る」という意味ではありません。チャットボットのように一般的で実績のあるユースケースでは、多くのチームがすでに解決済みの課題に直面しています。当社のドキュメントチャットボットの全設定をここに紹介します。そのままコピーして使えます。
サンプルのチャットボットは、Langfuse のドキュメントに基づいてユーザーの質問に回答するよう設計されたものです。Langfuse Docs MCP にアクセスでき、Inkeep による検索ツールも併用しています。これらを活用して、包括的な回答を提供します。
設定を継続的に改善するため、私たちは AI エンジニアリングのループ を遵循しました。プロダクション動作のトレース、適切なシグナルのモニタリング、レビュー済みの事例をデータセット化、実験の実行、そして得られた知見をチャットボットへフィードバックする一連のプロセスです。
まずは、チャットボットの最終的な発言だけでなく、実際に何をしているかを確認する必要があります。各ステップでの入力と出力、すべての検索呼び出し、ツール使用状況を把握することが重要です。
トレーシングは他のすべての活動の基盤です。トレーシングがなければモニタリングもできず、明確な問題調査も困難になり、良質なデータセットを構築する土台も失われます。
チャットボットのトレーシングでは、後で必要になる周辺コンテキストも含めるようにしてください。userId を渡すことで、同じユーザーが時間とともに同じトピックで戻ってくるかどうかを確認できます。また sessionId を使用することで、関連するやり取りを 1 つの セッション にグループ化できます。デフォルトとして推奨されるのは、「ユーザーメッセージごとに 1 つのトレーシング」「会話ごとに 1 つのセッション」という構成です。これにより個々のトレーシングは簡単に検査可能になりつつ、Users view で会話全体を再生したり、リターンユーザー間での振る舞いを比較したりすることが可能になります。
確認すべきポイントは以下の通りです。
- ユーザーの質問
- どのドキュメントが取得されたかを示す検索ステップ
- ツール呼び出し
- 最終回答を含む生成ステップ
もし回答に問題がある場合、トレーシングからその原因が「検索自体の不良」なのか、「良好な検索結果の上に悪質な生成が行われたのか」を特定できます。これらは全く異なる修正が必要なケースです。
本番環境でのトレーシングが整った後は、以下の 2 点をチェックします。
- どのチャットボットのやり取りがレビューに値するほど興味深いものか?
- 品質と利用状況は時間とともにどう推移しているか?
何が「気になる」会話なのか
すべての会話を人手でレビューするのではなく、ユーザーの行動から「詳しく見るべきだ」というシグナルを検知して追跡しています。具体的には、以下のケースがチャットボットの会話を見直す価値があることを示す確実な指標となります。
- ユーザーが回答に対して反論したり、不同意を示したりする
- 質問がボットの支援範囲を超えている
- ユーザーが暴言を吐いたり、システム全体に不満を抱いている
- ユーザーのイライラが明白である
最初の3つのケースは、Langfuse で LLM-as-a-judge evaluator として動作し、メッセージ履歴全体を含む観測データ(observations)を対象に評価を行います。Langfuse の管理された評価ライブラリから始めるか、高シグナルなプロダクションモニタリング に関する関連記事からプロンプトをコピーして利用することも可能です。一方、ユーザーのイライラは、コードベースの大文字検出器 を用いて追跡されます。これも Langfuse で動作し、ユーザー入力が入力の最初に来る観測データに限定してスコープを絞ります。
これにより、「すべてレビューする」方針から「適切なものだけをレビューする」方針へと転換できます。
品質の定義はどうするか
イベント検出器に加え、軽量な常時稼働型の品質チェックも導入しています。
- 私たちの出力は、ユーザーが求めていることに適切に答えているか?
- ユーザーの意図のカテゴリーは、時間経過とともにどう変化しているか?
これは完全な品質評価システムではありませんが、品質や利用パターン、時間経過に伴うドリフトの兆候を捉える指標として機能し、アクションを起こすべきタイミングを教えてくれます。
関連性とユーザーの意図は、それぞれ数値評価とカテゴリ評価を行う LLM によるジャッジとして設定されています。ユーザーの意図のカテゴリは、アプリケーション固有のものとなります。
当社のユースケースでは、conceptual-question、implementation-question、self-hosting、pricing-and-comparison、ui-feedback を使用します。
irrelevant-to-langfuse.
次に、平均スコアやユーザーの意図分類、総スコア数、コスト推移などを表示する プロダクション監視ダッシュボード を構築しました。さらに、コストの上昇や最初のトークンまでの時間延長、チャットボットへのユーザーの不満増加など、特定の閾値に達した際に Slack で通知される モニター機能 も導入しています。
評価対象となるトレースは、2 つの 注釈キュー に集約されます。1 つ目はフラグ付きの会話データで、2 つ目は特定のフラグの有無に関わらず定期的にレビューされる全サンプルです。
コーディングエージェントがこれらのキューをレビューすることも可能ですが、特に初期設定においては、価値の約 80% は人間が実際にデータを閲覧することから生まれます。詳しくは当社の記事「AI が AI エンジニアリングのループを食いつくす」をご覧ください。
軽量なモニタリングですでに重要な箇所が特定されているため、その確認作業は想像以上に効率的です。
レビューする会話ごとに、2 つの情報を付記してください。1 つ目は合格・不合格の判定、もう 1 つ目は実際に何が間違っていたかを記した自由形式のメモです。まだ固定されたカテゴリリストを使うのではなく、オープンコーディングを活用しましょう。最初のパスが完了したら、失敗モードをグループ化し、各失敗した会話に該当するカテゴリを付与します。その後、各カテゴリに対して「無視する」「さらに監視する」「修正する」のいずれの対応を取るかを決定してください。エラー分析ガイドでは、このプロセスについてより詳細に解説しています。
この注釈は単なるスコアよりも有用なシグナルを含んでいます。これは、この例がデータセット項目となった際に期待される出力を設計する際の助けとなります。
十分な数の実際の会話を注釈付けし、「本来あるべき正しい出力」を記録した後、正式なデータセットを作成します。データセット項目には入力が必要であり、テスト内容に応じて期待される出力を含めることも含めないことも可能です。
有用性を保つための 2 つのチェックポイントがあります:
入力データは、実際にユーザーがどのような質問をするかを反映させるべきです。ランダムサンプリングと注釈付きの例を組み合わせることが重要です。
評価対象を明確に定めた上で、データセットの構築を開始してください。
チャットボットにおいては、以下の 3 つの次元が出発点として広く採用されており、異なるボット間でもほぼ共通しています。
- 期待される回答との整合性:LLM を用いた判定者(judge)によって検証します。
- キーワードの重複度:製品名や特定の用語が実際に含まれているかを確認するのに特に有効です。
- 振る舞いの適合性:質問に対してボットが適切な対応を取ったかどうか。具体的には、直接的に回答する、フォローアップを促す、範囲外として先送りする、あるいは正しいツールを呼び出すなどの行動が取られているかを判断します。
「期待される回答との整合性」と「振る舞いの適合性」は、アプリ内で LLM-as-a-judge 評価 として実装されています。これらは本データセットに基づく実験ランに限定して適用されます。
一方、「キーワードの重複度」の評価は、実験ランナー(スクリプト)の一部として実行され、決定論的な一致判定を行うため、コードベースの評価となっています。
私たちはこのデータセットと評価指標を活用して 実験 を実施し、システムの品質を把握しています。新モデルのリリース後やドキュメントの変更があった際、またデータセットに新たなエッジケースを追加した際には、頻繁に実験を実行しています。
私たちは、データセット項目のメタデータ フィールドを活用して、データの由来や用途、入力言語に基づいて項目を分類しています。これにより、スコアデータをフィルタリングしたり細かく切り分けたりすることが可能になり、時間経過とともに各次元でデータセットのバランスを保ちやすくなります。
このデータセットは回帰テストスイートとしても機能します。CI の一部として実行されるため、プロンプトやモデルの変更がリリース前に実際の失敗事例に対してチェックされ、リリース後に発見するのではなく事前に検知できます。
ドメイン固有の失敗に対応したデータセット
すべてのシステムには、その独自のドメインやアーキテクチャに起因する故障モードが存在します。
私たちの場合、それはトレーニングデータではなく実際のドキュメントに基づいた回答を維持することです。LLM は古いバージョンの SDK や統合ページについて学習しており、エコシステム内では複数のバージョンが混在しています。そのため、流暢で自信ありげな間違った回答は簡単に生成されてしまい、見逃されやすいという課題があります。
この課題に対応するため、専用のデータセットを構築しました。これは 参照なし 形式です。入力のみを提供し、期待される出力は指定しません。なぜなら、SDK や統合のベストプラクティスが更新されるたびに正解が変化するからです。代わりに評価するのは、回答がモデルがすでに「知っている」情報ではなく、取得されたドキュメントに基づいているかどうかという点です。
あなたの評価設定は、オリジナルとは異なるものになるはずです。特定のツールを必要なタイミングで呼び出す必要がある場合や、人間に引き継ぐべきかどうかの判断基準が組み込まれているかもしれません。いずれの場合も基本メカニズムは同じです。まずは自らのエラー分析を通じて失敗モードを見つけ出し、その課題に特化したデータセットを構築してください。汎用的な評価ツールに任せて「後で気づく」ことを期待してはいけません。なぜなら、そのようなツールでは検出できないからです。
生産環境の監視を継続し、エラー分析を続け、興味深いトレースをデータセットに取り込み続けること。これこそが、単発の設定から、時間とともに実際に改善していくシステムへと進化させる鍵となります。
設定が成熟するほど、コーディングエージェントに任せる部分(キューの選別、データセット項目の下書き、レビュー対象候補のフラグ付けなど)は増えます。しかし初期段階では、自分自身で確認することが最も重要です。そこには最大の価値があるからです。
上記のトレース、スコア、ダッシュボード、データセット、実験設定を含む完全な設定は、公開 Langfuse プロジェクト で稼働中です。
このページは役に立ちましたか?
原文を表示
July 22, 2026
Evals need to be custom to your app. At least some of them. A good chunk you can, and should be copying. Here is our setup for our docs chatbot.

Annabell Schäfer
"Build custom evals," they say. Yes, but "custom" doesn't mean "from scratch." For a huge chunk of eval design, especially for something as well-trodden as a chatbot, teams are solving a problem thousands of teams have already solved. Here's our setup for our docs chatbot, in full. Ready to copy.
Our sample chatbot is a Langfuse documentation chatbot built to answer user questions about Langfuse while staying grounded in the docs. It has access to the Langfuse Docs MCP and an Inkeep-powered retrieval tool, and uses both to provide a comprehensive answer to the user.
To continuously improve the setup, we followed the AI engineering loop: trace production behavior, monitor the right signals, turn reviewed examples into datasets, run experiments, and feed what we learn back into the chatbot.
Before anything else, you need to see what the chatbot is actually doing, not just what it says at the end. Every retrieval call, every tool use, the full input and output at each step. Tracing is the foundation for everything else: no traces means no monitoring, no clear issue investigation, and no foundation for good datasets.
For chatbots, make sure each trace also carries the surrounding context you will need later. We pass a userId so we can see whether the same person comes back with the same topic over time, and a sessionId so related turns are grouped into one session. A good default is one trace per user message and one session per conversation. That keeps individual traces easy to inspect while still letting us replay the full thread and compare behavior across returning users in the Users view.
What we look for is the user's question, the retrieval step showing which docs got pulled in, the tool calls, and the generation step with the final answer. If something is wrong with the answer, the trace tells us whether the problem was bad retrieval or bad generation on top of good retrieval. Those are two very different fixes.
Once production tracing is in place, we check for two things:
- Which chatbot interactions are interesting enough to review?
- How do quality and usage behave over time?
What counts as interesting?
Instead of reviewing every conversation by hand, we're monitoring traces for user signals that tell us to take a closer look. A few things reliably mark a chatbot conversation as worth a closer look:
- The user pushes back or disagrees with the answer.
- The question is out of scope for what the bot can actually help with.
- The user is cursing or broadly complaining about the system.
- The user is clearly frustrated.
The first three run as LLM-as-a-judge evaluators in Langfuse and target observations that contain the full message history. You can start from the managed evaluator library in Langfuse or copy the prompts from our related post on high-signal production monitoring. User frustration is tracked with a code-based all-caps detector, also running in Langfuse, scoped to observations where the user input comes first.
This is what turns "review everything" into "review the right things."
How do we define quality?
On top of the event detectors, a lightweight always-on quality check helps:
- Is our output relevant to what the user is asking?
- What are the rough intent categories of our users over time?
This is not a fully fledged quality evaluation system, but it gives us a signal for quality, usage patterns, and drift over time, which tells us when to take action.
Both relevance and user intent are set up as LLM-as-a-judge evaluators: one numeric, one categorical. The user intent categories are application-specific. For our use case, we use conceptual-question, implementation-question, self-hosting, pricing-and-comparison, ui-feedback, and irrelevant-to-langfuse.
We then set up a production monitoring dashboard that shows average scores, user intent classifications, total score counts, and cost over time. On top of that, we have monitors that notify us in Slack when certain thresholds are reached, such as increased cost, increased time to first token, or a high number of users disagreeing with our chatbot.
Our traces end up in two annotation queues worth working through: one with flagged conversations, and one with general samples of everything, reviewed on a regular cadence regardless of whether anything was flagged.
Your coding agent could review those queues for you. But especially in the early setup, most of the value, we would put it somewhere around 80%, comes from a human actually looking at the data (learn more why in our article AI is eating the AI engineering loop). Because lightweight monitoring already points us at the relevant stuff, that look is a lot more efficient than it sounds.
For each conversation you review, attach two things: a pass/fail call and a short freeform note on what actually went wrong. Use open coding, not a fixed category list yet. After a first pass, group failure modes and label all failed conversations with their respective category. For each category, decide what to do about it: ignore it, monitor it further, or fix it. The error analysis guide walks through this process in more detail.
This annotation carries more useful signal than the score. It helps us craft an expected output when this example becomes a dataset item.
Once we annotated enough real conversations and noted what we think the right output should have been, we built a proper dataset. A dataset item needs an input and can have an expected output, or none, depending on what you are testing.
Two checks help keep it useful:
- The input distribution should reflect what people actually ask. Mix random sampling with your annotated examples.
- Decide what you are evaluating before you build the dataset.
For chatbots, three dimensions have held up well as a starting point and are close to universal across different bots:
- Correctness against an expected answer, checked with an LLM judge.
- Keyword overlap, especially useful for making sure product names and specific terms actually show up.
- Behavior match, whether the bot did the right thing given the question: answer directly, ask a follow-up, defer because it is out of scope, or call the right tool.
Correctness and behavior match are set up as LLM-as-a-judge evaluators in the app. They are scoped to experiment runs on this specific dataset. Keyword overlap runs as part of the experiment runner (script) and is a deterministic match, so a code-based eval.
We use this dataset with its evaluators to run experiments and understand the quality of our system. We frequently run experiments on newly released models, after changes to the docs, and whenever we add new edge cases to the dataset.
We use the dataset item metadata field to categorize items by where they come from, what the item is for, and which input language we are using. This lets us filter, slice, and dice score data, and makes it easier to keep the dataset balanced over time across those dimensions.
That dataset doubles as our regression suite. We run it as part of CI, so a prompt or model change gets checked against real failure cases before it ships, not after.
Datasets for domain-specific failures
Every system has failure modes that come from its own domain and architecture.
For us, it is staying grounded in the actual docs instead of training data. LLMs know old versions of SDKs, are trained on old integration pages, and multiple versions exist across the ecosystem, so a fluent, confident, wrong answer is an easy failure to produce and an easy one to miss.
We built a separate dataset just for this. It is reference-free: inputs only, no expected output, because the correct answer changes every time the SDK or integration best practice does. What we evaluate instead is whether the answer is actually grounded in the retrieved documentation rather than in what the model already "knows."
Your version will be different. Maybe it is making sure a specific tool gets called when it should. Maybe it is knowing when to hand off to a human. The mechanism is the same either way: find the failure mode through your own error analysis, then build a dataset around that specific thing. Do not wait for a generic evaluator to catch it, because it will not.
Keep monitoring production, keep doing error analysis, keep pulling interesting traces into your datasets. That is what turns this from a one-time setup into a system that actually gets better over time.
The more mature the setup gets, the more of this you can hand off to a coding agent: triaging queues, drafting dataset items, flagging candidates for review. Early on, though, look yourself. That is where most of the value is.
The full setup is live in our public Langfuse project, including the traces, scores, dashboards, datasets, and experiment setup described above.
Was this page helpful?
AI算出
技術分析ainew評価高い
Langfuse が独自に構築したドキュメントチャットボットの評価設定(トレーシング構成、モニタリング指標、データセット化プロセス)を公開しており、AI エンジニアリングの具体的な実装知見を含んでいるため novelty と ai_relevance は高く評価される。ただし、対象は Langfuse 製品の利用方法であり、日本固有の情報や企業事例が含まれていないため japan_relevance は低めとなる。
6つの評価軸を見る
- AI関連度
- 75
- 情報源の信頼性
- 100
- 新規性
- 75
- 調べる価値
- 75
- 重複の少なさ
- 100
- 日本での有用性
- 25
今日のまとめ
AIデイリーブリーフで今日の重要ニュースをまとめ読み