@llm4ts/core 2.4.2 → 2.6.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/dist/Connector.d.ts +4 -0
- package/dist/Connector.d.ts.map +1 -1
- package/dist/Connector.js +8 -3
- package/dist/Connector.js.map +1 -1
- package/dist/ConnectorConfig.d.ts.map +1 -1
- package/dist/ConnectorConfig.js +2 -0
- package/dist/ConnectorConfig.js.map +1 -1
- package/dist/ContextManagement.d.ts.map +1 -1
- package/dist/ContextManagement.js +1 -0
- package/dist/ContextManagement.js.map +1 -1
- package/dist/LabelScoring.d.ts +52 -0
- package/dist/LabelScoring.d.ts.map +1 -0
- package/dist/LabelScoring.js +139 -0
- package/dist/LabelScoring.js.map +1 -0
- package/dist/LlmService.d.ts +30 -2
- package/dist/LlmService.d.ts.map +1 -1
- package/dist/LlmService.js.map +1 -1
- package/dist/Models.d.ts +34 -2
- package/dist/Models.d.ts.map +1 -1
- package/dist/Models.js +37 -1
- package/dist/Models.js.map +1 -1
- package/dist/eval/Judge.d.ts +15 -0
- package/dist/eval/Judge.d.ts.map +1 -1
- package/dist/eval/Judge.js +50 -0
- package/dist/eval/Judge.js.map +1 -1
- package/dist/judgment/FakeJudgment.d.ts +22 -0
- package/dist/judgment/FakeJudgment.d.ts.map +1 -0
- package/dist/judgment/FakeJudgment.js +42 -0
- package/dist/judgment/FakeJudgment.js.map +1 -0
- package/dist/judgment/Judgment.d.ts +57 -0
- package/dist/judgment/Judgment.d.ts.map +1 -0
- package/dist/judgment/Judgment.js +57 -0
- package/dist/judgment/Judgment.js.map +1 -0
- package/dist/judgment/LlmJudgment.d.ts +73 -0
- package/dist/judgment/LlmJudgment.d.ts.map +1 -0
- package/dist/judgment/LlmJudgment.js +239 -0
- package/dist/judgment/LlmJudgment.js.map +1 -0
- package/dist/judgment/Schemas.d.ts +163 -0
- package/dist/judgment/Schemas.d.ts.map +1 -0
- package/dist/judgment/Schemas.js +197 -0
- package/dist/judgment/Schemas.js.map +1 -0
- package/dist/judgment/TypeSafeJudgment.d.ts +46 -0
- package/dist/judgment/TypeSafeJudgment.d.ts.map +1 -0
- package/dist/judgment/TypeSafeJudgment.js +185 -0
- package/dist/judgment/TypeSafeJudgment.js.map +1 -0
- package/dist/observability/MeteredLlmService.d.ts.map +1 -1
- package/dist/observability/MeteredLlmService.js +1 -0
- package/dist/observability/MeteredLlmService.js.map +1 -1
- package/dist/providers/ConnectorFactories.d.ts.map +1 -1
- package/dist/providers/ConnectorFactories.js +2 -0
- package/dist/providers/ConnectorFactories.js.map +1 -1
- package/dist/providers/LmStudioProvider.d.ts.map +1 -1
- package/dist/providers/LmStudioProvider.js +45 -34
- package/dist/providers/LmStudioProvider.js.map +1 -1
- package/dist/providers/MlxLmProvider.d.ts +29 -0
- package/dist/providers/MlxLmProvider.d.ts.map +1 -0
- package/dist/providers/MlxLmProvider.js +249 -0
- package/dist/providers/MlxLmProvider.js.map +1 -0
- package/dist/providers/MockProvider.d.ts.map +1 -1
- package/dist/providers/MockProvider.js +11 -0
- package/dist/providers/MockProvider.js.map +1 -1
- package/dist/providers/OpenAIModels.d.ts +35 -0
- package/dist/providers/OpenAIModels.d.ts.map +1 -1
- package/dist/providers/OpenAIModels.js +36 -3
- package/dist/providers/OpenAIModels.js.map +1 -1
- package/package.json +8 -1
- package/src/Connector.ts +13 -3
- package/src/ConnectorConfig.ts +2 -0
- package/src/ContextManagement.ts +1 -0
- package/src/LabelScoring.ts +211 -0
- package/src/LlmService.ts +37 -1
- package/src/Models.ts +43 -1
- package/src/eval/Judge.ts +74 -0
- package/src/judgment/FakeJudgment.ts +90 -0
- package/src/judgment/Judgment.ts +123 -0
- package/src/judgment/LlmJudgment.ts +399 -0
- package/src/judgment/Schemas.ts +278 -0
- package/src/judgment/TypeSafeJudgment.ts +253 -0
- package/src/observability/MeteredLlmService.ts +7 -0
- package/src/providers/ConnectorFactories.ts +4 -0
- package/src/providers/LmStudioProvider.ts +64 -48
- package/src/providers/MlxLmProvider.ts +357 -0
- package/src/providers/MockProvider.ts +19 -0
- package/src/providers/OpenAIModels.ts +40 -3
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import * as Layer from "effect/Layer";
|
|
3
|
+
import * as Result from "effect/Result";
|
|
4
|
+
import * as Schema from "effect/Schema";
|
|
5
|
+
import { verbalizedScoreLabelSequence, verbalizedScoreLabels } from "../LabelScoring.js";
|
|
6
|
+
import { TokenUsage } from "../Models.js";
|
|
7
|
+
import { Judgment } from "./Judgment.js";
|
|
8
|
+
import { averageProbabilities, choiceAnswer, JudgmentResult, QuestionFailure, renderState, scoreAnswer, truthAnswer, origins } from "./Schemas.js";
|
|
9
|
+
/**
|
|
10
|
+
* `LlmJudgment`: the Judgment service over any `LlmServiceShape`. One label
|
|
11
|
+
* question per atomic question, answered through `scoreLabels`: a single
|
|
12
|
+
* forward pass on connectors with log-probabilities, a short JSON reply on
|
|
13
|
+
* the rest. Questions never see each other's answers in `independent`
|
|
14
|
+
* batching; `shared-prefix` sends the state once with every question and
|
|
15
|
+
* reads each answer as its own label distribution, trading that isolation
|
|
16
|
+
* for one prompt prefix per request.
|
|
17
|
+
*/
|
|
18
|
+
export const Batching = Schema.Literals(["independent", "shared-prefix"]);
|
|
19
|
+
export class LlmJudgmentConfig extends Schema.Class("LlmJudgmentConfig")({
|
|
20
|
+
/** Questions in flight at once. 1 keeps a local server's prompt cache warm. */
|
|
21
|
+
concurrency: Schema.Int.pipe(Schema.withConstructorDefault(Effect.succeed(1))),
|
|
22
|
+
/** 2 also asks with the options reversed and averages, to blunt position bias. */
|
|
23
|
+
permutations: Schema.Literals([1, 2]).pipe(Schema.withConstructorDefault(Effect.succeed(1))),
|
|
24
|
+
/**
|
|
25
|
+
* `independent` (default): one call per question, Jev's answer
|
|
26
|
+
* independence. `shared-prefix`: every question of a request in one call
|
|
27
|
+
* whose state prefix is sent once; a question the batch could not read
|
|
28
|
+
* falls back to its own independent call.
|
|
29
|
+
*/
|
|
30
|
+
batching: Batching.pipe(Schema.withConstructorDefault(Effect.succeed("independent"))),
|
|
31
|
+
/** Connector and model behind the seat, for `identity` and answer origins. */
|
|
32
|
+
connector: Schema.optionalKey(Schema.String),
|
|
33
|
+
model: Schema.optionalKey(Schema.String)
|
|
34
|
+
}) {
|
|
35
|
+
}
|
|
36
|
+
const LABELS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
37
|
+
const describe = (description) => typeof description === "string" ? description : JSON.stringify(description);
|
|
38
|
+
export const questionBody = (question, reverse) => {
|
|
39
|
+
if (question.type === "truth") {
|
|
40
|
+
const criteria = question.criteria === undefined
|
|
41
|
+
? ""
|
|
42
|
+
: `\nYes means: ${describe(question.criteria.true)}\nNo means: ${describe(question.criteria.false)}`;
|
|
43
|
+
return {
|
|
44
|
+
body: `Statement: ${question.instructions}${criteria}\nAnswer with exactly one word: yes or no.`,
|
|
45
|
+
labels: ["yes", "no"],
|
|
46
|
+
keys: { yes: "yes", no: "no" }
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
const entries = question.type === "choice"
|
|
50
|
+
? Object.entries(question.criteria)
|
|
51
|
+
: question.criteria.map((level, index) => [String(index), level]);
|
|
52
|
+
const ordered = reverse ? [...entries].reverse() : entries;
|
|
53
|
+
const labels = ordered.map((_, index) => LABELS[index] ?? `L${index}`);
|
|
54
|
+
const lines = ordered
|
|
55
|
+
.map(([key, description], index) => question.type === "choice"
|
|
56
|
+
? `${labels[index]}. ${key}: ${describe(description)}`
|
|
57
|
+
: `${labels[index]}. ${describe(description)}`)
|
|
58
|
+
.join("\n");
|
|
59
|
+
const ask = question.type === "choice" ? "Question" : "Rate on the levels below";
|
|
60
|
+
return {
|
|
61
|
+
body: `${ask}: ${question.instructions}\nOptions:\n${lines}\nAnswer with exactly one letter.`,
|
|
62
|
+
labels,
|
|
63
|
+
keys: Object.fromEntries(ordered.map(([key], index) => [labels[index] ?? `L${index}`, key]))
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
const stateHeader = (state) => `State:\n${renderState(state)}\n\n`;
|
|
67
|
+
/**
|
|
68
|
+
* The fixed label-scoring template: state first, then the question, then
|
|
69
|
+
* one single-token label per option. Truth uses `yes`/`no`.
|
|
70
|
+
*/
|
|
71
|
+
export const labelPlan = (state, question, reverse) => {
|
|
72
|
+
const part = questionBody(question, reverse);
|
|
73
|
+
return { prompt: `${stateHeader(state)}${part.body}`, labels: part.labels, keys: part.keys };
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* The shared-prefix template: the state once, then every question numbered,
|
|
77
|
+
* and an answer format of one label per line so a backend can read each
|
|
78
|
+
* position as its own distribution.
|
|
79
|
+
*/
|
|
80
|
+
export const sequencePlan = (state, questions, reverse) => {
|
|
81
|
+
const parts = questions.map((question) => questionBody(question, reverse));
|
|
82
|
+
const numbered = parts.map((part, index) => `Question ${index + 1}.\n${part.body}`).join("\n\n");
|
|
83
|
+
return {
|
|
84
|
+
prompt: `${stateHeader(state)}Answer each numbered question below with exactly one label on its own line, ` +
|
|
85
|
+
`formatted as "<number>: <label>", in order, and nothing else.\n\n${numbered}`,
|
|
86
|
+
parts
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
const byKey = (keys, distribution) => Object.fromEntries(Object.entries(distribution.probabilities).map(([label, value]) => [
|
|
90
|
+
keys[label] ?? label,
|
|
91
|
+
value
|
|
92
|
+
]));
|
|
93
|
+
const toAnswer = (question, probabilities, origin, support) => question.type === "choice"
|
|
94
|
+
? choiceAnswer(probabilities, origin, support)
|
|
95
|
+
: question.type === "score"
|
|
96
|
+
? scoreAnswer(question, probabilities, origin, support)
|
|
97
|
+
: truthAnswer(probabilities["yes"] ?? 0, origin, support);
|
|
98
|
+
const sumUsage = (usages) => {
|
|
99
|
+
const present = usages.filter((usage) => usage !== undefined);
|
|
100
|
+
return present.length === 0
|
|
101
|
+
? undefined
|
|
102
|
+
: TokenUsage.make({
|
|
103
|
+
prompt: present.reduce((sum, usage) => sum + usage.prompt, 0),
|
|
104
|
+
completion: present.reduce((sum, usage) => sum + usage.completion, 0),
|
|
105
|
+
total: present.reduce((sum, usage) => sum + usage.total, 0)
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
/** Combine one distribution per permutation into an answer; the weaker method and support win. */
|
|
109
|
+
const combine = (question, reads, fallbackModel) => {
|
|
110
|
+
const method = reads.every(([, distribution]) => distribution.method === "logprobs")
|
|
111
|
+
? "logprobs"
|
|
112
|
+
: reads.some(([, distribution]) => distribution.method === "sampled")
|
|
113
|
+
? "sampled"
|
|
114
|
+
: "verbalized";
|
|
115
|
+
const support = Math.min(...reads.map(([, distribution]) => distribution.support));
|
|
116
|
+
const probabilities = averageProbabilities(reads.map(([keys, distribution]) => byKey(keys, distribution)));
|
|
117
|
+
const model = reads.find(([, distribution]) => distribution.model !== undefined)?.[1].model ?? fallbackModel;
|
|
118
|
+
return {
|
|
119
|
+
answer: toAnswer(question, probabilities, origins.llm(method, model), support),
|
|
120
|
+
usage: sumUsage(reads.map(([, distribution]) => distribution.usage)),
|
|
121
|
+
model
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
export const makeLlmJudgment = (llm, config = LlmJudgmentConfig.make({}), hooks = {}) => {
|
|
125
|
+
const fallback = verbalizedScoreLabels(llm.executeStructuredWithUsage);
|
|
126
|
+
const sequence = llm.scoreLabelSequence ?? verbalizedScoreLabelSequence(llm.executeStructuredWithUsage);
|
|
127
|
+
const permutations = config.permutations === 2 ? [false, true] : [false];
|
|
128
|
+
const permutationsFor = (question) => permutations.filter((reverse) => !reverse || question.type !== "truth");
|
|
129
|
+
const scoreOnce = (plan, key) => llm
|
|
130
|
+
.scoreLabels(plan.prompt, plan.labels)
|
|
131
|
+
.pipe(Effect.catchTag("ParseError", (error) => (hooks.onFallback?.(key, error.message) ?? Effect.void).pipe(Effect.andThen(fallback(plan.prompt, plan.labels)))));
|
|
132
|
+
const scoreQuestion = (state, key, question) => Effect.gen(function* () {
|
|
133
|
+
const plans = permutationsFor(question).map((reverse) => labelPlan(state, question, reverse));
|
|
134
|
+
const reads = yield* Effect.forEach(plans, (plan) => Effect.map(scoreOnce(plan, key), (distribution) => [plan.keys, distribution]));
|
|
135
|
+
return combine(question, reads, config.model);
|
|
136
|
+
});
|
|
137
|
+
const independently = (input, entries) => Effect.forEach(entries, ([key, question]) => Effect.map(Effect.result(scoreQuestion(input.state, key, question)), (outcome) => [key, outcome]), { concurrency: config.concurrency });
|
|
138
|
+
/**
|
|
139
|
+
* One call per permutation for the whole request. A question whose
|
|
140
|
+
* position could not be read in any permutation, or a call that failed
|
|
141
|
+
* outright, goes back through the independent path for that question.
|
|
142
|
+
*/
|
|
143
|
+
const sharedPrefix = (input, entries) => Effect.gen(function* () {
|
|
144
|
+
const questions = entries.map(([, question]) => question);
|
|
145
|
+
const calls = yield* Effect.forEach(permutations, (reverse) => {
|
|
146
|
+
const plan = sequencePlan(input.state, questions, reverse);
|
|
147
|
+
return Effect.map(Effect.result(sequence(plan.prompt, plan.parts.map((part) => part.labels))), (outcome) => [plan, outcome]);
|
|
148
|
+
});
|
|
149
|
+
const successes = calls.flatMap(([, outcome]) => Result.isSuccess(outcome) ? [outcome.success] : []);
|
|
150
|
+
const batchModel = successes.find((call) => call.model !== undefined)?.model ?? config.model;
|
|
151
|
+
const answered = [];
|
|
152
|
+
const retry = [];
|
|
153
|
+
for (const [index, [key, question]] of entries.entries()) {
|
|
154
|
+
const reads = [];
|
|
155
|
+
let reason;
|
|
156
|
+
for (const [callIndex, reverse] of permutations.entries()) {
|
|
157
|
+
if (!permutationsFor(question).includes(reverse)) {
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
const call = calls[callIndex];
|
|
161
|
+
const part = call?.[0].parts[index];
|
|
162
|
+
const outcome = call?.[1];
|
|
163
|
+
if (outcome === undefined || part === undefined) {
|
|
164
|
+
reason = "no batched call covered this question";
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
if (Result.isFailure(outcome)) {
|
|
168
|
+
reason = outcome.failure.message;
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
const entry = outcome.success.entries[index];
|
|
172
|
+
if (entry === undefined) {
|
|
173
|
+
reason = "no entry for this question";
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
if (Result.isFailure(entry)) {
|
|
177
|
+
reason = entry.failure.message;
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
reads.push([part.keys, entry.success]);
|
|
181
|
+
}
|
|
182
|
+
if (reason === undefined && reads.length > 0) {
|
|
183
|
+
// Usage was reported once for the whole call; the per-question reads carry none.
|
|
184
|
+
answered.push([key, Result.succeed(combine(question, reads, batchModel))]);
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
yield* hooks.onFallback?.(key, `shared-prefix batch: ${reason ?? "unreadable"}`) ??
|
|
188
|
+
Effect.void;
|
|
189
|
+
retry.push([key, question]);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
const retried = retry.length === 0 ? [] : yield* independently(input, retry);
|
|
193
|
+
const order = new Map(entries.map(([key], index) => [key, index]));
|
|
194
|
+
const outcomes = [...answered, ...retried].sort(([a], [b]) => (order.get(a) ?? 0) - (order.get(b) ?? 0));
|
|
195
|
+
return {
|
|
196
|
+
outcomes,
|
|
197
|
+
usage: sumUsage(successes.map((call) => call.usage)),
|
|
198
|
+
model: successes.find((call) => call.model !== undefined)?.model
|
|
199
|
+
};
|
|
200
|
+
});
|
|
201
|
+
const judge = Effect.fn("@llm4ts/core/judgment/LlmJudgment.judge")(function* (input) {
|
|
202
|
+
const entries = Object.entries(input.questions);
|
|
203
|
+
const batched = config.batching === "shared-prefix" && entries.length > 1
|
|
204
|
+
? yield* sharedPrefix(input, entries)
|
|
205
|
+
: { outcomes: yield* independently(input, entries), usage: undefined, model: undefined };
|
|
206
|
+
const answers = {};
|
|
207
|
+
const failures = [];
|
|
208
|
+
const usages = [batched.usage];
|
|
209
|
+
let model = batched.model;
|
|
210
|
+
for (const [key, outcome] of batched.outcomes) {
|
|
211
|
+
if (Result.isFailure(outcome)) {
|
|
212
|
+
failures.push(QuestionFailure.make({ key, reason: outcome.failure.message }));
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
answers[key] = outcome.success.answer;
|
|
216
|
+
usages.push(outcome.success.usage);
|
|
217
|
+
model = model ?? outcome.success.model;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
const usage = sumUsage(usages);
|
|
221
|
+
if (usage !== undefined && hooks.onUsage !== undefined) {
|
|
222
|
+
yield* hooks.onUsage(usage, model);
|
|
223
|
+
}
|
|
224
|
+
return JudgmentResult.make({
|
|
225
|
+
answers,
|
|
226
|
+
failures,
|
|
227
|
+
backend: "llm",
|
|
228
|
+
...(usage === undefined ? {} : { usage }),
|
|
229
|
+
...(model === undefined ? {} : { model })
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
return {
|
|
233
|
+
backend: "llm",
|
|
234
|
+
identity: `llm:${config.connector ?? "unknown"}:${config.model ?? "default"}`,
|
|
235
|
+
judge
|
|
236
|
+
};
|
|
237
|
+
};
|
|
238
|
+
export const LlmJudgmentLive = (llm, config, hooks) => Layer.succeed(Judgment, makeLlmJudgment(llm, config, hooks));
|
|
239
|
+
//# sourceMappingURL=LlmJudgment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LlmJudgment.js","sourceRoot":"","sources":["../../src/judgment/LlmJudgment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,EAAE,4BAA4B,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAExF,OAAO,EAAE,UAAU,EAA0B,MA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AAK,IAAI,SAAS,EAAE;QAC7E,KAAK;KACN,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,GAAoB,EACpB,MAA0B,EAC1B,KAAwB,EACD,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
import { TokenUsage } from "../Models.ts";
|
|
3
|
+
/**
|
|
4
|
+
* Typed judgments (ADR 0017): atomic questions evaluated against one State,
|
|
5
|
+
* answered with probabilities instead of text. Wire names mirror TypeSafe's
|
|
6
|
+
* Jev so its cookbooks port by search and replace, with two changes: `noul`
|
|
7
|
+
* is `truth`, and every answer carries an `origin` (backend, checkpoint,
|
|
8
|
+
* extraction method, calibration evidence, escalation) plus `support`, the
|
|
9
|
+
* mass the backend actually placed on the offered options. Vocabulary:
|
|
10
|
+
* CONTEXT.md.
|
|
11
|
+
*/
|
|
12
|
+
/** The content a judgment evaluates. Data, never instructions. */
|
|
13
|
+
export declare const State: Schema.Union<readonly [Schema.String, Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>, Schema.$Array<Schema.String>]>;
|
|
14
|
+
export type State = typeof State.Type;
|
|
15
|
+
/** An option, level, or criterion: text or any JSON structure (Jev's `EntryType`). */
|
|
16
|
+
export declare const Description: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
17
|
+
export type Description = typeof Description.Type;
|
|
18
|
+
declare const ChoiceQuestion_base: Schema.Class<ChoiceQuestion, Schema.Struct<{
|
|
19
|
+
readonly type: Schema.Literal<"choice">;
|
|
20
|
+
readonly instructions: Schema.String;
|
|
21
|
+
/** Option key to description. Include an "other" key when coverage is uncertain. */
|
|
22
|
+
readonly criteria: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
23
|
+
}>, {}>;
|
|
24
|
+
export declare class ChoiceQuestion extends ChoiceQuestion_base {
|
|
25
|
+
}
|
|
26
|
+
declare const ScoreQuestion_base: Schema.Class<ScoreQuestion, Schema.Struct<{
|
|
27
|
+
readonly type: Schema.Literal<"score">;
|
|
28
|
+
readonly instructions: Schema.String;
|
|
29
|
+
/** Ordered levels, index 0 first. */
|
|
30
|
+
readonly criteria: Schema.$Array<Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
31
|
+
}>, {}>;
|
|
32
|
+
export declare class ScoreQuestion extends ScoreQuestion_base {
|
|
33
|
+
}
|
|
34
|
+
declare const TruthCriteria_base: Schema.Class<TruthCriteria, Schema.Struct<{
|
|
35
|
+
readonly true: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
36
|
+
readonly false: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
37
|
+
}>, {}>;
|
|
38
|
+
export declare class TruthCriteria extends TruthCriteria_base {
|
|
39
|
+
}
|
|
40
|
+
declare const TruthQuestion_base: Schema.Class<TruthQuestion, Schema.Struct<{
|
|
41
|
+
readonly type: Schema.Literal<"truth">;
|
|
42
|
+
readonly instructions: Schema.String;
|
|
43
|
+
readonly criteria: Schema.optionalKey<typeof TruthCriteria>;
|
|
44
|
+
}>, {}>;
|
|
45
|
+
export declare class TruthQuestion extends TruthQuestion_base {
|
|
46
|
+
}
|
|
47
|
+
export declare const Question: Schema.Union<readonly [typeof ChoiceQuestion, typeof ScoreQuestion, typeof TruthQuestion]>;
|
|
48
|
+
export type Question = typeof Question.Type;
|
|
49
|
+
export declare const choice: (instructions: string, criteria: Readonly<Record<string, Description>>) => ChoiceQuestion;
|
|
50
|
+
export declare const score: (instructions: string, criteria: ReadonlyArray<Description>) => ScoreQuestion;
|
|
51
|
+
export declare const truth: (instructions: string, criteria?: {
|
|
52
|
+
readonly true: Description;
|
|
53
|
+
readonly false: Description;
|
|
54
|
+
}) => TruthQuestion;
|
|
55
|
+
export declare const JudgmentBackend: Schema.Literals<readonly ["typesafe", "llm", "fake"]>;
|
|
56
|
+
export type JudgmentBackend = typeof JudgmentBackend.Type;
|
|
57
|
+
/** How the probabilities were extracted. */
|
|
58
|
+
export declare const ScoringMethod: Schema.Literals<readonly ["logprobs", "verbalized", "sampled", "reasoning", "hosted"]>;
|
|
59
|
+
export type ScoringMethod = typeof ScoringMethod.Type;
|
|
60
|
+
/**
|
|
61
|
+
* What is known about the numbers' calibration: `none` (nothing), `claimed`
|
|
62
|
+
* (the provider says so; TypeSafe), `measured` (an evaluation in this
|
|
63
|
+
* project produced the evidence; see the judgment decision map).
|
|
64
|
+
*/
|
|
65
|
+
export declare const Calibration: Schema.Literals<readonly ["none", "claimed", "measured"]>;
|
|
66
|
+
export type Calibration = typeof Calibration.Type;
|
|
67
|
+
declare const AnswerOrigin_base: Schema.Class<AnswerOrigin, Schema.Struct<{
|
|
68
|
+
readonly backend: Schema.Literals<readonly ["typesafe", "llm", "fake"]>;
|
|
69
|
+
readonly model: Schema.optionalKey<Schema.String>;
|
|
70
|
+
readonly method: Schema.Literals<readonly ["logprobs", "verbalized", "sampled", "reasoning", "hosted"]>;
|
|
71
|
+
readonly calibration: Schema.withDecodingDefaultKey<Schema.withConstructorDefault<Schema.Literals<readonly ["none", "claimed", "measured"]>>, never>;
|
|
72
|
+
readonly escalated: Schema.withDecodingDefaultKey<Schema.withConstructorDefault<Schema.Boolean>, never>;
|
|
73
|
+
}>, {}>;
|
|
74
|
+
/**
|
|
75
|
+
* Where an answer came from, in four separate facts a policy may key on:
|
|
76
|
+
* which backend and checkpoint produced it, how the probabilities were
|
|
77
|
+
* extracted, what is known about their calibration, and whether the answer
|
|
78
|
+
* replaced an earlier one through escalation.
|
|
79
|
+
*/
|
|
80
|
+
export declare class AnswerOrigin extends AnswerOrigin_base {
|
|
81
|
+
}
|
|
82
|
+
declare const ChoiceAnswer_base: Schema.Class<ChoiceAnswer, Schema.Struct<{
|
|
83
|
+
readonly type: Schema.Literal<"choice">;
|
|
84
|
+
readonly choice: Schema.String;
|
|
85
|
+
readonly probabilities: Schema.$Record<Schema.String, Schema.Number>;
|
|
86
|
+
/** The maximum probability, everywhere: the same statistic whatever the backend. */
|
|
87
|
+
readonly confidence: Schema.Number;
|
|
88
|
+
/** The backend's own confidence statistic when it reports one (TypeSafe), kept for comparison. */
|
|
89
|
+
readonly reportedConfidence: Schema.optionalKey<Schema.Number>;
|
|
90
|
+
readonly support: Schema.withDecodingDefaultKey<Schema.withConstructorDefault<Schema.Number>, never>;
|
|
91
|
+
readonly origin: typeof AnswerOrigin;
|
|
92
|
+
}>, {}>;
|
|
93
|
+
export declare class ChoiceAnswer extends ChoiceAnswer_base {
|
|
94
|
+
}
|
|
95
|
+
declare const ScoreAnswer_base: Schema.Class<ScoreAnswer, Schema.Struct<{
|
|
96
|
+
readonly type: Schema.Literal<"score">;
|
|
97
|
+
/** Expected level index; may fall between two levels. */
|
|
98
|
+
readonly score: Schema.Number;
|
|
99
|
+
/** Level index (as a string key) to its description, echoed from the question. */
|
|
100
|
+
readonly legend: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
101
|
+
readonly probabilities: Schema.$Record<Schema.String, Schema.Number>;
|
|
102
|
+
readonly confidence: Schema.Number;
|
|
103
|
+
readonly reportedConfidence: Schema.optionalKey<Schema.Number>;
|
|
104
|
+
readonly support: Schema.withDecodingDefaultKey<Schema.withConstructorDefault<Schema.Number>, never>;
|
|
105
|
+
readonly origin: typeof AnswerOrigin;
|
|
106
|
+
}>, {}>;
|
|
107
|
+
export declare class ScoreAnswer extends ScoreAnswer_base {
|
|
108
|
+
}
|
|
109
|
+
declare const TruthAnswer_base: Schema.Class<TruthAnswer, Schema.Struct<{
|
|
110
|
+
readonly type: Schema.Literal<"truth">;
|
|
111
|
+
/** Probability that the statement holds. */
|
|
112
|
+
readonly truth: Schema.Number;
|
|
113
|
+
readonly support: Schema.withDecodingDefaultKey<Schema.withConstructorDefault<Schema.Number>, never>;
|
|
114
|
+
readonly origin: typeof AnswerOrigin;
|
|
115
|
+
}>, {}>;
|
|
116
|
+
export declare class TruthAnswer extends TruthAnswer_base {
|
|
117
|
+
}
|
|
118
|
+
export declare const Answer: Schema.Union<readonly [typeof ChoiceAnswer, typeof ScoreAnswer, typeof TruthAnswer]>;
|
|
119
|
+
export type Answer = typeof Answer.Type;
|
|
120
|
+
/** The answer type a question kind produces, for typed call sites. */
|
|
121
|
+
export type AnswerFor<Q extends Question> = Q extends ChoiceQuestion ? ChoiceAnswer : Q extends ScoreQuestion ? ScoreAnswer : TruthAnswer;
|
|
122
|
+
declare const QuestionFailure_base: Schema.Class<QuestionFailure, Schema.Struct<{
|
|
123
|
+
readonly key: Schema.String;
|
|
124
|
+
readonly reason: Schema.String;
|
|
125
|
+
}>, {}>;
|
|
126
|
+
/** A question that could not be answered; the others in the request still were. */
|
|
127
|
+
export declare class QuestionFailure extends QuestionFailure_base {
|
|
128
|
+
}
|
|
129
|
+
declare const JudgmentRequest_base: Schema.Class<JudgmentRequest, Schema.Struct<{
|
|
130
|
+
readonly state: Schema.Union<readonly [Schema.String, Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>, Schema.$Array<Schema.String>]>;
|
|
131
|
+
readonly questions: Schema.$Record<Schema.String, Schema.Union<readonly [typeof ChoiceQuestion, typeof ScoreQuestion, typeof TruthQuestion]>>;
|
|
132
|
+
}>, {}>;
|
|
133
|
+
export declare class JudgmentRequest extends JudgmentRequest_base {
|
|
134
|
+
}
|
|
135
|
+
declare const JudgmentResult_base: Schema.Class<JudgmentResult, Schema.Struct<{
|
|
136
|
+
readonly answers: Schema.$Record<Schema.String, Schema.Union<readonly [typeof ChoiceAnswer, typeof ScoreAnswer, typeof TruthAnswer]>>;
|
|
137
|
+
readonly failures: Schema.withConstructorDefault<Schema.$Array<typeof QuestionFailure>>;
|
|
138
|
+
readonly usage: Schema.optionalKey<typeof TokenUsage>;
|
|
139
|
+
readonly model: Schema.optionalKey<Schema.String>;
|
|
140
|
+
readonly backend: Schema.Literals<readonly ["typesafe", "llm", "fake"]>;
|
|
141
|
+
}>, {}>;
|
|
142
|
+
export declare class JudgmentResult extends JudgmentResult_base {
|
|
143
|
+
}
|
|
144
|
+
/** Confidence is the peak of the distribution: the maximum probability. */
|
|
145
|
+
export declare const confidenceOf: (probabilities: Readonly<Record<string, number>>) => number;
|
|
146
|
+
/** Score is the expected level index under the distribution. */
|
|
147
|
+
export declare const expectedScore: (probabilities: Readonly<Record<string, number>>) => number;
|
|
148
|
+
export declare const argmax: (probabilities: Readonly<Record<string, number>>) => string | undefined;
|
|
149
|
+
export declare const choiceAnswer: (probabilities: Readonly<Record<string, number>>, origin: AnswerOrigin, support?: number) => ChoiceAnswer;
|
|
150
|
+
export declare const scoreAnswer: (question: ScoreQuestion, probabilities: Readonly<Record<string, number>>, origin: AnswerOrigin, support?: number) => ScoreAnswer;
|
|
151
|
+
export declare const truthAnswer: (probability: number, origin: AnswerOrigin, support?: number) => TruthAnswer;
|
|
152
|
+
/** Origins for the common cases, so call sites stay short. */
|
|
153
|
+
export declare const origins: Readonly<{
|
|
154
|
+
llm: (method: ScoringMethod, model?: string) => AnswerOrigin;
|
|
155
|
+
hosted: (model?: string) => AnswerOrigin;
|
|
156
|
+
fake: (method?: ScoringMethod) => AnswerOrigin;
|
|
157
|
+
escalated: (backend: JudgmentBackend, model?: string) => AnswerOrigin;
|
|
158
|
+
}>;
|
|
159
|
+
/** Average several distributions over the same keys (used for permutations). */
|
|
160
|
+
export declare const averageProbabilities: (distributions: ReadonlyArray<Readonly<Record<string, number>>>) => Record<string, number>;
|
|
161
|
+
export declare const renderState: (state: State) => string;
|
|
162
|
+
export {};
|
|
163
|
+
//# sourceMappingURL=Schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Schemas.d.ts","sourceRoot":"","sources":["../../src/judgment/Schemas.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM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vB,eAAe,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAC/C,QAAQ,YAAY,EACpB,gBAAW,KACV,YAQC,CAAA;AAEJ,eAAO,MAAM,WAAW,GACtB,UAAU,aAAa,EACvB,eAAe,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAC/C,QAAQ,YAAY,EACpB,gBAAW,KACV,WASC,CAAA;AAEJ,eAAO,MAAM,WAAW,GAAI,aAAa,MAAM,EAAE,QAAQ,YAAY,EAAE,gBAAW,KAAG,WACX,CAAA;AAE1E,8DAA8D;AAC9D,eAAO,MAAM,OAAO;kBACJ,aAAa,UAAU,MAAM,KAAG,YAAY;qBAEzC,MAAM,KAAG,YAAY;oBAOvB,aAAa,KAAkB,YAAY;yBAErC,eAAe,UAAU,MAAM,KAAG,YAAY;EAOnE,CAAA;AAEF,gFAAgF;AAChF,eAAO,MAAM,oBAAoB,GAC/B,eAAe,aAAa,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,KAC7D,MAAM,CAAC,MAAM,EAAE,MAAM,CASvB,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,OAAO,KAAK,KAAG,MAKL,CAAA"}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import * as Schema from "effect/Schema";
|
|
3
|
+
import { TokenUsage } from "../Models.js";
|
|
4
|
+
/**
|
|
5
|
+
* Typed judgments (ADR 0017): atomic questions evaluated against one State,
|
|
6
|
+
* answered with probabilities instead of text. Wire names mirror TypeSafe's
|
|
7
|
+
* Jev so its cookbooks port by search and replace, with two changes: `noul`
|
|
8
|
+
* is `truth`, and every answer carries an `origin` (backend, checkpoint,
|
|
9
|
+
* extraction method, calibration evidence, escalation) plus `support`, the
|
|
10
|
+
* mass the backend actually placed on the offered options. Vocabulary:
|
|
11
|
+
* CONTEXT.md.
|
|
12
|
+
*/
|
|
13
|
+
/** The content a judgment evaluates. Data, never instructions. */
|
|
14
|
+
export const State = Schema.Union([
|
|
15
|
+
Schema.String,
|
|
16
|
+
Schema.Record(Schema.String, Schema.Json),
|
|
17
|
+
Schema.Array(Schema.String)
|
|
18
|
+
]);
|
|
19
|
+
/** An option, level, or criterion: text or any JSON structure (Jev's `EntryType`). */
|
|
20
|
+
export const Description = Schema.Json;
|
|
21
|
+
export class ChoiceQuestion extends Schema.Class("ChoiceQuestion")({
|
|
22
|
+
type: Schema.Literal("choice"),
|
|
23
|
+
instructions: Schema.String,
|
|
24
|
+
/** Option key to description. Include an "other" key when coverage is uncertain. */
|
|
25
|
+
criteria: Schema.Record(Schema.String, Description)
|
|
26
|
+
}) {
|
|
27
|
+
}
|
|
28
|
+
export class ScoreQuestion extends Schema.Class("ScoreQuestion")({
|
|
29
|
+
type: Schema.Literal("score"),
|
|
30
|
+
instructions: Schema.String,
|
|
31
|
+
/** Ordered levels, index 0 first. */
|
|
32
|
+
criteria: Schema.Array(Description)
|
|
33
|
+
}) {
|
|
34
|
+
}
|
|
35
|
+
export class TruthCriteria extends Schema.Class("TruthCriteria")({
|
|
36
|
+
true: Description,
|
|
37
|
+
false: Description
|
|
38
|
+
}) {
|
|
39
|
+
}
|
|
40
|
+
export class TruthQuestion extends Schema.Class("TruthQuestion")({
|
|
41
|
+
type: Schema.Literal("truth"),
|
|
42
|
+
instructions: Schema.String,
|
|
43
|
+
criteria: Schema.optionalKey(TruthCriteria)
|
|
44
|
+
}) {
|
|
45
|
+
}
|
|
46
|
+
export const Question = Schema.Union([ChoiceQuestion, ScoreQuestion, TruthQuestion]);
|
|
47
|
+
export const choice = (instructions, criteria) => ChoiceQuestion.make({ type: "choice", instructions, criteria });
|
|
48
|
+
export const score = (instructions, criteria) => ScoreQuestion.make({ type: "score", instructions, criteria });
|
|
49
|
+
export const truth = (instructions, criteria) => TruthQuestion.make({
|
|
50
|
+
type: "truth",
|
|
51
|
+
instructions,
|
|
52
|
+
...(criteria === undefined ? {} : { criteria: TruthCriteria.make(criteria) })
|
|
53
|
+
});
|
|
54
|
+
export const JudgmentBackend = Schema.Literals(["typesafe", "llm", "fake"]);
|
|
55
|
+
/** How the probabilities were extracted. */
|
|
56
|
+
export const ScoringMethod = Schema.Literals([
|
|
57
|
+
"logprobs",
|
|
58
|
+
"verbalized",
|
|
59
|
+
"sampled",
|
|
60
|
+
"reasoning",
|
|
61
|
+
"hosted"
|
|
62
|
+
]);
|
|
63
|
+
/**
|
|
64
|
+
* What is known about the numbers' calibration: `none` (nothing), `claimed`
|
|
65
|
+
* (the provider says so; TypeSafe), `measured` (an evaluation in this
|
|
66
|
+
* project produced the evidence; see the judgment decision map).
|
|
67
|
+
*/
|
|
68
|
+
export const Calibration = Schema.Literals(["none", "claimed", "measured"]);
|
|
69
|
+
/**
|
|
70
|
+
* Where an answer came from, in four separate facts a policy may key on:
|
|
71
|
+
* which backend and checkpoint produced it, how the probabilities were
|
|
72
|
+
* extracted, what is known about their calibration, and whether the answer
|
|
73
|
+
* replaced an earlier one through escalation.
|
|
74
|
+
*/
|
|
75
|
+
export class AnswerOrigin extends Schema.Class("AnswerOrigin")({
|
|
76
|
+
backend: JudgmentBackend,
|
|
77
|
+
model: Schema.optionalKey(Schema.String),
|
|
78
|
+
method: ScoringMethod,
|
|
79
|
+
calibration: Calibration.pipe(Schema.withConstructorDefault(Effect.succeed("none")), Schema.withDecodingDefaultKey(Effect.succeed("none"))),
|
|
80
|
+
escalated: Schema.Boolean.pipe(Schema.withConstructorDefault(Effect.succeed(false)), Schema.withDecodingDefaultKey(Effect.succeed(false)))
|
|
81
|
+
}) {
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Probability mass the backend placed on the offered options before
|
|
85
|
+
* renormalization (1 when declared over the options alone). Low support
|
|
86
|
+
* means the distribution was rebuilt from a sliver and must not be acted on.
|
|
87
|
+
*/
|
|
88
|
+
const Support = Schema.Number.pipe(Schema.withConstructorDefault(Effect.succeed(1)), Schema.withDecodingDefaultKey(Effect.succeed(1)));
|
|
89
|
+
export class ChoiceAnswer extends Schema.Class("ChoiceAnswer")({
|
|
90
|
+
type: Schema.Literal("choice"),
|
|
91
|
+
choice: Schema.String,
|
|
92
|
+
probabilities: Schema.Record(Schema.String, Schema.Number),
|
|
93
|
+
/** The maximum probability, everywhere: the same statistic whatever the backend. */
|
|
94
|
+
confidence: Schema.Number,
|
|
95
|
+
/** The backend's own confidence statistic when it reports one (TypeSafe), kept for comparison. */
|
|
96
|
+
reportedConfidence: Schema.optionalKey(Schema.Number),
|
|
97
|
+
support: Support,
|
|
98
|
+
origin: AnswerOrigin
|
|
99
|
+
}) {
|
|
100
|
+
}
|
|
101
|
+
export class ScoreAnswer extends Schema.Class("ScoreAnswer")({
|
|
102
|
+
type: Schema.Literal("score"),
|
|
103
|
+
/** Expected level index; may fall between two levels. */
|
|
104
|
+
score: Schema.Number,
|
|
105
|
+
/** Level index (as a string key) to its description, echoed from the question. */
|
|
106
|
+
legend: Schema.Record(Schema.String, Description),
|
|
107
|
+
probabilities: Schema.Record(Schema.String, Schema.Number),
|
|
108
|
+
confidence: Schema.Number,
|
|
109
|
+
reportedConfidence: Schema.optionalKey(Schema.Number),
|
|
110
|
+
support: Support,
|
|
111
|
+
origin: AnswerOrigin
|
|
112
|
+
}) {
|
|
113
|
+
}
|
|
114
|
+
export class TruthAnswer extends Schema.Class("TruthAnswer")({
|
|
115
|
+
type: Schema.Literal("truth"),
|
|
116
|
+
/** Probability that the statement holds. */
|
|
117
|
+
truth: Schema.Number,
|
|
118
|
+
support: Support,
|
|
119
|
+
origin: AnswerOrigin
|
|
120
|
+
}) {
|
|
121
|
+
}
|
|
122
|
+
export const Answer = Schema.Union([ChoiceAnswer, ScoreAnswer, TruthAnswer]);
|
|
123
|
+
/** A question that could not be answered; the others in the request still were. */
|
|
124
|
+
export class QuestionFailure extends Schema.Class("QuestionFailure")({
|
|
125
|
+
key: Schema.String,
|
|
126
|
+
reason: Schema.String
|
|
127
|
+
}) {
|
|
128
|
+
}
|
|
129
|
+
export class JudgmentRequest extends Schema.Class("JudgmentRequest")({
|
|
130
|
+
state: State,
|
|
131
|
+
questions: Schema.Record(Schema.String, Question)
|
|
132
|
+
}) {
|
|
133
|
+
}
|
|
134
|
+
const noFailures = Object.freeze([]);
|
|
135
|
+
export class JudgmentResult extends Schema.Class("JudgmentResult")({
|
|
136
|
+
answers: Schema.Record(Schema.String, Answer),
|
|
137
|
+
failures: Schema.Array(QuestionFailure).pipe(Schema.withConstructorDefault(Effect.succeed(noFailures))),
|
|
138
|
+
usage: Schema.optionalKey(TokenUsage),
|
|
139
|
+
model: Schema.optionalKey(Schema.String),
|
|
140
|
+
backend: JudgmentBackend
|
|
141
|
+
}) {
|
|
142
|
+
}
|
|
143
|
+
/** Confidence is the peak of the distribution: the maximum probability. */
|
|
144
|
+
export const confidenceOf = (probabilities) => Object.values(probabilities).reduce((max, value) => (value > max ? value : max), 0);
|
|
145
|
+
/** Score is the expected level index under the distribution. */
|
|
146
|
+
export const expectedScore = (probabilities) => Object.entries(probabilities).reduce((sum, [level, value]) => sum + Number(level) * value, 0);
|
|
147
|
+
export const argmax = (probabilities) => Object.entries(probabilities).reduce((best, entry) => (best === undefined || entry[1] > best[1] ? entry : best), undefined)?.[0];
|
|
148
|
+
export const choiceAnswer = (probabilities, origin, support = 1) => ChoiceAnswer.make({
|
|
149
|
+
type: "choice",
|
|
150
|
+
choice: argmax(probabilities) ?? "",
|
|
151
|
+
probabilities,
|
|
152
|
+
confidence: confidenceOf(probabilities),
|
|
153
|
+
support,
|
|
154
|
+
origin
|
|
155
|
+
});
|
|
156
|
+
export const scoreAnswer = (question, probabilities, origin, support = 1) => ScoreAnswer.make({
|
|
157
|
+
type: "score",
|
|
158
|
+
score: expectedScore(probabilities),
|
|
159
|
+
legend: Object.fromEntries(question.criteria.map((level, index) => [String(index), level])),
|
|
160
|
+
probabilities,
|
|
161
|
+
confidence: confidenceOf(probabilities),
|
|
162
|
+
support,
|
|
163
|
+
origin
|
|
164
|
+
});
|
|
165
|
+
export const truthAnswer = (probability, origin, support = 1) => TruthAnswer.make({ type: "truth", truth: probability, support, origin });
|
|
166
|
+
/** Origins for the common cases, so call sites stay short. */
|
|
167
|
+
export const origins = Object.freeze({
|
|
168
|
+
llm: (method, model) => AnswerOrigin.make({ backend: "llm", method, ...(model === undefined ? {} : { model }) }),
|
|
169
|
+
hosted: (model) => AnswerOrigin.make({
|
|
170
|
+
backend: "typesafe",
|
|
171
|
+
method: "hosted",
|
|
172
|
+
calibration: "claimed",
|
|
173
|
+
...(model === undefined ? {} : { model })
|
|
174
|
+
}),
|
|
175
|
+
fake: (method = "verbalized") => AnswerOrigin.make({ backend: "fake", method }),
|
|
176
|
+
escalated: (backend, model) => AnswerOrigin.make({
|
|
177
|
+
backend,
|
|
178
|
+
method: "reasoning",
|
|
179
|
+
escalated: true,
|
|
180
|
+
...(model === undefined ? {} : { model })
|
|
181
|
+
})
|
|
182
|
+
});
|
|
183
|
+
/** Average several distributions over the same keys (used for permutations). */
|
|
184
|
+
export const averageProbabilities = (distributions) => {
|
|
185
|
+
const keys = new Set(distributions.flatMap((distribution) => Object.keys(distribution)));
|
|
186
|
+
const count = Math.max(1, distributions.length);
|
|
187
|
+
return Object.fromEntries([...keys].map((key) => [
|
|
188
|
+
key,
|
|
189
|
+
distributions.reduce((sum, distribution) => sum + (distribution[key] ?? 0), 0) / count
|
|
190
|
+
]));
|
|
191
|
+
};
|
|
192
|
+
export const renderState = (state) => typeof state === "string"
|
|
193
|
+
? state
|
|
194
|
+
: Array.isArray(state)
|
|
195
|
+
? state.join("\n")
|
|
196
|
+
: JSON.stringify(state, null, 2);
|
|
197
|
+
//# sourceMappingURL=Schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Schemas.js","sourceRoot":"","sources":["../../src/judgment/Schemas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC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