@ljoukov/llm 4.0.1 → 4.0.3
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 +41 -1
- package/dist/index.cjs +2010 -1047
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -5
- package/dist/index.d.ts +17 -5
- package/dist/index.js +2010 -1047
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -333,13 +333,15 @@ Use a `chatgpt-` prefix:
|
|
|
333
333
|
import { generateText } from "@ljoukov/llm";
|
|
334
334
|
|
|
335
335
|
const result = await generateText({
|
|
336
|
-
model: "chatgpt-gpt-5.
|
|
336
|
+
model: "chatgpt-gpt-5.4",
|
|
337
337
|
input: "Return exactly: OK",
|
|
338
338
|
});
|
|
339
339
|
|
|
340
340
|
console.log(result.text);
|
|
341
341
|
```
|
|
342
342
|
|
|
343
|
+
`chatgpt-gpt-5.4-fast` is also supported as a convenience alias for ChatGPT-authenticated `gpt-5.4` with priority processing enabled (`service_tier="priority"`), matching Codex `/fast` semantics.
|
|
344
|
+
|
|
343
345
|
## JSON outputs
|
|
344
346
|
|
|
345
347
|
`generateJson()` validates the output with Zod and returns the parsed value.
|
|
@@ -675,6 +677,44 @@ const result = await runAgentLoop({
|
|
|
675
677
|
Telemetry emits parent/child run correlation (`runId` + `parentRunId`) for subagents.
|
|
676
678
|
See `docs/agent-telemetry.md` for event schema, design rationale, and backend adapter guidance.
|
|
677
679
|
|
|
680
|
+
### Agent Logging (Console + Files + Redirects)
|
|
681
|
+
|
|
682
|
+
`runAgentLoop()` enables logging by default. It writes:
|
|
683
|
+
|
|
684
|
+
- console lines,
|
|
685
|
+
- `<workspace>/agent.log`,
|
|
686
|
+
- per-call artifacts under a sibling logs directory: `<workspace-parent>/logs/<timestamp>-<n>/<model-id>/`.
|
|
687
|
+
|
|
688
|
+
Each LLM call writes:
|
|
689
|
+
|
|
690
|
+
- `request.txt`, `request.metadata.json`, and extracted attachments immediately,
|
|
691
|
+
- streamed `thoughts.txt` and `response.txt` deltas during generation,
|
|
692
|
+
- `response.metadata.json` at completion/failure (usage/cost/status/error).
|
|
693
|
+
|
|
694
|
+
`image_url` data URLs are redacted in text/metadata logs (`data:...,...`) so base64 payloads are not printed inline.
|
|
695
|
+
|
|
696
|
+
```ts
|
|
697
|
+
import { runAgentLoop } from "@ljoukov/llm";
|
|
698
|
+
|
|
699
|
+
await runAgentLoop({
|
|
700
|
+
model: "chatgpt-gpt-5.3-codex",
|
|
701
|
+
input: "Do the task",
|
|
702
|
+
filesystemTool: true,
|
|
703
|
+
logging: {
|
|
704
|
+
workspaceDir: process.cwd(), // optional; defaults to filesystem cwd or process.cwd()
|
|
705
|
+
mirrorToConsole: false, // useful for CLI UIs that already render stream events
|
|
706
|
+
sink: {
|
|
707
|
+
append: (line) => {
|
|
708
|
+
// Optional extra destination (file, socket, queue, etc.)
|
|
709
|
+
},
|
|
710
|
+
flush: async () => {},
|
|
711
|
+
},
|
|
712
|
+
},
|
|
713
|
+
});
|
|
714
|
+
```
|
|
715
|
+
|
|
716
|
+
Set `logging: false` to disable logger output for a run.
|
|
717
|
+
|
|
678
718
|
If you need exact control over tool definitions, build the filesystem toolset yourself and call `runToolLoop()` directly.
|
|
679
719
|
|
|
680
720
|
```ts
|