@orangekame3/pi-qcaleval 0.0.2-beta.11 → 0.0.2-beta.12
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 +4 -1
- package/extensions/qcaleval.ts +39 -5
- package/package.json +1 -1
- package/skills/qcaleval/SKILL.md +3 -0
package/README.md
CHANGED
|
@@ -37,7 +37,10 @@ every user turn the model received (with `[figure]` where an image was), and
|
|
|
37
37
|
`details.calls` each question's call with its duration, stop reason and output
|
|
38
38
|
tokens. A call that fails is retried once, as the benchmark retries API
|
|
39
39
|
failures; nothing is re-asked for its content. Questions that got no answer are
|
|
40
|
-
listed in `details.missing_keys`. `questions` asks a subset.
|
|
40
|
+
listed in `details.missing_keys`. `questions` asks a subset. `dry_run` builds
|
|
41
|
+
the prompts and returns them (`details.prompts` by question, `details.prompt`
|
|
42
|
+
as one text) without asking the model, so a host can show what a task's
|
|
43
|
+
reference and examples turn into; the figure may be omitted then.
|
|
41
44
|
|
|
42
45
|
`knowledge` is the experiment background the benchmark prepends to Q2–Q6: a few
|
|
43
46
|
sentences on what the experiment sweeps and what a successful result looks like.
|
package/extensions/qcaleval.ts
CHANGED
|
@@ -769,6 +769,12 @@ const parameters = Type.Object({
|
|
|
769
769
|
description: "The questions to ask (default: all six, in order).",
|
|
770
770
|
}),
|
|
771
771
|
),
|
|
772
|
+
dry_run: Type.Optional(
|
|
773
|
+
Type.Boolean({
|
|
774
|
+
description:
|
|
775
|
+
"Build the prompts and return them without asking the model, to show what it would be sent. The figure may be omitted.",
|
|
776
|
+
}),
|
|
777
|
+
),
|
|
772
778
|
});
|
|
773
779
|
|
|
774
780
|
/** Stored on the tool result; the host reads `diagnosis` without reparsing text. */
|
|
@@ -793,8 +799,12 @@ export interface EvaluationDetails {
|
|
|
793
799
|
calls?: CallRecord[];
|
|
794
800
|
/** The user turns the model was sent, one per question, so the host can show what it saw. */
|
|
795
801
|
prompt?: string;
|
|
802
|
+
/** The same turns by question. */
|
|
803
|
+
prompts?: Partial<Record<Question, string>>;
|
|
796
804
|
/** How many labeled examples were shown. */
|
|
797
805
|
examples_used?: number;
|
|
806
|
+
/** True when the prompts were built but the model was not asked. */
|
|
807
|
+
dry_run?: boolean;
|
|
798
808
|
}
|
|
799
809
|
|
|
800
810
|
function failure(spec: ModelSpec | undefined, text: string): AgentToolResult<EvaluationDetails> {
|
|
@@ -828,16 +838,20 @@ export default function qcalevalExtension(pi: ExtensionAPI) {
|
|
|
828
838
|
ctx: ExtensionToolContext,
|
|
829
839
|
): Promise<AgentToolResult<EvaluationDetails>> {
|
|
830
840
|
const resolved = resolveEvaluationModel(ctx.modelRegistry, ctx.model, process.env.QCALEVAL_MODEL);
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
const spec: ModelSpec
|
|
841
|
+
const dryRun = params.dry_run === true;
|
|
842
|
+
if (!resolved.model && !dryRun) return failure(undefined, resolved.error);
|
|
843
|
+
const spec: ModelSpec | undefined = resolved.model
|
|
844
|
+
? { provider: resolved.model.provider, modelId: resolved.model.id }
|
|
845
|
+
: undefined;
|
|
834
846
|
const images: ImageContent[] = (params.images ?? []).map((image) => ({
|
|
835
847
|
type: "image",
|
|
836
848
|
data: image.data,
|
|
837
849
|
mimeType: image.mimeType,
|
|
838
850
|
}));
|
|
839
851
|
if (images.length === 0) {
|
|
840
|
-
return failure(spec, "no plot was given. Pass the figure in `images` or fetch it first.");
|
|
852
|
+
if (!dryRun) return failure(spec, "no plot was given. Pass the figure in `images` or fetch it first.");
|
|
853
|
+
// The prompts are the same whatever the figure; a placeholder stands in.
|
|
854
|
+
images.push({ type: "image", data: "", mimeType: "image/png" });
|
|
841
855
|
}
|
|
842
856
|
|
|
843
857
|
const requested = new Set<string>(params.questions ?? []);
|
|
@@ -852,6 +866,25 @@ export default function qcalevalExtension(pi: ExtensionAPI) {
|
|
|
852
866
|
};
|
|
853
867
|
const turns = new Map(questions.map((question) => [question, buildQuestionContent(question, input)]));
|
|
854
868
|
const examplesUsed = fitExamples(input.examples ?? []).length;
|
|
869
|
+
const prompts = Object.fromEntries(questions.map((question) => [question, turns.get(question)!.prompt])) as Partial<
|
|
870
|
+
Record<Question, string>
|
|
871
|
+
>;
|
|
872
|
+
const prompt = promptRecord(questions.map((question) => ({ question, prompt: turns.get(question)!.prompt })));
|
|
873
|
+
if (dryRun || !resolved.model) {
|
|
874
|
+
return {
|
|
875
|
+
content: [{ type: "text", text: prompt }],
|
|
876
|
+
details: {
|
|
877
|
+
...(spec ? { model: spec } : {}),
|
|
878
|
+
...(resolved.model && resolved.fallback ? { fallback: true } : {}),
|
|
879
|
+
dry_run: true,
|
|
880
|
+
questions,
|
|
881
|
+
prompt,
|
|
882
|
+
prompts,
|
|
883
|
+
...(examplesUsed ? { examples_used: examplesUsed } : {}),
|
|
884
|
+
},
|
|
885
|
+
};
|
|
886
|
+
}
|
|
887
|
+
const { model, fallback } = resolved;
|
|
855
888
|
const answers = await askQuestions(
|
|
856
889
|
questions,
|
|
857
890
|
(question) =>
|
|
@@ -889,7 +922,8 @@ export default function qcalevalExtension(pi: ExtensionAPI) {
|
|
|
889
922
|
attempts: answers.attempts,
|
|
890
923
|
stop_reason: answers.stopReason,
|
|
891
924
|
calls: answers.calls,
|
|
892
|
-
prompt
|
|
925
|
+
prompt,
|
|
926
|
+
prompts,
|
|
893
927
|
...(examplesUsed ? { examples_used: examplesUsed } : {}),
|
|
894
928
|
},
|
|
895
929
|
...(answers.usage ? { usage: answers.usage } : {}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orangekame3/pi-qcaleval",
|
|
3
|
-
"version": "0.0.2-beta.
|
|
3
|
+
"version": "0.0.2-beta.12",
|
|
4
4
|
"description": "pi extension that sends calibration plots to a calibration-evaluation VLM such as NVIDIA Ising-Calibration and returns a structured diagnosis",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
package/skills/qcaleval/SKILL.md
CHANGED
|
@@ -33,6 +33,9 @@ and `calibration_diagnosis` (a status code, a suggested range, notes), plus
|
|
|
33
33
|
measurement. The host then supplies both; the default is the newest figure only.
|
|
34
34
|
- Pass `questions` to ask a subset, for example `["calibration_diagnosis"]`
|
|
35
35
|
when only the status matters.
|
|
36
|
+
- Pass `dry_run: true` to see the prompts the model would get (per question)
|
|
37
|
+
without asking it, for example when the user wants to check a task's
|
|
38
|
+
reference before judging.
|
|
36
39
|
|
|
37
40
|
## Labeled examples (in-context)
|
|
38
41
|
|