@procedures/llm 0.4.0 → 0.5.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/CHANGELOG.md +27 -0
- package/README.md +114 -9
- package/dist/.tsbuildinfo +1 -1
- package/dist/anthropic.d.ts +64 -5
- package/dist/anthropic.d.ts.map +1 -1
- package/dist/anthropic.js +109 -50
- package/dist/anthropic.js.map +1 -1
- package/dist/errors.d.ts +15 -8
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +4 -1
- package/dist/errors.js.map +1 -1
- package/dist/events.d.ts +21 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +218 -0
- package/dist/events.js.map +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/module.d.ts +8 -2
- package/dist/module.d.ts.map +1 -1
- package/dist/module.js +127 -12
- package/dist/module.js.map +1 -1
- package/dist/procedures/llm/complete.d.ts +9 -3
- package/dist/procedures/llm/complete.d.ts.map +1 -1
- package/dist/procedures/llm/complete.js +50 -10
- package/dist/procedures/llm/complete.js.map +1 -1
- package/dist/procedures/llm/index.d.ts +1 -0
- package/dist/procedures/llm/index.d.ts.map +1 -1
- package/dist/procedures/llm/index.js +1 -0
- package/dist/procedures/llm/index.js.map +1 -1
- package/dist/procedures/llm/stream.d.ts +14 -0
- package/dist/procedures/llm/stream.d.ts.map +1 -0
- package/dist/procedures/llm/stream.js +20 -0
- package/dist/procedures/llm/stream.js.map +1 -0
- package/dist/procedures/llm/structured.d.ts +1 -1
- package/dist/procedures/llm/structured.d.ts.map +1 -1
- package/dist/procedures/llm/structured.js +6 -4
- package/dist/procedures/llm/structured.js.map +1 -1
- package/dist/request.d.ts +15 -4
- package/dist/request.d.ts.map +1 -1
- package/dist/request.js +47 -2
- package/dist/request.js.map +1 -1
- package/dist/retry.d.ts +45 -0
- package/dist/retry.d.ts.map +1 -0
- package/dist/retry.js +106 -0
- package/dist/retry.js.map +1 -0
- package/dist/tools.d.ts +50 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +162 -0
- package/dist/tools.js.map +1 -0
- package/dist/types.d.ts +138 -4
- package/dist/types.d.ts.map +1 -1
- package/package.json +9 -5
- package/src/anthropic.ts +149 -49
- package/src/errors.ts +17 -5
- package/src/events.ts +218 -0
- package/src/index.ts +5 -2
- package/src/module.ts +143 -12
- package/src/procedures/llm/complete.ts +53 -12
- package/src/procedures/llm/index.ts +1 -0
- package/src/procedures/llm/stream.ts +23 -0
- package/src/procedures/llm/structured.ts +6 -4
- package/src/request.ts +47 -4
- package/src/retry.ts +110 -0
- package/src/tools.ts +178 -0
- package/src/types.ts +148 -4
package/dist/tools.js
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Procedures as tools of the model (`llm.complete` with `procedures`).
|
|
3
|
+
*
|
|
4
|
+
* The caller names the procedures. `llm.complete` gives the model a tool for each one. The name
|
|
5
|
+
* is the key with `_` in place of each `.`. The description and the input schema come from the
|
|
6
|
+
* procedure. When the model asks for a tool, `llm.complete` calls the procedure through
|
|
7
|
+
* `ctx.client` with the input of the model. The output goes back as a `tool_result`.
|
|
8
|
+
*
|
|
9
|
+
* The procedure `llm.complete` is data-driven (`markDataDriven`): its input chooses its callees.
|
|
10
|
+
* Thus the admission of the host examines each nested call: its capability and its expose rule.
|
|
11
|
+
* Before the first request, the same rules examine each named procedure, so a refused tool costs
|
|
12
|
+
* no request.
|
|
13
|
+
*/
|
|
14
|
+
import { capabilityRefusal, InvocationError, jsonSchemaOf, PROCEDURE_REGISTRY, } from "@procedures/client";
|
|
15
|
+
import { LlmError } from "./errors.js";
|
|
16
|
+
import { deadlineLeft } from "./retry.js";
|
|
17
|
+
/** The default of `maxRounds`: the most requests to the model in one call of `llm.complete`. */
|
|
18
|
+
export const DEFAULT_MAX_ROUNDS = 8;
|
|
19
|
+
/** The most characters of the output of a tool that the model gets. */
|
|
20
|
+
export const MAX_TOOL_RESULT_CHARS = 200_000;
|
|
21
|
+
/** The names that the API accepts for a tool. */
|
|
22
|
+
const TOOL_NAME = /^[a-zA-Z0-9_-]{1,128}$/;
|
|
23
|
+
/** The reasons of a refusal of the capability. Such a refusal stops the call: the model cannot change it. */
|
|
24
|
+
const CAPABILITY_REASONS = new Set(["effects-undeclared", "effects-exceeded", "clearance", "deadline"]);
|
|
25
|
+
/** The codes of a refusal of the host. Such a refusal stops the call. */
|
|
26
|
+
const HOST_REFUSALS = new Set(["NOT_EXPOSED", "NOT_DECLARED", "NOT_FOUND", "NO_HANDLER"]);
|
|
27
|
+
/** The name of the tool of a procedure: the key with `_` in place of each `.`. */
|
|
28
|
+
export function toolNameOf(key) {
|
|
29
|
+
return key.split(".").join("_");
|
|
30
|
+
}
|
|
31
|
+
/** The input schema of a procedure as a tool: an object schema, or a `BAD_TOOL` error. */
|
|
32
|
+
function inputSchemaOf(procedure, key) {
|
|
33
|
+
const schema = jsonSchemaOf(procedure.input);
|
|
34
|
+
if (schema === undefined || Object.keys(schema).length === 0)
|
|
35
|
+
return { type: "object" };
|
|
36
|
+
if (schema["type"] === "object")
|
|
37
|
+
return schema;
|
|
38
|
+
throw new LlmError("BAD_TOOL", `llm: the input of ${key} is not an object, so the model cannot use it as a tool`);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* This function gives the tools of the procedures that the input names. It throws before a
|
|
42
|
+
* request goes out. It throws for a refusal of the expose rule or of the capability. It also
|
|
43
|
+
* throws for a procedure that is not in the registry, and for a stream without an end.
|
|
44
|
+
*/
|
|
45
|
+
export function procedureTools(keys, ctx, caller) {
|
|
46
|
+
if (keys.length === 0)
|
|
47
|
+
return [];
|
|
48
|
+
if (ctx?.client === undefined)
|
|
49
|
+
throw new LlmError("BAD_TOOL", `${caller.join(".")}: procedure tools need the context of a procedure call`);
|
|
50
|
+
const registry = ctx.registry ?? PROCEDURE_REGISTRY;
|
|
51
|
+
const seen = new Set();
|
|
52
|
+
return keys.map((key) => {
|
|
53
|
+
if (seen.has(key))
|
|
54
|
+
throw new LlmError("BAD_TOOL", `llm: the input names the procedure ${key} two times`);
|
|
55
|
+
seen.add(key);
|
|
56
|
+
const path = key.split(".");
|
|
57
|
+
// The expose rule first: a refused path tells nothing about the procedure
|
|
58
|
+
if (ctx.expose !== undefined && !ctx.expose(path)) {
|
|
59
|
+
throw new InvocationError("NOT_EXPOSED", `Procedure not exposed: ${key}. ${caller.join(".")} runs the procedures that its input names, so it can call only the procedures that this host exposes.`, path);
|
|
60
|
+
}
|
|
61
|
+
const procedure = registry.get(path);
|
|
62
|
+
if (procedure === undefined)
|
|
63
|
+
throw new InvocationError("NOT_FOUND", `No procedure at ${key}`, path);
|
|
64
|
+
if (procedure.handler === undefined)
|
|
65
|
+
throw new InvocationError("NO_HANDLER", `The procedure ${key} has no handler`, path);
|
|
66
|
+
const refusal = capabilityRefusal(procedure, ctx.capability);
|
|
67
|
+
if (refusal?.reason === "deadline")
|
|
68
|
+
throw new InvocationError("TIMEOUT", refusal.message, path);
|
|
69
|
+
if (refusal)
|
|
70
|
+
throw new InvocationError("FORBIDDEN", `${refusal.message}, so the model cannot use it as a tool`, path, refusal.reason);
|
|
71
|
+
if (procedure.metadata?.stream?.unbounded === true) {
|
|
72
|
+
throw new LlmError("BAD_TOOL", `llm: ${key} is a stream without an end, so the model cannot use it as a tool`);
|
|
73
|
+
}
|
|
74
|
+
const name = toolNameOf(key);
|
|
75
|
+
if (!TOOL_NAME.test(name))
|
|
76
|
+
throw new LlmError("BAD_TOOL", `llm: the tool name ${name} of ${key} has characters that the API refuses`);
|
|
77
|
+
const description = procedure.metadata?.description;
|
|
78
|
+
return {
|
|
79
|
+
key,
|
|
80
|
+
path,
|
|
81
|
+
param: {
|
|
82
|
+
name,
|
|
83
|
+
description: typeof description === "string" && description !== "" ? description : `The procedure ${key}`,
|
|
84
|
+
input_schema: inputSchemaOf(procedure, key),
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
/** The `tool_use` blocks of the content of an answer. */
|
|
90
|
+
export function toolUsesOf(content) {
|
|
91
|
+
const uses = [];
|
|
92
|
+
for (const block of content) {
|
|
93
|
+
if (block.type === "tool_use" && typeof block["id"] === "string" && typeof block["name"] === "string") {
|
|
94
|
+
uses.push({ id: block["id"], name: block["name"], input: block["input"] ?? {} });
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return uses;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* This function is true when an error of a nested call stops the whole call. The causes are a
|
|
101
|
+
* refusal of the host, the abort of the caller and the deadline. The model gets each other error.
|
|
102
|
+
*/
|
|
103
|
+
function stopsTheCall(error, ctx) {
|
|
104
|
+
if (!(error instanceof InvocationError))
|
|
105
|
+
return false;
|
|
106
|
+
if (HOST_REFUSALS.has(error.code))
|
|
107
|
+
return true;
|
|
108
|
+
if (error.code === "FORBIDDEN")
|
|
109
|
+
return error.reason !== undefined && CAPABILITY_REASONS.has(error.reason);
|
|
110
|
+
if (error.code === "ABORTED")
|
|
111
|
+
return ctx.signal?.aborted === true;
|
|
112
|
+
if (error.code === "TIMEOUT") {
|
|
113
|
+
const left = deadlineLeft(ctx);
|
|
114
|
+
return left !== undefined && left <= 0;
|
|
115
|
+
}
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
/** The output of a tool as the text of its `tool_result`, at most `MAX_TOOL_RESULT_CHARS` characters. */
|
|
119
|
+
function resultText(output) {
|
|
120
|
+
let text;
|
|
121
|
+
if (typeof output === "string") {
|
|
122
|
+
text = output;
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
try {
|
|
126
|
+
text = JSON.stringify(output) ?? "null";
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
text = String(output);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if (text.length <= MAX_TOOL_RESULT_CHARS)
|
|
133
|
+
return text;
|
|
134
|
+
return `${text.slice(0, MAX_TOOL_RESULT_CHARS)}\n[llm: the output has ${text.length} characters, and this result has the first ${MAX_TOOL_RESULT_CHARS}]`;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* This function runs one `tool_use` block with the procedure of its tool, through `ctx.client`.
|
|
138
|
+
* It gives the record of the call and the `tool_result` block. An error of the procedure goes to
|
|
139
|
+
* the model with `is_error: true`. A refusal of the host, the abort and the deadline stop the call.
|
|
140
|
+
*/
|
|
141
|
+
export async function runToolUse(use, tool, ctx) {
|
|
142
|
+
const base = { id: use.id, name: use.name, procedure: tool.key, input: use.input };
|
|
143
|
+
try {
|
|
144
|
+
const output = await ctx.client.call(tool.path, use.input);
|
|
145
|
+
return {
|
|
146
|
+
call: { ...base, isError: false, output },
|
|
147
|
+
result: { type: "tool_result", tool_use_id: use.id, content: resultText(output) },
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
catch (error) {
|
|
151
|
+
if (stopsTheCall(error, ctx))
|
|
152
|
+
throw error;
|
|
153
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
154
|
+
const code = error?.code;
|
|
155
|
+
const content = typeof code === "string" ? `${code}: ${message}` : message;
|
|
156
|
+
return {
|
|
157
|
+
call: { ...base, isError: true, error: content },
|
|
158
|
+
result: { type: "tool_result", tool_use_id: use.id, content: resultText(content), is_error: true },
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,kBAAkB,GAInB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MA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AAC,CAAC,CAAC,GAAG,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;QAC3E,OAAO;YACL,IAAI,EAAE,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE;YAChD,MAAM,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,WAAW,EAAE,GAAG,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;SACnG,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export interface LlmRequestInput {
|
|
|
31
31
|
temperature?: number | undefined;
|
|
32
32
|
/** The effort of the model. Without it, the model uses its default. */
|
|
33
33
|
effort?: LlmEffort | undefined;
|
|
34
|
-
/** The time limit of the
|
|
34
|
+
/** The time limit of each request to the API, in milliseconds. The default is 600000 (10 minutes). */
|
|
35
35
|
timeoutMs?: number | undefined;
|
|
36
36
|
/**
|
|
37
37
|
* True: when a safety classifier declines the request, the API runs it again on the fallback
|
|
@@ -39,15 +39,97 @@ export interface LlmRequestInput {
|
|
|
39
39
|
*/
|
|
40
40
|
fallback?: boolean | undefined;
|
|
41
41
|
}
|
|
42
|
-
|
|
42
|
+
/** A tool that the model can use: the API gets its name, its description and the schema of its input. */
|
|
43
|
+
export interface LlmTool {
|
|
44
|
+
/** The name of the tool: 1 to 128 letters, digits, `_` and `-`. */
|
|
45
|
+
name: string;
|
|
46
|
+
/** The text that tells the model what the tool does and when to use it. */
|
|
47
|
+
description?: string | undefined;
|
|
48
|
+
/** The JSON Schema of the input of the tool. Its type is `object`. */
|
|
49
|
+
inputSchema: Record<string, unknown>;
|
|
50
|
+
/** True: the API makes the input of each call agree with the schema (strict tool use). */
|
|
51
|
+
strict?: boolean | undefined;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* How the model uses the tools. `auto` (the default): the model decides. `any`: the model uses a
|
|
55
|
+
* tool. `tool`: the model uses the tool that `name` gives. `none`: the model uses no tool.
|
|
56
|
+
* Some models refuse `any` and `tool` with a 400 error: Claude Sonnet 5.5, Claude Opus 5.5 and
|
|
57
|
+
* Claude Fable 5.1.
|
|
58
|
+
*/
|
|
59
|
+
export type LlmToolChoice = {
|
|
60
|
+
type: "auto";
|
|
61
|
+
disableParallelToolUse?: boolean | undefined;
|
|
62
|
+
} | {
|
|
63
|
+
type: "any";
|
|
64
|
+
disableParallelToolUse?: boolean | undefined;
|
|
65
|
+
} | {
|
|
66
|
+
type: "tool";
|
|
67
|
+
name: string;
|
|
68
|
+
disableParallelToolUse?: boolean | undefined;
|
|
69
|
+
} | {
|
|
70
|
+
type: "none";
|
|
71
|
+
};
|
|
72
|
+
/** The tool fields of `llm.complete` and `llm.stream`. */
|
|
73
|
+
export interface LlmToolInput {
|
|
74
|
+
/** The tools that the model can use. The caller runs them: the output gives each `tool_use` block. */
|
|
75
|
+
tools?: LlmTool[] | undefined;
|
|
76
|
+
/** How the model uses the tools (`tool_choice`). */
|
|
77
|
+
toolChoice?: LlmToolChoice | undefined;
|
|
78
|
+
/** The number of new tries after an error with `retryable: true`: 0 to 10. The default is the option of the module (2). */
|
|
79
|
+
retries?: number | undefined;
|
|
80
|
+
}
|
|
81
|
+
/** A `tool_use` block of an answer: a call of a tool that the model asks for. */
|
|
82
|
+
export interface LlmToolUse {
|
|
83
|
+
/** The ID of the block. A `tool_result` gives it back. */
|
|
84
|
+
id: string;
|
|
85
|
+
/** The name of the tool. */
|
|
86
|
+
name: string;
|
|
87
|
+
/** The input of the call. */
|
|
88
|
+
input: unknown;
|
|
89
|
+
}
|
|
90
|
+
/** A call of a procedure tool that `llm.complete` made for the model. */
|
|
91
|
+
export interface LlmToolCall {
|
|
92
|
+
/** The ID of the `tool_use` block. */
|
|
93
|
+
id: string;
|
|
94
|
+
/** The name of the tool. */
|
|
95
|
+
name: string;
|
|
96
|
+
/** The key of the procedure, for example `weather.current`. */
|
|
97
|
+
procedure: string;
|
|
98
|
+
/** The input that the model gave. */
|
|
99
|
+
input: unknown;
|
|
100
|
+
/** True when the procedure failed. The model got the error as a `tool_result` with `is_error: true`. */
|
|
101
|
+
isError: boolean;
|
|
102
|
+
/** The output of the procedure. */
|
|
103
|
+
output?: unknown;
|
|
104
|
+
/** The message of the error of the procedure. */
|
|
105
|
+
error?: string | undefined;
|
|
106
|
+
}
|
|
107
|
+
export interface LlmCompleteInput extends LlmRequestInput, LlmToolInput {
|
|
108
|
+
/**
|
|
109
|
+
* The keys of the procedures that the model can use as tools, for example `weather.current`.
|
|
110
|
+
* `llm.complete` calls each one through `ctx.client`, sends the result to the model, and asks again.
|
|
111
|
+
*/
|
|
112
|
+
procedures?: string[] | undefined;
|
|
113
|
+
/** The most requests to the model in one call: 1 to 64. The default is 8. */
|
|
114
|
+
maxRounds?: number | undefined;
|
|
115
|
+
}
|
|
43
116
|
export interface LlmCompleteOutput {
|
|
44
|
-
/** The text of the answer:
|
|
117
|
+
/** The text of the last answer: its text blocks, joined. */
|
|
45
118
|
text: string;
|
|
46
119
|
/** The model that answered. After a fallback, it is the fallback model. */
|
|
47
120
|
model: string;
|
|
48
|
-
/** Why the model stopped: `end_turn`, `max_tokens`, `stop_sequence` or another reason of the API. */
|
|
121
|
+
/** Why the model stopped: `end_turn`, `max_tokens`, `stop_sequence`, `tool_use` or another reason of the API. */
|
|
49
122
|
stopReason: string;
|
|
123
|
+
/** The tokens of all the requests. */
|
|
50
124
|
usage: LlmUsage;
|
|
125
|
+
/** The `tool_use` blocks of the last answer that no procedure ran. */
|
|
126
|
+
toolUses: LlmToolUse[];
|
|
127
|
+
/** The calls of procedure tools, in their sequence. */
|
|
128
|
+
toolCalls: LlmToolCall[];
|
|
129
|
+
/** The number of requests to the model. */
|
|
130
|
+
rounds: number;
|
|
131
|
+
/** True when `maxRounds` stopped the loop before the model stopped. */
|
|
132
|
+
roundLimit: boolean;
|
|
51
133
|
}
|
|
52
134
|
export interface LlmStructuredInput extends LlmRequestInput {
|
|
53
135
|
/** The JSON Schema of the value. */
|
|
@@ -60,6 +142,8 @@ export interface LlmStructuredInput extends LlmRequestInput {
|
|
|
60
142
|
constrained?: boolean | undefined;
|
|
61
143
|
/** The number of new tries after an answer that is not valid: 0 to 2. The default is 2. */
|
|
62
144
|
retries?: number | undefined;
|
|
145
|
+
/** The number of new tries of a request after an error with `retryable: true`: 0 to 10. The default is the option of the module (2). */
|
|
146
|
+
requestRetries?: number | undefined;
|
|
63
147
|
}
|
|
64
148
|
export interface LlmStructuredOutput {
|
|
65
149
|
/** The value: the schema accepts it. */
|
|
@@ -73,4 +157,54 @@ export interface LlmStructuredOutput {
|
|
|
73
157
|
/** The keywords of the schema that the check does not examine, or examines only in part. */
|
|
74
158
|
unchecked: string[];
|
|
75
159
|
}
|
|
160
|
+
export interface LlmStreamInput extends LlmRequestInput, LlmToolInput {
|
|
161
|
+
}
|
|
162
|
+
/** The first item of a stream: the event `message_start`. */
|
|
163
|
+
export interface LlmStreamStart {
|
|
164
|
+
type: "start";
|
|
165
|
+
/** The ID of the message. */
|
|
166
|
+
id: string;
|
|
167
|
+
/** The model that answers. */
|
|
168
|
+
model: string;
|
|
169
|
+
/** The tokens at the start: the tokens of the input. */
|
|
170
|
+
usage: LlmUsage;
|
|
171
|
+
}
|
|
172
|
+
/** A part of the text of a text block: the delta `text_delta`. */
|
|
173
|
+
export interface LlmStreamText {
|
|
174
|
+
type: "text";
|
|
175
|
+
/** The index of the content block. */
|
|
176
|
+
index: number;
|
|
177
|
+
/** The new text. */
|
|
178
|
+
text: string;
|
|
179
|
+
}
|
|
180
|
+
/** A complete `tool_use` block, after its event `content_block_stop`. */
|
|
181
|
+
export interface LlmStreamToolUse {
|
|
182
|
+
type: "tool_use";
|
|
183
|
+
/** The index of the content block. */
|
|
184
|
+
index: number;
|
|
185
|
+
/** The ID of the block. */
|
|
186
|
+
id: string;
|
|
187
|
+
/** The name of the tool. */
|
|
188
|
+
name: string;
|
|
189
|
+
/** The input of the call, or null when its JSON is not complete. */
|
|
190
|
+
input: unknown;
|
|
191
|
+
/** The JSON text of an input that does not parse: for example, the output stopped at `maxTokens`. */
|
|
192
|
+
partialJson?: string | undefined;
|
|
193
|
+
}
|
|
194
|
+
/** The last item of a stream: the event `message_stop`, with the stop reason and the usage. */
|
|
195
|
+
export interface LlmStreamStop {
|
|
196
|
+
type: "stop";
|
|
197
|
+
/** The model that answered. After a fallback, it is the fallback model. */
|
|
198
|
+
model: string;
|
|
199
|
+
/** Why the model stopped. */
|
|
200
|
+
stopReason: string;
|
|
201
|
+
/** The tokens of the call. */
|
|
202
|
+
usage: LlmUsage;
|
|
203
|
+
/** The text of the answer: all the text deltas, joined. */
|
|
204
|
+
text: string;
|
|
205
|
+
/** The `tool_use` blocks of the answer. */
|
|
206
|
+
toolUses: LlmToolUse[];
|
|
207
|
+
}
|
|
208
|
+
/** One item of `llm.stream`. */
|
|
209
|
+
export type LlmStreamOutput = LlmStreamStart | LlmStreamText | LlmStreamToolUse | LlmStreamStop;
|
|
76
210
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,iFAAiF;AACjF,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;AAEpE,4BAA4B;AAC5B,MAAM,WAAW,QAAQ;IACvB,2DAA2D;IAC3D,WAAW,EAAE,MAAM,CAAC;IACpB,iEAAiE;IACjE,YAAY,EAAE,MAAM,CAAC;IACrB,wDAAwD;IACxD,oBAAoB,EAAE,MAAM,CAAC;IAC7B,wDAAwD;IACxD,wBAAwB,EAAE,MAAM,CAAC;CAClC;AAED,yDAAyD;AACzD,MAAM,WAAW,eAAe;IAC9B,4BAA4B;IAC5B,MAAM,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C3D,IAAI,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,QAAQ,EAAE,UAAU,EAAE,CAAC;CACxB;AAED,gCAAgC;AAChC,MAAM,MAAM,eAAe,GAAG,cAAc,GAAG,aAAa,GAAG,gBAAgB,GAAG,aAAa,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "@procedures/llm",
|
|
4
|
-
"version": "0.
|
|
5
|
-
"description": "A language model as procedures: a completion
|
|
4
|
+
"version": "0.5.0",
|
|
5
|
+
"description": "A language model as procedures: a completion with tools, a stream of the answer and a structured answer, through the Anthropic Messages API, with the key from the environment.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"procedures",
|
|
8
8
|
"llm",
|
|
9
9
|
"anthropic",
|
|
10
10
|
"claude",
|
|
11
11
|
"structured-output",
|
|
12
|
-
"json-schema"
|
|
12
|
+
"json-schema",
|
|
13
|
+
"streaming",
|
|
14
|
+
"tool-use"
|
|
13
15
|
],
|
|
14
16
|
"homepage": "https://mark1russell7.github.io/client/",
|
|
15
17
|
"bugs": {
|
|
@@ -62,8 +64,10 @@
|
|
|
62
64
|
"procedures": "./dist/register.js"
|
|
63
65
|
},
|
|
64
66
|
"dependencies": {
|
|
65
|
-
"@
|
|
66
|
-
"@procedures/
|
|
67
|
+
"@mark1russell7/service": "^0.4.1",
|
|
68
|
+
"@procedures/client": "0.5.0",
|
|
69
|
+
"@procedures/http": "0.5.0",
|
|
70
|
+
"@procedures/json": "0.5.0",
|
|
67
71
|
"zod": "^4.6.5"
|
|
68
72
|
},
|
|
69
73
|
"publishConfig": {
|