Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "langfuse",
"description": "Skills for working with Langfuse, the open-source LLM engineering platform for tracing, prompt management, and evaluation.",
"version": "1.5.0",
"version": "1.5.2",
"author": {
"name": "Langfuse",
"email": "support@langfuse.com"
Expand Down
2 changes: 1 addition & 1 deletion .cursor-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "langfuse",
"displayName": "Langfuse",
"version": "1.5.0",
"version": "1.5.2",
"description": "Skills for working with Langfuse — the open-source LLM engineering platform for tracing, prompt management, and evaluation.",
"author": {
"name": "Langfuse",
Expand Down
14 changes: 8 additions & 6 deletions skills/langfuse/references/judge-calibration.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,10 @@ Before trusting the judge on production traffic:
3. **Metric recomputation check**: recompute aggregate stats from row-level
flags and compare.
4. **TPR/TNR review**: inspect both directions for class-direction bias.
5. **Threshold**: target `TPR > 0.90` and `TNR > 0.90` before high-stakes
automation.
5. **Acceptance criteria**: before the held-out test, agree on thresholds for
the relevant metrics based on the costs of false positives and false
negatives and whether the judge informs monitoring or automation. Do not
infer "ship" from a universal cutoff.

## 7) Report format

Expand Down Expand Up @@ -223,10 +225,10 @@ scores to the experiment traces and run-level scores to the dataset run.
Use manual REST score creation only as a fallback when not using the SDK
experiment runner, or for local smoke tests. See
[Scores via SDK](https://langfuse.com/docs/evaluation/evaluation-methods/scores-via-sdk)
and the [Scores API reference](https://langfuse.com/docs/api) (`POST /api/public/scores`)
for the current payload shape. Do not use the current `langfuse-cli` score-create
wrapper unless `--help` shows a usable `value` argument; `langfuse-cli@0.0.10`
exposes `legacy-score-v1s create` but cannot pass the required score `value`.
and the [Scores API reference](https://langfuse.com/docs/api) for the current
payload shape. Before using the CLI for score creation, inspect its current
schema and action help instead of assuming resource names, arguments, or
capabilities from a known package version.

Score names to emit:

Expand Down
34 changes: 4 additions & 30 deletions skills/langfuse/references/user-feedback.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,37 +45,11 @@ Rules:

### 3. Implement Score Creation

**For implicit feedback (server-side):** Use `langfuse.create_score()` / `langfuse.score.create()` wherever the event is already handled in application code. Fetch SDK docs for current API: https://langfuse.com/docs/evaluation/evaluation-methods/scores-via-sdk
Fetch and follow the current [user feedback guide](https://langfuse.com/docs/observability/features/user-feedback) and [score ingestion docs](https://langfuse.com/docs/evaluation/evaluation-methods/scores-via-sdk) before editing code. They contain the current browser and server SDK APIs plus framework-specific patterns for returning trace IDs to the frontend.

**For explicit feedback (frontend):** Use `LangfuseWeb` in the browser. It uses the public key only — no secret key exposed.
**For implicit feedback (server-side):** Create the score where the behavior is already handled in application code.

```typescript
import { LangfuseWeb } from "langfuse";

const langfuse = new LangfuseWeb({
publicKey: process.env.NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY!,
baseUrl: process.env.NEXT_PUBLIC_LANGFUSE_HOST,
});

langfuse.score({
traceId,
name: "user-thumbs",
value: 1, // 1 = positive, 0 = negative
dataType: "BOOLEAN",
comment: optionalUserComment,
});
```

The trace ID must be available in the frontend for this to work. For Vercel AI SDK, the non-obvious pattern is using `generateMessageId`:

```typescript
import { getActiveTraceId } from "@langfuse/tracing";

// Inside route handler wrapped with observe()
return result.toUIMessageStreamResponse({
generateMessageId: () => getActiveTraceId() || crypto.randomUUID(),
});
```
**For explicit feedback (frontend):** Make the relevant trace ID available to the frontend and use the current Langfuse browser SDK with a public key only. Never expose a Langfuse secret key in browser code.

### 4. Verify

Expand All @@ -87,6 +61,6 @@ Point users to what they can do with feedback data: filter traces by low scores,

| Mistake | Problem | Fix |
|---------|---------|-----|
| Secret key in frontend code | Security risk | Use `LangfuseWeb` with public key only |
| Secret key in frontend code | Security risk | Use the current browser SDK with a public key only |
| Missing `dataType` on boolean scores | Value `1` inferred as `NUMERIC` | Always pass `dataType: "BOOLEAN"` explicitly |
| Inconsistent score names across the app | Can't aggregate or filter reliably | Pick one name per feedback type, use it everywhere |