@procedures/llm 0.0.0-stage → 0.3.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.
Files changed (60) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/LICENSE +21 -0
  3. package/README.md +109 -2
  4. package/dist/.tsbuildinfo +1 -0
  5. package/dist/anthropic.d.ts +102 -0
  6. package/dist/anthropic.d.ts.map +1 -0
  7. package/dist/anthropic.js +195 -0
  8. package/dist/anthropic.js.map +1 -0
  9. package/dist/errors.d.ts +34 -0
  10. package/dist/errors.d.ts.map +1 -0
  11. package/dist/errors.js +20 -0
  12. package/dist/errors.js.map +1 -0
  13. package/dist/index.d.ts +7 -0
  14. package/dist/index.d.ts.map +1 -0
  15. package/dist/index.js +9 -0
  16. package/dist/index.js.map +1 -0
  17. package/dist/module.d.ts +48 -0
  18. package/dist/module.d.ts.map +1 -0
  19. package/dist/module.js +145 -0
  20. package/dist/module.js.map +1 -0
  21. package/dist/procedures/llm/complete.d.ts +13 -0
  22. package/dist/procedures/llm/complete.d.ts.map +1 -0
  23. package/dist/procedures/llm/complete.js +23 -0
  24. package/dist/procedures/llm/complete.js.map +1 -0
  25. package/dist/procedures/llm/index.d.ts +3 -0
  26. package/dist/procedures/llm/index.d.ts.map +1 -0
  27. package/dist/procedures/llm/index.js +3 -0
  28. package/dist/procedures/llm/index.js.map +1 -0
  29. package/dist/procedures/llm/structured.d.ts +16 -0
  30. package/dist/procedures/llm/structured.d.ts.map +1 -0
  31. package/dist/procedures/llm/structured.js +75 -0
  32. package/dist/procedures/llm/structured.js.map +1 -0
  33. package/dist/register.d.ts +6 -0
  34. package/dist/register.d.ts.map +1 -0
  35. package/dist/register.js +8 -0
  36. package/dist/register.js.map +1 -0
  37. package/dist/request.d.ts +10 -0
  38. package/dist/request.d.ts.map +1 -0
  39. package/dist/request.js +26 -0
  40. package/dist/request.js.map +1 -0
  41. package/dist/schema.d.ts +31 -0
  42. package/dist/schema.d.ts.map +1 -0
  43. package/dist/schema.js +86 -0
  44. package/dist/schema.js.map +1 -0
  45. package/dist/types.d.ts +76 -0
  46. package/dist/types.d.ts.map +1 -0
  47. package/dist/types.js +8 -0
  48. package/dist/types.js.map +1 -0
  49. package/package.json +77 -3
  50. package/src/anthropic.ts +255 -0
  51. package/src/errors.ts +38 -0
  52. package/src/index.ts +20 -0
  53. package/src/module.ts +186 -0
  54. package/src/procedures/llm/complete.ts +26 -0
  55. package/src/procedures/llm/index.ts +2 -0
  56. package/src/procedures/llm/structured.ts +79 -0
  57. package/src/register.ts +10 -0
  58. package/src/request.ts +25 -0
  59. package/src/schema.ts +85 -0
  60. package/src/types.ts +90 -0
