@orkestrel/ollama 0.0.13 → 0.0.15
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 +16 -9
- package/dist/src/server/index.cjs +387 -164
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +405 -154
- package/dist/src/server/index.d.ts +405 -154
- package/dist/src/server/index.js +379 -165
- package/dist/src/server/index.js.map +1 -1
- package/package.json +20 -22
package/README.md
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
# @orkestrel/ollama
|
|
2
2
|
|
|
3
|
-
A typed local-LLM provider for the `@orkestrel` line
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
> A typed local-LLM provider for the `@orkestrel` line: a `ProviderInterface` over a
|
|
4
|
+
> local Ollama daemon's `POST /api/chat`, with non-streaming `generate`, NDJSON
|
|
5
|
+
> `stream`, tool calls, thinking, and usage accounting, built on web-standard `fetch`
|
|
6
|
+
> and `ReadableStream` with no Ollama SDK dependency.
|
|
7
|
+
|
|
8
|
+
Create a provider with the `createOllama` function, hand it a conversation and a
|
|
9
|
+
bounding `AbortSignal`, and read the assembled `ProviderResult` the `generate`
|
|
10
|
+
method resolves — or drive the `stream` method for live deltas. Point `url` at your
|
|
11
|
+
own server and attach a short-lived token through `headers` where a browser runtime
|
|
12
|
+
must not hold the real key.
|
|
7
13
|
|
|
8
14
|
## Install
|
|
9
15
|
|
|
@@ -15,8 +21,9 @@ npm install @orkestrel/ollama
|
|
|
15
21
|
|
|
16
22
|
- Node.js >= 22
|
|
17
23
|
- A running Ollama daemon (default `http://localhost:11434`) with a pulled
|
|
18
|
-
model — required at runtime by any consumer, and by this
|
|
19
|
-
`src:server`
|
|
24
|
+
model — required at runtime by any consumer, and by this repository's live
|
|
25
|
+
`service` test project; the `src:server` project is hermetic and passes with
|
|
26
|
+
the daemon down
|
|
20
27
|
- ESM + CJS (dual-format build)
|
|
21
28
|
|
|
22
29
|
## Usage
|
|
@@ -30,7 +37,7 @@ const abort = createAbort()
|
|
|
30
37
|
const messages = [{ id: '1', role: 'user', content: 'Reply with exactly: ok' }] as const
|
|
31
38
|
|
|
32
39
|
const result = await provider.generate(messages, abort.signal)
|
|
33
|
-
result.content // '
|
|
40
|
+
result.content // the assistant's answer text
|
|
34
41
|
result.usage // { prompt, completion, total }
|
|
35
42
|
```
|
|
36
43
|
|
|
@@ -43,7 +50,7 @@ assembled result when the stream completes:
|
|
|
43
50
|
const generator = provider.stream(messages, abort.signal)
|
|
44
51
|
let step = await generator.next()
|
|
45
52
|
while (!step.done) {
|
|
46
|
-
if (step.value.
|
|
53
|
+
if (step.value.channel === 'content') process.stdout.write(step.value.text)
|
|
47
54
|
step = await generator.next()
|
|
48
55
|
}
|
|
49
56
|
const streamed = step.value // the assembled ProviderResult
|
|
@@ -54,7 +61,7 @@ const streamed = step.value // the assembled ProviderResult
|
|
|
54
61
|
For the full surface — `createOllama`, `OllamaProvider`, `OllamaOptions`,
|
|
55
62
|
tool calls (`ToolDefinition` / `ToolCall` from `@orkestrel/tool`), thinking,
|
|
56
63
|
and the context-framing default — see
|
|
57
|
-
[`guides/
|
|
64
|
+
[`guides/ollama.md`](guides/ollama.md).
|
|
58
65
|
|
|
59
66
|
## Package
|
|
60
67
|
|