@owlmeans/llm 0.1.15 → 0.1.16
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 +3 -4
- package/agent-meta/manifest.json +9 -9
- package/agent-meta/skills/llm/SKILL.md +54 -4
- package/agent-meta/skills/llm-prompt-caching/SKILL.md +135 -0
- package/build/consts.d.ts +36 -3
- package/build/consts.d.ts.map +1 -1
- package/build/consts.js +37 -4
- package/build/consts.js.map +1 -1
- package/build/execution/service.d.ts.map +1 -1
- package/build/execution/service.js +8 -3
- package/build/execution/service.js.map +1 -1
- package/build/execution/types.d.ts +20 -1
- package/build/execution/types.d.ts.map +1 -1
- package/build/execution/utils.d.ts +12 -1
- package/build/execution/utils.d.ts.map +1 -1
- package/build/execution/utils.js +22 -0
- package/build/execution/utils.js.map +1 -1
- package/build/helpers/cache.d.ts +17 -0
- package/build/helpers/cache.d.ts.map +1 -0
- package/build/helpers/cache.js +22 -0
- package/build/helpers/cache.js.map +1 -0
- package/build/helpers/index.d.ts +1 -0
- package/build/helpers/index.d.ts.map +1 -1
- package/build/helpers/index.js +1 -0
- package/build/helpers/index.js.map +1 -1
- package/build/helpers/spectate.d.ts.map +1 -1
- package/build/helpers/spectate.js +7 -0
- package/build/helpers/spectate.js.map +1 -1
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/build/model.d.ts +1 -1
- package/build/model.d.ts.map +1 -1
- package/build/model.js +90 -16
- package/build/model.js.map +1 -1
- package/build/plugins/anthropic.d.ts.map +1 -1
- package/build/plugins/anthropic.js +136 -21
- package/build/plugins/anthropic.js.map +1 -1
- package/build/plugins/openai.d.ts +9 -0
- package/build/plugins/openai.d.ts.map +1 -1
- package/build/plugins/openai.js +23 -1
- package/build/plugins/openai.js.map +1 -1
- package/build/plugins/types.d.ts +38 -5
- package/build/plugins/types.d.ts.map +1 -1
- package/build/prompt/index.d.ts +5 -0
- package/build/prompt/index.d.ts.map +1 -0
- package/build/prompt/index.js +4 -0
- package/build/prompt/index.js.map +1 -0
- package/build/prompt/plugins.d.ts +24 -0
- package/build/prompt/plugins.d.ts.map +1 -0
- package/build/prompt/plugins.js +64 -0
- package/build/prompt/plugins.js.map +1 -0
- package/build/prompt/render.d.ts +28 -0
- package/build/prompt/render.d.ts.map +1 -0
- package/build/prompt/render.js +39 -0
- package/build/prompt/render.js.map +1 -0
- package/build/prompt/service.d.ts +16 -0
- package/build/prompt/service.d.ts.map +1 -0
- package/build/prompt/service.js +145 -0
- package/build/prompt/service.js.map +1 -0
- package/build/prompt/types.d.ts +101 -0
- package/build/prompt/types.d.ts.map +1 -0
- package/build/prompt/types.js +2 -0
- package/build/prompt/types.js.map +1 -0
- package/build/service.d.ts.map +1 -1
- package/build/service.js +3 -0
- package/build/service.js.map +1 -1
- package/build/types.d.ts +53 -3
- package/build/types.d.ts.map +1 -1
- package/build/utils/prompt.d.ts +14 -0
- package/build/utils/prompt.d.ts.map +1 -1
- package/build/utils/prompt.js +32 -0
- package/build/utils/prompt.js.map +1 -1
- package/package.json +13 -6
- package/src/consts.ts +43 -5
- package/src/execution/service.ts +9 -3
- package/src/execution/types.ts +21 -2
- package/src/execution/utils.ts +28 -1
- package/src/helpers/cache.ts +33 -0
- package/src/helpers/index.ts +1 -0
- package/src/helpers/spectate.ts +10 -0
- package/src/index.ts +1 -0
- package/src/model.ts +119 -16
- package/src/plugins/anthropic.ts +159 -20
- package/src/plugins/openai.ts +26 -1
- package/src/plugins/types.ts +42 -5
- package/src/prompt/index.ts +5 -0
- package/src/prompt/plugins.ts +69 -0
- package/src/prompt/render.ts +48 -0
- package/src/prompt/service.ts +194 -0
- package/src/prompt/types.ts +114 -0
- package/src/service.ts +3 -0
- package/src/types.ts +54 -3
- package/src/utils/prompt.ts +33 -0
- package/tests/execution.spec.ts +42 -0
- package/tests/plugins.spec.ts +279 -14
- package/tests/prompt.spec.ts +194 -0
- package/agent-meta/instructions/llm.instructions.md +0 -66
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: "How to use @owlmeans/llm — the LLM inference runtime: four-method model, provider plugins, model factory service, and the policy-driven execution abstraction."
|
|
3
|
-
applyTo: "**/*.ts, **/*.tsx"
|
|
4
|
-
---
|
|
5
|
-
<!-- AUTO-GENERATED — do not edit. Regenerate via sync-agent-meta. -->
|
|
6
|
-
|
|
7
|
-
# @owlmeans/llm
|
|
8
|
-
|
|
9
|
-
**Layer:** Core
|
|
10
|
-
**Install:** `"@owlmeans/llm": "^0.1.15"` in `dependencies` (plus the `@langchain/*` peers)
|
|
11
|
-
|
|
12
|
-
The inference runtime. Everything provider-specific is a **plugin**; the model owns only the
|
|
13
|
-
provider-independent parts. Serializable contracts live in `@owlmeans/llm-common`.
|
|
14
|
-
|
|
15
|
-
## Key Exports
|
|
16
|
-
|
|
17
|
-
| Export | Description |
|
|
18
|
-
|--------|-------------|
|
|
19
|
-
| `makeLlmModel(options, spectator)` | `ask` / `talk` / `invoke` / `request`. |
|
|
20
|
-
| `makeLlmService` · `appendLlmService` · `llmServiceApi` | Model factory/registry; `llmServiceApi` composes into your own service. |
|
|
21
|
-
| `makeExecutionService` · `appendExecutionService` · `executionServiceApi` | Frozen 3-level executions, policy resolution, snapshot/restore/checkpoint. |
|
|
22
|
-
| `plugins`, `registerLlmPlugin`, `resolvePlugin`, `pluginOf`, `pluginFor` | Provider-plugin registry (`@owlmeans/llm/plugins`). |
|
|
23
|
-
| `anthropicPlugin`, `openAiPlugin`, `compatiblePlugin`, `openAiFamily` | Built-ins; spread `openAiFamily` into a new OpenAI-compatible plugin. |
|
|
24
|
-
| `withRetry`, `registerFatalError`, `spectate`, `normalizeInput`, `parseJsonContent`, `coerceToSchema` | Helpers (`@owlmeans/llm/helpers`). |
|
|
25
|
-
| `LlmModelError` (retryable), `LlmMissconfiguredError`, `LlmPluginError`, `LlmRetryExceededError` | `ResilientError` family. |
|
|
26
|
-
|
|
27
|
-
## Rules
|
|
28
|
-
|
|
29
|
-
- `src/helpers/` is what consumers may use; `src/utils/` is library-private and never
|
|
30
|
-
exported. Place a new function on the right side rather than exporting a util for a test.
|
|
31
|
-
- Never branch on the provider (`instanceof ChatAnthropic`, `provider === …`) in the model or
|
|
32
|
-
the service — put it on the `LlmPlugin` (`build` / `owns` / `family` / `refine` /
|
|
33
|
-
`structuredMode` / `toolChoice` / `responseFormat` / `patchCache` / `isFatal`).
|
|
34
|
-
- Plugin registration order is load-bearing: `pluginFor` returns the first `owns` match, and
|
|
35
|
-
`compatible` precedes `openai` so an unlabelled `ChatOpenAI` gets the conservative
|
|
36
|
-
tool-calling behaviour.
|
|
37
|
-
- `@langchain/*` are **peer** dependencies — model instances cross the package boundary and
|
|
38
|
-
two installed copies are nominally distinct types. Pin one copy in the consumer.
|
|
39
|
-
- Extend the execution generically: your own `ExecutionShape`, your collaborator fields in
|
|
40
|
-
`collaboratorKeys`. Do not narrow inherited method signatures (contravariance error).
|
|
41
|
-
|
|
42
|
-
## Usage
|
|
43
|
-
|
|
44
|
-
```typescript
|
|
45
|
-
import { makeLlmModel, makeLlmService } from '@owlmeans/llm'
|
|
46
|
-
|
|
47
|
-
const llm = makeLlmService({ models: () => configs })
|
|
48
|
-
const model = makeLlmModel(
|
|
49
|
-
{ model: llm.getModel('analyst'), purpose: { type: 'analysis' } }, spectator
|
|
50
|
-
)
|
|
51
|
-
const spec = await model.invoke('Describe the app', SpecSchema, { action: 'spec' })
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
Execution resolution precedence: **roleOverride → modelOverride → effort tier →
|
|
55
|
-
`LlmService.getModel`**.
|
|
56
|
-
|
|
57
|
-
## Already handled — do not reimplement
|
|
58
|
-
|
|
59
|
-
Idle stream deadline · duplicate-final-chunk dedup · output-budget escalation ·
|
|
60
|
-
reasoning-cap shrink · same-family fallback model · schema coercion · JSON salvage from
|
|
61
|
-
prose · `NullCapture` diagnostics · fatal-error short-circuit.
|
|
62
|
-
|
|
63
|
-
## Depends On
|
|
64
|
-
|
|
65
|
-
- `@owlmeans/llm-common`, `@owlmeans/context`, `@owlmeans/error`, `@owlmeans/basic-ids`, `ajv`
|
|
66
|
-
- peer `@langchain/core`, `@langchain/openai`, `@langchain/anthropic`
|