@konneal/engine 0.2.77 → 0.2.78

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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  handleAsk
3
- } from "./chunk-GOYFWC3N.js";
3
+ } from "./chunk-JIN6Y4PD.js";
4
4
  import "./chunk-7HWJOFTQ.js";
5
5
  import "./chunk-SPKPH54J.js";
6
6
  import "./chunk-A3QHHUN5.js";
@@ -2020,18 +2020,25 @@ ${matched.map((m) => `- ${m.text}`).join("\n")}`);
2020
2020
  }
2021
2021
 
2022
2022
  // workers/worker_public/prompts/nameplate.md
2023
- var nameplate_default = `You read instrument nameplates. From the photograph, extract:
2023
+ var nameplate_default = `You read instrument nameplates. Work in two steps.
2024
+
2025
+ Step 1 \u2014 transcribe: list every inscription you can actually read on the
2026
+ photograph, verbatim: names, model designations, serials, accuracy-class
2027
+ markings, capacities with units, and any certificate or approval number
2028
+ (it looks like R76/2006-A-GB1-18.08 \u2014 a family, an edition year, an
2029
+ authority code, a year and a sequence).
2030
+
2031
+ Step 2 \u2014 answer with ONLY a JSON object on one line:
2024
2032
 
2025
2033
  {"manufacturer": "\u2026", "model": "\u2026", "certificate_number": "\u2026"}
2026
2034
 
2027
2035
  - manufacturer: the manufacturer's name exactly as printed, else null.
2028
2036
  - model: the model designation exactly as printed, else null.
2029
- - certificate_number: the OIML certificate number if one is printed
2030
- (it looks like R76/2006-A-GB1-18.08 \u2014 a family, an edition year, an
2031
- authority code, a year and a sequence), exactly as printed, else null.
2037
+ - certificate_number: the OIML certificate number if one is printed,
2038
+ exactly as printed, else null.
2032
2039
 
2033
- Answer with ONLY the JSON object on one line. Never guess beyond what is
2034
- printed.
2040
+ Never guess beyond what is printed; a low-quality photograph yields nulls,
2041
+ not inventions.
2035
2042
  `;
2036
2043
 
2037
2044
  // workers/worker_public/src/nameplate-parse.ts
@@ -2063,6 +2070,11 @@ async function extractNameplate(ai, model, image) {
2063
2070
  const res = await ai.run(model, {
2064
2071
  messages: [
2065
2072
  { role: "system", content: nameplate_default.trimEnd() },
2073
+ // the question rides along: the transcription-first framing that
2074
+ // succeeds in the answer path works better WITH its context than
2075
+ // as an isolated extract-a-JSON task (the isolated form returned
2076
+ // nulls on plates the answer model read every time)
2077
+ { role: "user", content: "This photograph accompanies the user's certificate question. Transcribe what you can read, then answer with the JSON object." },
2066
2078
  { role: "user", content: [{ type: "image_url", image_url: { url: image } }] }
2067
2079
  ],
2068
2080
  // the budget rises with the retry's effort — elevated effort under
@@ -1,12 +1,19 @@
1
- You read instrument nameplates. From the photograph, extract:
1
+ You read instrument nameplates. Work in two steps.
2
+
3
+ Step 1 — transcribe: list every inscription you can actually read on the
4
+ photograph, verbatim: names, model designations, serials, accuracy-class
5
+ markings, capacities with units, and any certificate or approval number
6
+ (it looks like R76/2006-A-GB1-18.08 — a family, an edition year, an
7
+ authority code, a year and a sequence).
8
+
9
+ Step 2 — answer with ONLY a JSON object on one line:
2
10
 
3
11
  {"manufacturer": "…", "model": "…", "certificate_number": "…"}
4
12
 
5
13
  - manufacturer: the manufacturer's name exactly as printed, else null.
6
14
  - model: the model designation exactly as printed, else null.
7
- - certificate_number: the OIML certificate number if one is printed
8
- (it looks like R76/2006-A-GB1-18.08 — a family, an edition year, an
9
- authority code, a year and a sequence), exactly as printed, else null.
15
+ - certificate_number: the OIML certificate number if one is printed,
16
+ exactly as printed, else null.
10
17
 
11
- Answer with ONLY the JSON object on one line. Never guess beyond what is
12
- printed.
18
+ Never guess beyond what is printed; a low-quality photograph yields nulls,
19
+ not inventions.
@@ -6,7 +6,7 @@ import {
6
6
  modelGroundingBlock,
7
7
  scoreFaithfulness,
8
8
  scoreJudge
9
- } from "../../chunk-GOYFWC3N.js";
9
+ } from "../../chunk-JIN6Y4PD.js";
10
10
  import {
11
11
  handleSearch
12
12
  } from "../../chunk-KO6DRI7C.js";
@@ -959,7 +959,7 @@ async function handleMcp(env, ctx, req, tier, key) {
959
959
  // stream:false forces the JSON lane (anon defaults to SSE)
960
960
  body: JSON.stringify({ ...args, stream: false })
961
961
  });
962
- const res = name === "ask" ? await (await import("../../ask-DKYIVPNV.js")).handleAsk(env, ctx, inner, tier, key) : await (await import("../../search-LVUQLA3C.js")).handleSearch(env, ctx, inner, tier, key);
962
+ const res = name === "ask" ? await (await import("../../ask-IANJ4PXT.js")).handleAsk(env, ctx, inner, tier, key) : await (await import("../../search-LVUQLA3C.js")).handleSearch(env, ctx, inner, tier, key);
963
963
  return res.json().catch(() => ({ error: { message: "tool transport failed", status: res.status } }));
964
964
  });
965
965
  if (out.ok && "accepted" in out) return new Response(null, { status: 202 });
package/package.json CHANGED
@@ -27,7 +27,7 @@
27
27
  "playwright": "^1.62.1",
28
28
  "yaml": "^2.9.1"
29
29
  },
30
- "version": "0.2.77",
30
+ "version": "0.2.78",
31
31
  "description": "The Konneal engine: the publisher-agnostic build pipeline and API plane for standards intelligence (retrieval, answer contract, verdicts, evaluation).",
32
32
  "license": "BSD-3-Clause",
33
33
  "type": "module",
@@ -1,12 +1,19 @@
1
- You read instrument nameplates. From the photograph, extract:
1
+ You read instrument nameplates. Work in two steps.
2
+
3
+ Step 1 — transcribe: list every inscription you can actually read on the
4
+ photograph, verbatim: names, model designations, serials, accuracy-class
5
+ markings, capacities with units, and any certificate or approval number
6
+ (it looks like R76/2006-A-GB1-18.08 — a family, an edition year, an
7
+ authority code, a year and a sequence).
8
+
9
+ Step 2 — answer with ONLY a JSON object on one line:
2
10
 
3
11
  {"manufacturer": "…", "model": "…", "certificate_number": "…"}
4
12
 
5
13
  - manufacturer: the manufacturer's name exactly as printed, else null.
6
14
  - model: the model designation exactly as printed, else null.
7
- - certificate_number: the OIML certificate number if one is printed
8
- (it looks like R76/2006-A-GB1-18.08 — a family, an edition year, an
9
- authority code, a year and a sequence), exactly as printed, else null.
15
+ - certificate_number: the OIML certificate number if one is printed,
16
+ exactly as printed, else null.
10
17
 
11
- Answer with ONLY the JSON object on one line. Never guess beyond what is
12
- printed.
18
+ Never guess beyond what is printed; a low-quality photograph yields nulls,
19
+ not inventions.
@@ -24,6 +24,11 @@ export async function extractNameplate(ai: any, model: string, image: string): P
24
24
  const res: any = await ai.run(model, {
25
25
  messages: [
26
26
  { role: "system", content: nameplatePrompt.trimEnd() },
27
+ // the question rides along: the transcription-first framing that
28
+ // succeeds in the answer path works better WITH its context than
29
+ // as an isolated extract-a-JSON task (the isolated form returned
30
+ // nulls on plates the answer model read every time)
31
+ { role: "user", content: "This photograph accompanies the user's certificate question. Transcribe what you can read, then answer with the JSON object." },
27
32
  { role: "user", content: [{ type: "image_url", image_url: { url: image } }] },
28
33
  ],
29
34
  // the budget rises with the retry's effort — elevated effort under