@@ -0,0 +1,23 @@
1
+ /**
2
+ * llm.complete procedure
3
+ *
4
+ * Send a prompt to a language model and give the text and the usage. The text is the text
5
+ * blocks of the answer, joined: the thinking blocks are not in it.
6
+ */
7
+ import { DEFAULT_LLM_SETTINGS, sendMessages, textOf } from "../../anthropic.js";
8
+ import { baseRequest, timeoutOf } from "../../request.js";
9
+ const PATH = ["llm", "complete"];
10
+ /**
11
+ * Send a prompt to a language model and give the text and the usage
12
+ */
13
+ export async function llmComplete(input, ctx, settings = DEFAULT_LLM_SETTINGS) {
14
+ const request = baseRequest(input, settings, input.system);
15
+ const answer = await sendMessages(request, settings, { path: PATH, ctx, timeoutMs: timeoutOf(input) });
16
+ return {
17
+ text: textOf(answer.content),
18
+ model: answer.model || request.model,
19
+ stopReason: answer.stopReason,
20
+ usage: answer.usage,
21
+ };
22
+ }
23
+ //# sourceMappingURL=complete.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"complete.js","sourceRoot":"","sources":["../../../src/procedures/llm/complete.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,EAAqC,MAAM,oBAAoB,CAAC;AACnH,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAG1D,MAAM,IAAI,GAAG,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;AAEjC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,KAAuB,EAAE,GAAuB,EAAE,QAAQ,GAAgB,oBAAoB;IAC9H,MAAM,OAAO,GAAG,WAAW,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3D,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACvG,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;QAC5B,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK;QACpC,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,KAAK,EAAE,MAAM,CAAC,KAAK;KACpB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { llmComplete } from "./complete.js";
2
+ export { llmStructured, MAX_RETRIES } from "./structured.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/procedures/llm/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { llmComplete } from "./complete.js";
2
+ export { llmStructured, MAX_RETRIES } from "./structured.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/procedures/llm/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * llm.structured procedure
3
+ *
4
+ * Send a prompt and a JSON Schema to a language model and give a value that the schema accepts.
5
+ * An answer that is not JSON, or that the schema refuses, gets a new try: the request then has
6
+ * the answer (its content, unchanged) and a user turn with the problems. At most 2 new tries.
7
+ */
8
+ import { type CallLimits, type LlmSettings } from "../../anthropic.js";
9
+ import type { LlmStructuredInput, LlmStructuredOutput } from "../../types.js";
10
+ /** The most new tries after an answer that is not valid. */
11
+ export declare const MAX_RETRIES = 2;
12
+ /**
13
+ * Send a prompt and a JSON Schema to a language model and give a value that the schema accepts
14
+ */
15
+ export declare function llmStructured(input: LlmStructuredInput, ctx?: CallLimits["ctx"], settings?: LlmSettings): Promise<LlmStructuredOutput>;
16
+ //# sourceMappingURL=structured.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structured.d.ts","sourceRoot":"","sources":["../../../src/procedures/llm/structured.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAkE,KAAK,UAAU,EAAE,KAAK,WAAW,EAAwB,MAAM,oBAAoB,CAAC;AAG7J,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAY,MAAM,gBAAgB,CAAC;AAIxF,4DAA4D;AAC5D,eAAO,MAAM,WAAW,IAAI,CAAC;AAoB7B;;GAEG;AACH,wBAAsB,aAAa,CAAC,KAAK,EAAE,kBAAkB,EAAE,GAAG,CAAC,EAAE,UAAU,CAAC,KAAK,CAAC,EAAE,QAAQ,GAAE,WAAkC,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAqClK"}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * llm.structured procedure
3
+ *
4
+ * Send a prompt and a JSON Schema to a language model and give a value that the schema accepts.
5
+ * An answer that is not JSON, or that the schema refuses, gets a new try: the request then has
6
+ * the answer (its content, unchanged) and a user turn with the problems. At most 2 new tries.
7
+ */
8
+ import { validateJson } from "@procedures/json";
9
+ import { LlmError } from "../../errors.js";
10
+ import { addUsage, DEFAULT_LLM_SETTINGS, NO_USAGE, sendMessages, textOf } from "../../anthropic.js";
11
+ import { baseRequest, timeoutOf } from "../../request.js";
12
+ import { constrainedSchema, parseAnswer } from "../../schema.js";
13
+ const PATH = ["llm", "structured"];
14
+ /** The most new tries after an answer that is not valid. */
15
+ export const MAX_RETRIES = 2;
16
+ /** The instruction of the system text: one JSON value and nothing else. */
17
+ function instruction(input, constrained) {
18
+ const lines = ["Answer with one JSON value that the JSON Schema below accepts. Give only the JSON value, with no other text and no code fence."];
19
+ if (!constrained)
20
+ lines.push("", "JSON Schema:", JSON.stringify(input.schema));
21
+ return lines.join("\n");
22
+ }
23
+ /** The problems of a value against the schema, as one text, or undefined for a valid value. */
24
+ function problemsOf(value, schema) {
25
+ const result = validateJson(value, schema);
26
+ if (result.valid)
27
+ return { problems: undefined, unchecked: [...result.unchecked] };
28
+ const problems = result.errors
29
+ .slice(0, 20)
30
+ .map((issue) => `${issue.pointer === "" ? "(root)" : issue.pointer}: ${issue.message}`)
31
+ .join("; ");
32
+ return { problems, unchecked: [...result.unchecked] };
33
+ }
34
+ /**
35
+ * Send a prompt and a JSON Schema to a language model and give a value that the schema accepts
36
+ */
37
+ export async function llmStructured(input, ctx, settings = DEFAULT_LLM_SETTINGS) {
38
+ const constrained = input.constrained ?? true;
39
+ const retries = Math.min(Math.max(input.retries ?? MAX_RETRIES, 0), MAX_RETRIES);
40
+ const system = [input.system, instruction(input, constrained)].filter((part) => part !== undefined && part !== "").join("\n\n");
41
+ const request = baseRequest(input, settings, system);
42
+ if (constrained) {
43
+ request.output_config = { ...request.output_config, format: { type: "json_schema", schema: constrainedSchema(input.schema) } };
44
+ }
45
+ let usage = NO_USAGE;
46
+ let lastProblem = "";
47
+ for (let attempt = 1; attempt <= retries + 1; attempt++) {
48
+ const answer = await sendMessages(request, settings, { path: PATH, ctx, timeoutMs: timeoutOf(input) });
49
+ usage = addUsage(usage, answer.usage);
50
+ if (answer.stopReason === "max_tokens") {
51
+ throw new LlmError("MAX_TOKENS", `llm.structured: the answer stopped at maxTokens (${request.max_tokens}), so the JSON is not complete`);
52
+ }
53
+ const parsed = parseAnswer(textOf(answer.content));
54
+ let problem;
55
+ if (parsed.ok) {
56
+ const { problems, unchecked } = problemsOf(parsed.value, input.schema);
57
+ if (problems === undefined) {
58
+ return { value: parsed.value, model: answer.model || request.model, attempts: attempt, usage, unchecked };
59
+ }
60
+ problem = `the schema refuses the value: ${problems}`;
61
+ }
62
+ else {
63
+ problem = parsed.problem;
64
+ }
65
+ lastProblem = problem;
66
+ // The next request continues the conversation: the answer as it came, then the problems
67
+ request.messages = [
68
+ ...request.messages,
69
+ { role: "assistant", content: answer.content },
70
+ { role: "user", content: `That answer is not valid: ${problem}. Answer again with only the JSON value.` },
71
+ ];
72
+ }
73
+ throw new LlmError("INVALID_OUTPUT", `llm.structured: no answer of ${retries + 1} gave a valid value. The last problem: ${lastProblem}`);
74
+ }
75
+ //# sourceMappingURL=structured.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structured.js","sourceRoot":"","sources":["../../../src/procedures/llm/structured.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,YAAY,EAAkB,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,EAA2D,MAAM,oBAAoB,CAAC;AAC7J,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAGjE,MAAM,IAAI,GAAG,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;AAEnC,4DAA4D;AAC5D,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC;AAE7B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AAC;QACnD,IAAI,OAAe,CAAC;QACpB,IAAI,MAAM,CAAC,EAAE,EAAE,CAAC;YACd,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;YACvE,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;gBAC3B,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;YAC5G,CAAC;YACD,OAAO,GAAG,iCAAiC,QAAQ,EAAE,CAAC;QACxD,CAAC;aAAM,CAAC;YACN,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAC3B,CAAC;QACD,WAAW,GAAG,OAAO,CAAC;QACtB,wFAAwF;QACxF,OAAO,CAAC,QAAQ,GAAG;YACjB,GAAG,OAAO,CAAC,QAAQ;YACnB,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE;YAC9C,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,6BAA6B,OAAO,0CAA0C,EAAE;SAC1G,CAAC;IACJ,CAAC;IACD,MAAM,IAAI,QAAQ,CAAC,gBAAgB,EAAE,gCAAgC,OAAO,GAAG,CAAC,0CAA0C,WAAW,EAAE,CAAC,CAAC;AAC3I,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Importing this file registers the procedures of @procedures/llm in the global registry:
3
+ * `import "@procedures/llm/register"`. The package root registers nothing.
4
+ */
5
+ export * from "./module.js";
6
+ //# sourceMappingURL=register.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../src/register.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,cAAc,aAAa,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Importing this file registers the procedures of @procedures/llm in the global registry:
3
+ * `import "@procedures/llm/register"`. The package root registers nothing.
4
+ */
5
+ import { registerLlmProcedures } from "./module.js";
6
+ export * from "./module.js";
7
+ registerLlmProcedures();
8
+ //# sourceMappingURL=register.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.js","sourceRoot":"","sources":["../src/register.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEpD,cAAc,aAAa,CAAC;AAE5B,qBAAqB,EAAE,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The request of the fields that both procedures take (`LlmRequestInput`).
3
+ */
4
+ import { type LlmSettings, type MessagesRequest } from "./anthropic.js";
5
+ import type { LlmRequestInput } from "./types.js";
6
+ /** This function gives the body of a request: the model, the limits, the system text and the user text. */
7
+ export declare function baseRequest(input: LlmRequestInput, settings: LlmSettings, system: string | undefined): MessagesRequest;
8
+ /** The time limit of a call. */
9
+ export declare function timeoutOf(input: LlmRequestInput): number;
10
+ //# sourceMappingURL=request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../src/request.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAA0C,KAAK,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAChH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,2GAA2G;AAC3G,wBAAgB,WAAW,CAAC,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,eAAe,CAWtH;AAED,gCAAgC;AAChC,wBAAgB,SAAS,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,CAExD"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The request of the fields that both procedures take (`LlmRequestInput`).
3
+ */
4
+ import { DEFAULT_MAX_TOKENS, DEFAULT_TIMEOUT_MS } from "./anthropic.js";
5
+ /** This function gives the body of a request: the model, the limits, the system text and the user text. */
6
+ export function baseRequest(input, settings, system) {
7
+ const request = {
8
+ model: input.model ?? settings.defaultModel,
9
+ max_tokens: input.maxTokens ?? DEFAULT_MAX_TOKENS,
10
+ messages: [{ role: "user", content: input.prompt }],
11
+ };
12
+ if (system !== undefined && system !== "")
13
+ request.system = system;
14
+ if (input.temperature !== undefined)
15
+ request.temperature = input.temperature;
16
+ if (input.effort !== undefined)
17
+ request.output_config = { effort: input.effort };
18
+ if (input.fallback ?? settings.fallback)
19
+ request.fallbacks = "default";
20
+ return request;
21
+ }
22
+ /** The time limit of a call. */
23
+ export function timeoutOf(input) {
24
+ return input.timeoutMs ?? DEFAULT_TIMEOUT_MS;
25
+ }
26
+ //# sourceMappingURL=request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.js","sourceRoot":"","sources":["../src/request.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAA0C,MAAM,gBAAgB,CAAC;AAGhH,2GAA2G;AAC3G,MAAM,UAAU,WAAW,CAAC,KAAsB,EAAE,QAAqB,EAAE,MAA0B;IACnG,MAAM,OAAO,GAAoB;QAC/B,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,QAAQ,CAAC,YAAY;QAC3C,UAAU,EAAE,KAAK,CAAC,SAAS,IAAI,kBAAkB;QACjD,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;KACpD,CAAC;IACF,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,EAAE;QAAE,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;IACnE,IAAI,KAAK,CAAC,WAAW,KAAK,SAAS;QAAE,OAAO,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;IAC7E,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS;QAAE,OAAO,CAAC,aAAa,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;IACjF,IAAI,KAAK,CAAC,QAAQ,IAAI,QAAQ,CAAC,QAAQ;QAAE,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;IACvE,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,gCAAgC;AAChC,MAAM,UAAU,SAAS,CAAC,KAAsB;IAC9C,OAAO,KAAK,CAAC,SAAS,IAAI,kBAAkB,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * The JSON Schema of `llm.structured`: the schema that the API gets, and the parse of an answer.
3
+ *
4
+ * The structured outputs of the API support a subset of JSON Schema. The API refuses the
5
+ * numerical constraints, the string lengths, the array constraints and an `additionalProperties`
6
+ * other than `false`. `constrainedSchema()` removes those keywords, as the Anthropic SDKs do. The
7
+ * procedure examines the full schema after the answer, so the removed keywords still apply.
8
+ */
9
+ /** The keywords that the structured outputs of the API do not support. */
10
+ export declare const UNSUPPORTED_KEYWORDS: readonly string[];
11
+ /**
12
+ * This function gives a copy of a schema for the structured outputs of the API: without the
13
+ * unsupported keywords, and with `additionalProperties: false` on each object. Without its
14
+ * constraints, the copy can accept a value that the full schema refuses. Thus the procedure
15
+ * examines each answer against the full schema.
16
+ */
17
+ export declare function constrainedSchema(schema: unknown): unknown;
18
+ /** The result of the parse of an answer. */
19
+ export type ParsedAnswer = {
20
+ readonly ok: true;
21
+ readonly value: unknown;
22
+ } | {
23
+ readonly ok: false;
24
+ readonly problem: string;
25
+ };
26
+ /**
27
+ * This function parses the text of an answer as one JSON value. It removes a code fence around
28
+ * the value (` ```json ... ``` `), because a model can add one without the constraint.
29
+ */
30
+ export declare function parseAnswer(text: string): ParsedAnswer;
31
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,0EAA0E;AAC1E,eAAO,MAAM,oBAAoB,EAAE,SAAS,MAAM,EAgBhD,CAAC;AAiBH;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAgB1D;AAED,4CAA4C;AAC5C,MAAM,MAAM,YAAY,GAAG;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7H;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAUtD"}
package/dist/schema.js ADDED
@@ -0,0 +1,86 @@
1
+ /**
2
+ * The JSON Schema of `llm.structured`: the schema that the API gets, and the parse of an answer.
3
+ *
4
+ * The structured outputs of the API support a subset of JSON Schema. The API refuses the
5
+ * numerical constraints, the string lengths, the array constraints and an `additionalProperties`
6
+ * other than `false`. `constrainedSchema()` removes those keywords, as the Anthropic SDKs do. The
7
+ * procedure examines the full schema after the answer, so the removed keywords still apply.
8
+ */
9
+ /** The keywords that the structured outputs of the API do not support. */
10
+ export const UNSUPPORTED_KEYWORDS = Object.freeze([
11
+ "minimum",
12
+ "maximum",
13
+ "exclusiveMinimum",
14
+ "exclusiveMaximum",
15
+ "multipleOf",
16
+ "minLength",
17
+ "maxLength",
18
+ "minItems",
19
+ "maxItems",
20
+ "uniqueItems",
21
+ "contains",
22
+ "minContains",
23
+ "maxContains",
24
+ "minProperties",
25
+ "maxProperties",
26
+ ]);
27
+ /** The keywords whose value is one schema. */
28
+ const ONE_SCHEMA = ["items", "additionalItems", "not", "if", "then", "else", "propertyNames"];
29
+ /** The keywords whose value is a list of schemas. */
30
+ const SCHEMA_LIST = ["anyOf", "allOf", "oneOf", "prefixItems", "items"];
31
+ /** The keywords whose value is a map of schemas. */
32
+ const SCHEMA_MAP = ["properties", "patternProperties", "$defs", "definitions"];
33
+ const isRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
34
+ /** True when a schema describes an object. */
35
+ function isObjectSchema(schema) {
36
+ const type = schema["type"];
37
+ return type === "object" || (Array.isArray(type) && type.includes("object")) || (type === undefined && isRecord(schema["properties"]));
38
+ }
39
+ /**
40
+ * This function gives a copy of a schema for the structured outputs of the API: without the
41
+ * unsupported keywords, and with `additionalProperties: false` on each object. Without its
42
+ * constraints, the copy can accept a value that the full schema refuses. Thus the procedure
43
+ * examines each answer against the full schema.
44
+ */
45
+ export function constrainedSchema(schema) {
46
+ if (Array.isArray(schema))
47
+ return schema.map(constrainedSchema);
48
+ if (!isRecord(schema))
49
+ return schema;
50
+ const copy = {};
51
+ for (const [keyword, value] of Object.entries(schema)) {
52
+ if (UNSUPPORTED_KEYWORDS.includes(keyword))
53
+ continue;
54
+ if (SCHEMA_MAP.includes(keyword) && isRecord(value)) {
55
+ copy[keyword] = Object.fromEntries(Object.entries(value).map(([name, sub]) => [name, constrainedSchema(sub)]));
56
+ }
57
+ else if (SCHEMA_LIST.includes(keyword) || ONE_SCHEMA.includes(keyword)) {
58
+ copy[keyword] = constrainedSchema(value);
59
+ }
60
+ else {
61
+ copy[keyword] = value;
62
+ }
63
+ }
64
+ if (isObjectSchema(copy))
65
+ copy["additionalProperties"] = false;
66
+ return copy;
67
+ }
68
+ /**
69
+ * This function parses the text of an answer as one JSON value. It removes a code fence around
70
+ * the value (` ```json ... ``` `), because a model can add one without the constraint.
71
+ */
72
+ export function parseAnswer(text) {
73
+ let body = text.trim();
74
+ const fence = /^```[a-zA-Z0-9_-]*\s*\n([\s\S]*?)\n?```$/.exec(body);
75
+ if (fence)
76
+ body = fence[1].trim();
77
+ if (body === "")
78
+ return { ok: false, problem: "the answer is empty" };
79
+ try {
80
+ return { ok: true, value: JSON.parse(body) };
81
+ }
82
+ catch (error) {
83
+ return { ok: false, problem: `the answer is not JSON (${error instanceof Error ? error.message : String(error)})` };
84
+ }
85
+ }
86
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,0EAA0E;AAC1E,MAAM,CAAC,MAAM,oBAAoB,GAAsB,MAAM,CAAC,MAAM,CAAC;IACnE,SAAS;IACT,SAAS;IACT,kBAAkB;IAClB,kBAAkB;IAClB,YAAY;IACZ,WAAW;IACX,WAAW;IACX,UAAU;IACV,UAAU;IACV,aAAa;IACb,UAAU;IACV,aAAa;IACb,aAAa;IACb,eAAe;IACf,eAAe;CAChB,CAAC,CAAC;AAEH,8CAA8C;AAC9C,MAAM,UAAU,GAAG,CAAC,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,CAAC,CAAC;AAC9F,qDAAqD;AACrD,MAAM,WAAW,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;AACxE,oDAAoD;AACpD,MAAM,UAAU,GAAG,CAAC,YAAY,EAAE,mBAAmB,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;AAE/E,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAoC,EAAE,CAAC,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAE5I,8CAA8C;AAC9C,SAAS,cAAc,CAAC,MAA+B;IACrD,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IAC5B,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,K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C;AACd,CAAC;AAKD;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,IAAI,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IACvB,MAAM,KAAK,GAAG,0CAA0C,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpE,IAAI,KAAK;QAAE,IAAI,GAAG,KAAK,CAAC,CAAC,CAAE,CAAC,IAAI,EAAE,CAAC;IACnC,IAAI,IAAI,KAAK,EAAE;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,qBAAqB,EAAE,CAAC;IACtE,IAAI,CAAC;QACH,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAY,EAAE,CAAC;IAC1D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,2BAA2B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;IACtH,CAAC;AACH,CAAC"}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Type definitions of the procedures of this package
3
+ *
4
+ * mark procedure new adds the types of each new procedure here. The zod schemas are in
5
+ * `module.ts`: an exported schema needs a written type (isolatedDeclarations).
6
+ */
7
+ /** The effort of the model: how much it thinks and how many tokens it spends. */
8
+ export type LlmEffort = "low" | "medium" | "high" | "xhigh" | "max";
9
+ /** The tokens of a call. */
10
+ export interface LlmUsage {
11
+ /** The tokens of the input that the cache did not have. */
12
+ inputTokens: number;
13
+ /** The tokens of the output, with the tokens of the thinking. */
14
+ outputTokens: number;
15
+ /** The tokens of the input that came from the cache. */
16
+ cacheReadInputTokens: number;
17
+ /** The tokens of the input that went into the cache. */
18
+ cacheCreationInputTokens: number;
19
+ }
20
+ /** The fields of a request that each procedure takes. */
21
+ export interface LlmRequestInput {
22
+ /** The text of the user. */
23
+ prompt: string;
24
+ /** The system text: the instructions to the model. */
25
+ system?: string | undefined;
26
+ /** The model. The default is the model of the module (`claude-sonnet-5-5`). */
27
+ model?: string | undefined;
28
+ /** The most tokens of the output, with the thinking. The default is 16000. */
29
+ maxTokens?: number | undefined;
30
+ /** The temperature, from 0 to 1. Some models accept only the default, and the API refuses another value. */
31
+ temperature?: number | undefined;
32
+ /** The effort of the model. Without it, the model uses its default. */
33
+ effort?: LlmEffort | undefined;
34
+ /** The time limit of the call, in milliseconds. The default is 600000 (10 minutes). */
35
+ timeoutMs?: number | undefined;
36
+ /**
37
+ * True: when a safety classifier declines the request, the API runs it again on the fallback
38
+ * model that it recommends. The default is the option of the module (true).
39
+ */
40
+ fallback?: boolean | undefined;
41
+ }
42
+ export type LlmCompleteInput = LlmRequestInput;
43
+ export interface LlmCompleteOutput {
44
+ /** The text of the answer: the text blocks, joined. */
45
+ text: string;
46
+ /** The model that answered. After a fallback, it is the fallback model. */
47
+ model: string;
48
+ /** Why the model stopped: `end_turn`, `max_tokens`, `stop_sequence` or another reason of the API. */
49
+ stopReason: string;
50
+ usage: LlmUsage;
51
+ }
52
+ export interface LlmStructuredInput extends LlmRequestInput {
53
+ /** The JSON Schema of the value. */
54
+ schema: Record<string, unknown>;
55
+ /**
56
+ * True (default): the API constrains the output to the schema (structured outputs). The
57
+ * procedure removes the keywords that the API does not support, and examines them after the
58
+ * answer. False: the system text gives the schema, and the procedure examines the answer.
59
+ */
60
+ constrained?: boolean | undefined;
61
+ /** The number of new tries after an answer that is not valid: 0 to 2. The default is 2. */
62
+ retries?: number | undefined;
63
+ }
64
+ export interface LlmStructuredOutput {
65
+ /** The value: the schema accepts it. */
66
+ value: unknown;
67
+ /** The model that gave the value. */
68
+ model: string;
69
+ /** The number of calls to the model: 1 to 3. */
70
+ attempts: number;
71
+ /** The tokens of all the calls. */
72
+ usage: LlmUsage;
73
+ /** The keywords of the schema that the check does not examine, or examines only in part. */
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ACnB,KAAK,EAAE,QAAQ,CAAC;CACjB;AAMD,MAAM,WAAW,kBAAmB,SAAQ,eAAe;IACzD,oCAAoC;IACpC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAClC,2FAA2F;IAC3F,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B;AAED,MAAM,WAAW,mBAAmB;IAClC,wCAAwC;IACxC,KAAK,EAAE,OAAO,CAAC;IACf,qCAAqC;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,QAAQ,EAAE,MAAM,CAAC;IACjB,mCAAmC;IACnC,KAAK,EAAE,QAAQ,CAAC;IAChB,4FAA4F;IAC5F,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB"}
package/dist/types.js ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Type definitions of the procedures of this package
3
+ *
4
+ * mark procedure new adds the types of each new procedure here. The zod schemas are in
5
+ * `module.ts`: an exported schema needs a written type (isolatedDeclarations).
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
package/package.json CHANGED
@@ -1,6 +1,80 @@
1
1
  {
2
+ "$schema": "https://json.schemastore.org/package",
2
3
  "name": "@procedures/llm",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
4
+ "version": "0.3.0",
5
+ "description": "A language model as procedures: a completion and a structured answer that a JSON Schema accepts, through the Anthropic Messages API, with the key from the environment.",
6
+ "keywords": [
7
+ "procedures",
8
+ "llm",
9
+ "anthropic",
10
+ "claude",
11
+ "structured-output",
12
+ "json-schema"
13
+ ],
14
+ "homepage": "https://mark1russell7.github.io/client/",
15
+ "bugs": {
16
+ "url": "https://github.com/mark1russell7/client/issues"
17
+ },
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/mark1russell7/client.git",
21
+ "directory": "packages/llm"
22
+ },
23
+ "license": "MIT",
24
+ "author": "Mark Russell (https://github.com/mark1russell7)",
25
+ "type": "module",
26
+ "main": "./dist/index.js",
27
+ "types": "./dist/index.d.ts",
28
+ "exports": {
29
+ ".": {
30
+ "types": "./dist/index.d.ts",
31
+ "import": "./dist/index.js"
32
+ },
33
+ "./module": {
34
+ "types": "./dist/module.d.ts",
35
+ "import": "./dist/module.js"
36
+ },
37
+ "./register": {
38
+ "types": "./dist/register.d.ts",
39
+ "import": "./dist/register.js"
40
+ }
41
+ },
42
+ "files": [
43
+ "dist",
44
+ "src",
45
+ "!src/**/*.test.ts",
46
+ "!src/**/*.test.tsx",
47
+ "!src/**/__tests__",
48
+ "CHANGELOG.md"
49
+ ],
50
+ "sideEffects": [
51
+ "./dist/register.js"
52
+ ],
53
+ "devDependencies": {
54
+ "@mark1russell7/cue": "^1.0.0",
55
+ "typescript": "^7.0.2",
56
+ "vitest": "^5.0.3"
57
+ },
58
+ "engines": {
59
+ "node": ">=22"
60
+ },
61
+ "client": {
62
+ "procedures": "./dist/register.js"
63
+ },
64
+ "dependencies": {
65
+ "@procedures/client": "0.3.0",
66
+ "@procedures/json": "0.3.0",
67
+ "zod": "^4.6.5"
68
+ },
69
+ "publishConfig": {
70
+ "access": "public",
71
+ "provenance": true
72
+ },
73
+ "scripts": {
74
+ "build": "tsc -b",
75
+ "typecheck": "tsc --noEmit",
76
+ "clean": "rm -rf dist .tsbuildinfo",
77
+ "test": "vitest run",
78
+ "test:watch": "vitest"
79
+ }
6
80
  }