Skip to content

docs(examples): make Langfuse wrapper degrade cleanly on a real server#342

Merged
cyfyifanchen merged 2 commits into
mainfrom
fix/langfuse-example-real-server-fidelity
Jul 14, 2026
Merged

docs(examples): make Langfuse wrapper degrade cleanly on a real server#342
cyfyifanchen merged 2 commits into
mainfrom
fix/langfuse-example-real-server-fidelity

Conversation

@dani1005

@dani1005 dani1005 commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to #339. Makes the Langfuse example wrapper honest against a real EverOS server.

Problem

The wrapper built its child spans (extraction, embedding, hybrid recall, rerank, index sync, consolidation) from a _detail field that only the built-in mock returns. Against a real server (EVEROS_BASE_URL) that field is absent, so those spans rendered with placeholder data — hardcoded model names, token=0, fixed sleep durations — and recall scores fell to 0.

Fix

  • Per-stage child spans are emitted only when _detail is present (the mock, or future native in-core instrumentation). Against a live server, only the top-level span per operation is emitted — real latency + output, no fabricated data.
  • Recall quality (recall_top_score / recall_hit) is now derived from the real search response, which already carries a per-hit score — so it works against a live server today, not just the mock.

Verification

  • Mock path unchanged: full trace tree, real scores (0.86 / 0.81 / 0.31-miss / 0.74).
  • Real-ish path (_detail stripped): only the 4 top-level spans emit, with a real recall score (0.81 / hit=true).

Additive, examples-only; no EverOS core changes. Mirrored to the GitHub PR to keep the mirror in sync.

dani1005 and others added 2 commits July 14, 2026 15:39
The wrapper synthesized child spans (extraction, embedding, hybrid
recall, rerank, index sync, consolidation) from a mock-only `_detail`
field. Against a real EverOS server that field is absent, so those spans
rendered with placeholder data — hardcoded model names, token=0, fixed
sleep durations — and recall scores fell to 0.

Now the per-stage child spans are emitted only when `_detail` is present
(the mock, or future native in-core instrumentation). Against a live
server only the top-level span per operation is emitted, with real
latency and output — no fabricated data. Recall quality
(recall_top_score / recall_hit) is derived from the real search
response, which already carries a per-hit score, so it works against a
live server today, not just the mock.

Verified: mock path unchanged (full trace tree, real scores); real-ish
path (no `_detail`) emits only top-level spans plus a real recall score.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
When a search returns nothing scored, record recall_hit=0 (span attribute +
Langfuse score) instead of omitting it, so genuine empty recalls still show
up in recall hit-rate. No top_score is emitted (there is no hit to score).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@cyfyifanchen cyfyifanchen merged commit d3a9f9e into main Jul 14, 2026
8 checks passed
@cyfyifanchen cyfyifanchen deleted the fix/langfuse-example-real-server-fidelity branch July 14, 2026 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants