@holonograph/client 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -1
- package/dist/index.d.ts +929 -814
- package/dist/index.js +25 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -66,6 +66,68 @@ That is the whole loop: **`messages.create()` → score → `reportOutcome()`**.
|
|
|
66
66
|
lens assembles and stores the evaluation event; over time those events become
|
|
67
67
|
the longitudinal record you query and visualize.
|
|
68
68
|
|
|
69
|
+
## Verdict reliability — let the lens check your judge
|
|
70
|
+
|
|
71
|
+
A score is only as trustworthy as the judge that produced it, and an LLM judge can
|
|
72
|
+
misread its own input: accuse the model of inventing a value that was right there in
|
|
73
|
+
a tool result, or of skipping a tool it actually called. The lens catches that
|
|
74
|
+
**deterministically** — but only if your judge hands it a structured claim to check,
|
|
75
|
+
instead of burying the accusation in prose. Attach a `claim` to any judged dimension:
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
await handle.reportOutcome({
|
|
79
|
+
dimensions: [
|
|
80
|
+
{
|
|
81
|
+
dimensionId: 'grounded',
|
|
82
|
+
passed: false,
|
|
83
|
+
expected: 'only facts present in the tool results',
|
|
84
|
+
actual: 'claimed a refund was issued and cited a total of $84.20',
|
|
85
|
+
// What the judge ASSERTED, as fields the lens can verify — not prose.
|
|
86
|
+
claim: {
|
|
87
|
+
status: 'emitted',
|
|
88
|
+
assertions: [
|
|
89
|
+
// "the model cited a value that is not in what it read"
|
|
90
|
+
{ kind: 'datum-absent', datum: '$84.20', reference: 'the lookup total was $48.20' },
|
|
91
|
+
// "the model claimed an action without calling the tool that performs it"
|
|
92
|
+
{ kind: 'tool-not-invoked', tool: 'issue_refund' },
|
|
93
|
+
],
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
});
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
The lens checks each assertion **against the captured call** — is the accused value
|
|
101
|
+
actually absent from everything the model read? was that tool really never invoked,
|
|
102
|
+
anywhere across the whole conversation? — and reports, per assertion, whether the
|
|
103
|
+
record **corroborates** or **contradicts** the judge. A contradiction is the loud
|
|
104
|
+
case: the judge's verdict rested on something it misread, so that score can't be
|
|
105
|
+
trusted. Two assertion kinds ship today:
|
|
106
|
+
|
|
107
|
+
- **`datum-absent`** — a value the judge says was fabricated. It splits the accused
|
|
108
|
+
`datum` from the optional `reference` the judge measured it against, so the lens
|
|
109
|
+
verifies the _accusation_, never the yardstick.
|
|
110
|
+
- **`tool-not-invoked`** — a tool the judge says was never called. The check reads the
|
|
111
|
+
whole captured conversation, so a call made in an earlier turn still counts.
|
|
112
|
+
|
|
113
|
+
A dimension with no `claim` is simply not claim-instrumented — the lens stays
|
|
114
|
+
honest-null about it rather than guessing, so you opt in one dimension at a time. If
|
|
115
|
+
your judge is _meant_ to emit a claim but its output is malformed, report
|
|
116
|
+
`{ status: 'malformed', reflectionAttempted: <boolean> }` — the lens raises that as a
|
|
117
|
+
judge-malfunction signal rather than silently trusting a broken instrument. The
|
|
118
|
+
`JudgeClaimReport` and `JudgeAssertion` types are exported so you can build and
|
|
119
|
+
validate the claim before you send it.
|
|
120
|
+
|
|
121
|
+
Read the whole layer back over a window from your lens — every claim-instrumented
|
|
122
|
+
dimension with its per-assertion disposition:
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
GET /holonograph/verdict-reliability
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
(There is no dedicated client method for this read yet; use `client.callDirectly` or a
|
|
129
|
+
plain `fetch` against your lens `endpoint`.)
|
|
130
|
+
|
|
69
131
|
## What it speaks
|
|
70
132
|
|
|
71
133
|
The client talks to a lens over plain HTTP under the `/holonograph/*` path
|
|
@@ -81,7 +143,10 @@ status, an error code, and any details the lens returned.
|
|
|
81
143
|
- **`HolonographClient`** — construct with an `endpoint` (plus optional `token`
|
|
82
144
|
/ `runMode`) and the `lensVersion` + `substrate` to pin into every event.
|
|
83
145
|
- `client.messages.create(request)` — send a message; returns a handle.
|
|
84
|
-
- `handle.reportOutcome(outcome)` — commit the scored outcome.
|
|
146
|
+
- `handle.reportOutcome(outcome)` — commit the scored outcome. Each dimension may
|
|
147
|
+
carry a `claim` (a `JudgeClaimReport`) for the verdict-reliability layer to check
|
|
148
|
+
(see above). The `JudgeClaimReport` / `JudgeAssertion` / `JudgeAssertionKind` types
|
|
149
|
+
are exported.
|
|
85
150
|
- `handle.gradeObserver(...)` — attach grades to a cross-vendor observer call
|
|
86
151
|
before reporting, when the lens returned observer records.
|
|
87
152
|
- `client.contract.register(contract)` — publish a surface contract to the lens.
|