@nemesis-oss/ollama-sdk 1.12.0 → 1.13.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 +35 -0
- package/README.md +54 -9
- package/dist/{anthropic-CKp5TmAP.d.ts → anthropic-B9AFyzXI.d.ts} +64 -17
- package/dist/{anthropic-Did0lQxP.d.cts → anthropic-CYy_ECam.d.cts} +64 -17
- package/dist/generated-api.cjs +3 -2
- package/dist/generated-api.cjs.map +1 -1
- package/dist/generated-api.d.cts +12 -6
- package/dist/generated-api.d.ts +12 -6
- package/dist/generated-api.js +3 -2
- package/dist/generated-api.js.map +1 -1
- package/dist/generated-models-schemas.cjs +1 -1
- package/dist/generated-models-schemas.cjs.map +1 -1
- package/dist/generated-models-schemas.js +1 -1
- package/dist/generated-models-schemas.js.map +1 -1
- package/dist/generated-runtime.cjs +2 -1
- package/dist/generated-runtime.cjs.map +1 -1
- package/dist/generated-runtime.js +2 -1
- package/dist/generated-runtime.js.map +1 -1
- package/dist/index.cjs +198 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +72 -8
- package/dist/index.d.ts +72 -8
- package/dist/index.js +192 -31
- package/dist/index.js.map +1 -1
- package/dist/mcp/tools.json +4 -4
- package/dist/mcp-generated.cjs +3 -2
- package/dist/mcp-generated.cjs.map +1 -1
- package/dist/mcp-generated.js +3 -2
- package/dist/mcp-generated.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.13.0] — docs.ollama.com re-audit: parity verifier reads checkbox state, strict compat types, web-search agent tools
|
|
4
|
+
|
|
5
|
+
A full re-read of docs.ollama.com (API reference, capability guides, integrations, OpenAPI spec) against the SDK. The native API was already at parity except for two upstream changes; the real defect was in the compatibility-parity tooling, which had been reporting fields Ollama documents as unsupported as "supported".
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- **Contract-parity verifier ignored `[ ]` (unsupported) checkboxes.** `verify:contract-parity` fetched the rendered HTML docs, which drop checkbox state, and the pinned fallback had been rewritten to `[Input]` markers — so every listed field read as supported and the OpenAI overlay claimed support for `tool_choice`, `logit_bias`, `user`, `n` and logprobs (chat), `best_of`, `echo`, `logit_bias`, `user`, `n` and logprobs (completions), `user` (embeddings) and `truncation` (responses). The fetcher now prefers the Mintlify markdown twin (`<page>.md`), endpoint sections are bounded by heading level (backticked headings supported), unchecked feature items (`* [ ] Logprobs`) read as unsupported, and unchecked request-field items count as explicit unsupported evidence. The overlay and IR are corrected (`logprobs` capability is now `unsupported` on `/v1/chat/completions` and `/v1/completions`), and the pinned fallbacks are re-pinned from the live markdown with checkbox state intact.
|
|
10
|
+
- **Strict compatibility request types now exclude documented-unsupported fields.** `OllamaOpenAIChatCompletionRequest` drops `tool_choice`, `logit_bias`, `user`, `n`, `logprobs`, `top_logprobs`; `OllamaOpenAICompletionRequest` drops `best_of`, `echo`, `logit_bias`, `user`, `n`, `logprobs`; `OllamaOpenAIEmbeddingRequest` drops `user` and narrows `input` to `string | string[]`; `OllamaOpenAIResponsesRequest` also drops `truncation`. Passing them is now a compile error (pinned by `@ts-expect-error` tests run under `npm run typecheck`). **Type-level breaking change only for code that opted into the strict types** — the broad `OpenAI*` interop types are unchanged.
|
|
11
|
+
|
|
12
|
+
### Upstream API changes picked up
|
|
13
|
+
|
|
14
|
+
- **System One `choice` criteria limit raised from 26 to 255** (model-dependent) — generated Zod schema and request type updated; `score` stays at 2–26.
|
|
15
|
+
- **`/api/copy` documents a JSON `{ "status": "success" }` body** plus 400/404 error responses — the generated `NativeApi.copy()` now returns `StatusResponse` instead of `unknown`.
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- **`createWebTools(client, options?)`** (plus `createWebSearchTool`, `createWebFetchTool`, `formatWebSearchResult`, `formatWebFetchResult`): Ollama Cloud web search/fetch as model-callable `web_search`/`web_fetch` tools for `ToolRegistry`/`Agent` — the documented "Building a search agent" pattern. Arguments are validated at the registry boundary (`query`/`url` non-empty, `max_results` 1–10) before any network call; the abort signal propagates; output is bounded by `maxOutputChars` (default `2000 * 4`, as in the docs) by trimming content fields so it always stays valid JSON; `web_fetch` caps links (`maxLinks`, default 25). New example: `examples/web-search-agent.ts`.
|
|
20
|
+
- Tests for direct Ollama Cloud access through the bridges (`https://ollama.com/v1/chat/completions`, `/v1/responses`, `/v1/messages` with `Authorization: Bearer` and `anthropic-version: 2023-06-01`), docs-parser regression tests against the pinned markdown, and strict-type compile tests.
|
|
21
|
+
|
|
22
|
+
- **Strict chat images are base64-only.** `OllamaOpenAIChatContentPart.image_url` is now `` `data:${string}` `` (string or `{ url, detail? }`), so a remote `http(s)://` image URL — documented as unsupported on `/v1/chat/completions` — is a compile error. `OllamaOpenAIChatMessage`, `OllamaOpenAIChatContentPart`, and `OllamaOpenAIImageDataUrl` are now exported from the package root.
|
|
23
|
+
- OpenAPI source descriptions synced with upstream (System One `noul`/`score` criteria, `UsageResponse.granularity`). The one remaining intentional deviation — nullable `ModelSummary.details.families`, because the server serializes a nil slice as `null` — is documented in the source header and pinned by a test.
|
|
24
|
+
|
|
25
|
+
### Documentation
|
|
26
|
+
|
|
27
|
+
- README and docs-site OpenAI/Anthropic guides: per-endpoint supported vs documented-unsupported tables, direct cloud access sections, and a web search agent section.
|
|
28
|
+
|
|
29
|
+
## [1.12.1] — Fix: model-affinity routing respects priority tiers
|
|
30
|
+
|
|
31
|
+
### Fixed
|
|
32
|
+
|
|
33
|
+
- **`endpointHealth.modelAffinity` no longer overrides endpoint `priority`.** In 1.12.0, `ModelAffinityRouter.reorder()` moved every host holding the requested model to the front of the _whole_ candidate list, so a lower-priority host with the model in VRAM was tried before a higher-priority host without it. That contradicted the README and ADR 0028, which state that priority tiers keep working. Affinity now reorders only within each priority tier (runs of consecutive equal `priority`, unset = `0`, as in the registry): a higher-priority endpoint is always tried first, and residency only breaks ties inside a tier. The order between tiers, including the registry's fail-open recovery order, is unchanged.
|
|
34
|
+
- **Behavior change for configurations that mix `priority` values with `modelAffinity`:** requests that 1.12.0 sent to a resident lower-priority host now go to the higher-priority host first. Pools where every endpoint has the same priority (the documented fleet-of-workstations setup) are unaffected.
|
|
35
|
+
- 6 new tests: tier isolation, independent per-tier reordering, unset priority as `0`, consecutive-run grouping, an unchanged input returned as-is, and an end-to-end `OllamaClient` routing check.
|
|
36
|
+
- `package-lock.json` root version corrected (it still read `1.8.0`).
|
|
37
|
+
|
|
3
38
|
## [1.12.0] — Daemon liveness & telemetry standardization: formatTelemetry, dynamic host model-affinity routing, root ping
|
|
4
39
|
|
|
5
40
|
The October 10 documentation digest ("Daemon Liveness & Telemetry Standardization") reviewed the official operational surfaces — the root liveness probe (`HEAD /` → 200, body "Ollama is running"), `GET /api/version`, `GET /api/ps` runner introspection, and the nanosecond duration counters on every generation response. Verified against the codebase first (see [ADR 0028](./docs/adr/0028-telemetry-normalization-host-affinity-root-ping.md)): two of the digest's gap assessments were stale — multi-host pooling with least-connections routing, capacity caps, and 503/`OLLAMA_MAX_QUEUE` saturation failover already exist (`endpoints` + `endpointHealth` + `DEFAULT_FAILOVER_CODES`), so the proposed `LoadBalancedOllamaClient` was **not** added (it would fork the existing routing engine); the real gaps — telemetry math, dynamic multi-host affinity, and the root ping — are implemented, all additive, no breaking changes. 865 pre-existing tests stay green, 33 new tests added.
|
package/README.md
CHANGED
|
@@ -6,6 +6,16 @@
|
|
|
6
6
|
|
|
7
7
|
> Production-grade TypeScript SDK for Ollama. Built with native fetch, high availability failover, multi-turn tool calling, structured outputs with Zod, reasoning stream tokens, OpenAI & Anthropic compatibility bridges, MCP integration, and Web Stream adapters.
|
|
8
8
|
|
|
9
|
+
### How this compares
|
|
10
|
+
|
|
11
|
+
| Need | Typical choice |
|
|
12
|
+
| -------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
|
|
13
|
+
| Default Ollama integration in JS/TS | Official [`ollama`](https://www.npmjs.com/package/ollama) client (`ollama/ollama-js`) |
|
|
14
|
+
| Vercel AI SDK (`ai` package) apps | [`ai-sdk-ollama`](https://www.npmjs.com/package/ai-sdk-ollama) |
|
|
15
|
+
| Agent runtime, MCP bridge, HA failover, context safety, structured outputs | **This package** — powers [Nexum](https://github.com/shubhamtaywade82/nexum) |
|
|
16
|
+
|
|
17
|
+
Nexum’s model harness (2026-10-09) exercised this SDK via `gemma4:cloud` and `minicpm5:2b` with 100% pass on `tool-calling`, `output-format`, and `agentic-looping` categories. See [nexum/docs/guide/benchmarks.md](../nexum/docs/guide/benchmarks.md) and [validation.md](../nexum/docs/guide/validation.md).
|
|
18
|
+
|
|
9
19
|
---
|
|
10
20
|
|
|
11
21
|
## Key Features
|
|
@@ -18,7 +28,7 @@
|
|
|
18
28
|
- 🌐 **High Availability & Failover**: Multi-endpoint registry with priority routing, circuit breaker failover, active health checks, and per-endpoint `models` allow-lists for routing several model-specific API keys through one client.
|
|
19
29
|
- 🔌 **Model Context Protocol (MCP)**: First-class, transport-neutral `McpBridge` for converting MCP tool descriptors into Ollama function definitions and registering executable MCP-backed tools.
|
|
20
30
|
- 📚 **Full Model Lifecycle**: `pullModel`, `pushModel`, `createModel`, `copyModel`, `deleteModel`, `listModels`, `showModel`, and `ps()` (currently loaded models) — full parity with Ollama's model management API.
|
|
21
|
-
- 🔎 **Ollama Cloud Web Tools**: `webSearch`/`webFetch` wrap Ollama's hosted `/api/web_search` and `/api/web_fetch` tools at `ollama.com` (requires an `OLLAMA_API_KEY`), independent of any local `baseUrl
|
|
31
|
+
- 🔎 **Ollama Cloud Web Tools**: `webSearch`/`webFetch` wrap Ollama's hosted `/api/web_search` and `/api/web_fetch` tools at `ollama.com` (requires an `OLLAMA_API_KEY`), independent of any local `baseUrl` — and `createWebTools(client)` exposes them as model-callable `web_search`/`web_fetch` tools with bounded, valid-JSON output for the documented search-agent pattern.
|
|
22
32
|
- 💳 **Ollama Cloud Usage & Balance**: `usage()`/`balance()` wrap Ollama's hosted account endpoints (`GET /api/usage`, `GET /api/balance`) — request counts, USD spend, cached-token totals bucketed by hour/day, and remaining included/purchased credits (including the legacy session/weekly plan shapes) — with the same fixed-cloud-host, API-key, timeout, and retry semantics as the web tools.
|
|
23
33
|
- 🌉 **OpenAI & Anthropic Compatibility Bridges**: Built-in clients for `/v1/chat/completions`, `/v1/responses`, `/v1/models`, and `/v1/messages`, including `reasoning_effort`/`reasoning.effort` for thinking models — plus an ergonomic dual-mode `client.responses.create()` bridge that prefers native `/v1/responses` and transparently re-issues via `/api/chat` on older servers (pre-v0.13.3).
|
|
24
34
|
- 💬 **KV-Cache-Aware Conversation Sessions**: `client.session(model, systemPrompt)` keeps an append-only, prefix-stable history that maximizes Ollama's KV-cache reuse across turns, surfaces per-turn + cumulative cache hit rates (`prompt_eval_cached_count`) so cache degradation is visible instead of silent, and offers a one-call `compact()` sliding-window escape hatch when a session outgrows its window.
|
|
@@ -671,6 +681,21 @@ const page = await client.webFetch({ url: 'https://ollama.com/blog' });
|
|
|
671
681
|
console.log(page.title, page.content.slice(0, 200));
|
|
672
682
|
```
|
|
673
683
|
|
|
684
|
+
#### Web search agent
|
|
685
|
+
|
|
686
|
+
`createWebTools(client)` turns the two endpoints into `web_search` / `web_fetch` tools for `ToolRegistry`/`Agent` — the [search-agent pattern](https://docs.ollama.com/capabilities/web-search#building-a-search-agent) from the Ollama docs. Arguments are validated (`query` non-empty, `max_results` 1–10) before any network call, the abort signal propagates, and output is trimmed to `maxOutputChars` (default `2000 * 4`, as in the docs) while staying valid JSON:
|
|
687
|
+
|
|
688
|
+
```typescript
|
|
689
|
+
import { Agent, ToolRegistry, createWebTools } from '@nemesis-oss/ollama-sdk';
|
|
690
|
+
|
|
691
|
+
const agent = new Agent(client, { tools: new ToolRegistry(createWebTools(client)) });
|
|
692
|
+
const { finalMessage } = await agent.run({
|
|
693
|
+
model: 'qwen3:4b',
|
|
694
|
+
messages: [{ role: 'user', content: "what is ollama's new engine" }],
|
|
695
|
+
think: true,
|
|
696
|
+
});
|
|
697
|
+
```
|
|
698
|
+
|
|
674
699
|
These two methods don't participate in the multi-endpoint failover below — there's only ever the one cloud host to call — but they do use the same default `timeoutMs` and retry policy as everything else.
|
|
675
700
|
|
|
676
701
|
### Cloud Usage & Balance (Ollama Cloud account)
|
|
@@ -915,9 +940,28 @@ await client.openai.chatCompletions({
|
|
|
915
940
|
});
|
|
916
941
|
```
|
|
917
942
|
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
943
|
+
Fields Ollama documents as **unsupported** — `tool_choice`, `logit_bias`, `user`, `n`
|
|
944
|
+
and logprobs on `/v1/chat/completions`; `best_of`, `echo`, `logit_bias`, `user`, `n` and
|
|
945
|
+
logprobs on `/v1/completions`; `user` and token inputs on `/v1/embeddings`;
|
|
946
|
+
`previous_response_id`, `conversation` and `truncation` on `/v1/responses`; `tool_choice`
|
|
947
|
+
and `metadata` on `/v1/messages` — stay typed on the broad `OpenAI*`/`Anthropic*` request
|
|
948
|
+
types so a standard request object type-checks unmodified, and are compile-time errors on
|
|
949
|
+
the strict `OllamaOpenAI*`/`OllamaAnthropicMessagesRequest` types. For token log
|
|
950
|
+
probabilities use native `chat()`/`generate()` with `logprobs: true`.
|
|
951
|
+
|
|
952
|
+
**Direct Ollama Cloud access** needs no local server — the bridges speak to
|
|
953
|
+
`https://ollama.com/v1/...` with `Authorization: Bearer` (the hosted Anthropic endpoint
|
|
954
|
+
rejects `x-api-key`-only auth; the SDK always sends the bearer header plus
|
|
955
|
+
`anthropic-version: 2023-06-01`):
|
|
956
|
+
|
|
957
|
+
```typescript
|
|
958
|
+
const cloud = new OllamaClient({ baseUrl: 'https://ollama.com', apiKey: process.env.OLLAMA_API_KEY });
|
|
959
|
+
await cloud.openai.chatCompletions({ model: 'gemma4:31b', messages: [{ role: 'user', content: 'Hi' }] });
|
|
960
|
+
await cloud.anthropic.messages({ model: 'gemma4:31b', max_tokens: 1024, messages: [{ role: 'user', content: 'Hi' }] });
|
|
961
|
+
```
|
|
962
|
+
|
|
963
|
+
The cloud API does not support stateful Responses, built-in web search through
|
|
964
|
+
`/v1/responses`, or custom/freeform tool-call replay.
|
|
921
965
|
|
|
922
966
|
### Multi-Endpoint High Availability Failover
|
|
923
967
|
|
|
@@ -1174,7 +1218,7 @@ initial HTTP round trip:
|
|
|
1174
1218
|
|
|
1175
1219
|
#### Model-affinity routing across hosts (prefer the resident host)
|
|
1176
1220
|
|
|
1177
|
-
With several
|
|
1221
|
+
With several _interchangeable_ endpoints serving the same models — the fleet-of-workstations
|
|
1178
1222
|
case, not the per-credential Cloud case — sending a request to a host that doesn't currently
|
|
1179
1223
|
hold the model forces that host to evict something and cold-load it: the multi-host version
|
|
1180
1224
|
of the thrashing `ModelAffinityScheduler` prevents inside one client. Opt in with
|
|
@@ -1217,7 +1261,8 @@ The design never trades latency for affinity (see
|
|
|
1217
1261
|
from being re-probed on every request.
|
|
1218
1262
|
- **No probes at all unless configured.** Without `modelAffinity`, the router isn't even
|
|
1219
1263
|
constructed — zero overhead, and no `/api/ps` traffic.
|
|
1220
|
-
- **Composes with everything above.** Affinity reorders
|
|
1264
|
+
- **Composes with everything above.** Affinity reorders _within each priority tier_ of
|
|
1265
|
+
the runnable set (a higher-priority host is always tried first, resident or not):
|
|
1221
1266
|
priority tiers, `least-connections` ordering, capacity caps, and `models`-scoped
|
|
1222
1267
|
credentials keep working exactly as before, and single-endpoint-pinned operations
|
|
1223
1268
|
(model/blob management, `capabilities()`) are never moved to a different host.
|
|
@@ -1225,7 +1270,7 @@ The design never trades latency for affinity (see
|
|
|
1225
1270
|
`llama3:latest` but never `llama3.1`), shared with context-window discovery so the
|
|
1226
1271
|
two features can't disagree about what "loaded" means.
|
|
1227
1272
|
|
|
1228
|
-
For the
|
|
1273
|
+
For the _single-host_ counterpart — per-model serial queues that deepen the already-hot
|
|
1229
1274
|
model before loading the next one — see
|
|
1230
1275
|
[Model-Affinity Scheduling](#model-affinity-scheduling-multi-model-anti-thrashing); the
|
|
1231
1276
|
two compose: a scheduler per host, affinity routing between hosts.
|
|
@@ -1305,7 +1350,7 @@ Two behaviors worth knowing:
|
|
|
1305
1350
|
servers without `prompt_eval_cached_count`, embeddings) format cleanly instead of
|
|
1306
1351
|
producing `NaN`/`Infinity`, and zero durations never divide into rates.
|
|
1307
1352
|
- **`cacheHitRatio` uses `cached / (cached + evaluated)`**, not
|
|
1308
|
-
`cached / prompt_eval_count`: Ollama reports `prompt_eval_count: 0` on a
|
|
1353
|
+
`cached / prompt_eval_count`: Ollama reports `prompt_eval_count: 0` on a _full_ cache
|
|
1309
1354
|
hit, so dividing by it alone would read a perfect cache as "no caching at all". This
|
|
1310
1355
|
is the same semantics as [`ConversationSession`'s
|
|
1311
1356
|
`cacheStats.hitRate`](#kv-cache-aware-conversation-sessions), so the two surfaces can
|
|
@@ -1315,7 +1360,7 @@ Two behaviors worth knowing:
|
|
|
1315
1360
|
straight into log lines, dashboards, and streaming pipelines alike. For span-based
|
|
1316
1361
|
instrumentation of requests themselves, see
|
|
1317
1362
|
[Observability with OpenTelemetry](#observability-with-opentelemetry) below; the two
|
|
1318
|
-
compose (spans for
|
|
1363
|
+
compose (spans for _where/when_, `formatTelemetry` for _how fast_).
|
|
1319
1364
|
|
|
1320
1365
|
### Observability with OpenTelemetry
|
|
1321
1366
|
|
|
@@ -484,7 +484,7 @@ interface SystemOneChoiceAnswer {
|
|
|
484
484
|
interface SystemOneChoiceQuestion {
|
|
485
485
|
readonly type: 'choice';
|
|
486
486
|
readonly instructions: SystemOneContent;
|
|
487
|
-
/** Option keys mapped to descriptions
|
|
487
|
+
/** Option keys mapped to descriptions, or null for a bare label. Keys must not be blank; ties follow the model's option order. The option limit depends on the model. */
|
|
488
488
|
readonly criteria: {
|
|
489
489
|
[key: string]: string | null;
|
|
490
490
|
};
|
|
@@ -528,7 +528,7 @@ interface SystemOneNoulAnswer {
|
|
|
528
528
|
interface SystemOneNoulQuestion {
|
|
529
529
|
readonly type: 'noul';
|
|
530
530
|
readonly instructions: SystemOneContent;
|
|
531
|
-
/** Optional descriptions for the two outcomes. Omitted entries use
|
|
531
|
+
/** Optional descriptions for the two outcomes. Omitted entries use model-specific defaults. */
|
|
532
532
|
readonly criteria?: {
|
|
533
533
|
readonly false?: string | undefined;
|
|
534
534
|
readonly true?: string | undefined;
|
|
@@ -614,7 +614,7 @@ interface SystemOneScoreAnswer {
|
|
|
614
614
|
interface SystemOneScoreQuestion {
|
|
615
615
|
readonly type: 'score';
|
|
616
616
|
readonly instructions: SystemOneContent;
|
|
617
|
-
/** Descriptions ordered from the lowest score (index 0) to the highest. Defines a scale from 0 to the number of criteria minus 1. */
|
|
617
|
+
/** Descriptions ordered from the lowest score (index 0) to the highest. Defines a scale from 0 to the number of criteria minus 1. The maximum number of levels depends on the model. */
|
|
618
618
|
readonly criteria: readonly string[];
|
|
619
619
|
}
|
|
620
620
|
|
|
@@ -721,7 +721,7 @@ declare class NativeApi {
|
|
|
721
721
|
chat(request: ChatRequest & {
|
|
722
722
|
stream: true;
|
|
723
723
|
}): Promise<AsyncGenerator<ChatResponse, void, undefined>>;
|
|
724
|
-
copy(request: CopyRequest): Promise<
|
|
724
|
+
copy(request: CopyRequest): Promise<StatusResponse>;
|
|
725
725
|
create(request: CreateRequest & {
|
|
726
726
|
stream?: false;
|
|
727
727
|
}): Promise<StatusResponse>;
|
|
@@ -859,11 +859,18 @@ interface OpenAIChatCompletionRequest {
|
|
|
859
859
|
readonly seed?: number | undefined;
|
|
860
860
|
readonly presence_penalty?: number | undefined;
|
|
861
861
|
readonly frequency_penalty?: number | undefined;
|
|
862
|
+
/** @remarks Documented as unsupported by Ollama — accepted for OpenAI interop, ignored by the server. */
|
|
862
863
|
readonly user?: string | undefined;
|
|
864
|
+
/** @remarks Documented as unsupported by Ollama — accepted for OpenAI interop, ignored by the server. */
|
|
863
865
|
readonly logit_bias?: Record<string, number> | undefined;
|
|
866
|
+
/** @remarks Documented as unsupported by Ollama — accepted for OpenAI interop, ignored by the server. */
|
|
864
867
|
readonly n?: number | undefined;
|
|
865
|
-
/**
|
|
868
|
+
/**
|
|
869
|
+
* @remarks Logprobs are documented as unsupported on Ollama's `/v1/chat/completions`.
|
|
870
|
+
* Use native `chat({ logprobs: true, top_logprobs })` for token log probabilities.
|
|
871
|
+
*/
|
|
866
872
|
readonly logprobs?: boolean | undefined;
|
|
873
|
+
/** @remarks Documented as unsupported by Ollama — accepted for OpenAI interop, ignored by the server. */
|
|
867
874
|
readonly top_logprobs?: number | undefined;
|
|
868
875
|
readonly tools?: readonly OpenAITool[] | undefined;
|
|
869
876
|
/**
|
|
@@ -895,18 +902,34 @@ interface OpenAIChatCompletionRequest {
|
|
|
895
902
|
readonly effort?: OpenAIReasoningEffort | undefined;
|
|
896
903
|
} | undefined;
|
|
897
904
|
}
|
|
898
|
-
/**
|
|
905
|
+
/** A base64 data URL (`data:image/png;base64,...`) — the only image form Ollama accepts here. */
|
|
906
|
+
type OllamaOpenAIImageDataUrl = `data:${string}`;
|
|
907
|
+
/** Ollama Chat Completions supports text plus base64 image content. */
|
|
899
908
|
type OllamaOpenAIChatContentPart = OpenAITextContentPart | {
|
|
900
909
|
readonly type: 'image_url';
|
|
901
|
-
/**
|
|
902
|
-
|
|
910
|
+
/**
|
|
911
|
+
* A base64 `data:` URL, as a string or inside the OpenAI `{ url, detail? }` object.
|
|
912
|
+
* Ollama documents remote image URLs as unsupported on `/v1/chat/completions`, so
|
|
913
|
+
* `http(s)://` URLs are a compile error here; resolve remote images to base64 first
|
|
914
|
+
* (e.g. with {@link resolveImageInput}) or use the native `images` field.
|
|
915
|
+
*/
|
|
916
|
+
readonly image_url: OllamaOpenAIImageDataUrl | {
|
|
917
|
+
readonly url: OllamaOpenAIImageDataUrl;
|
|
918
|
+
readonly detail?: 'auto' | 'low' | 'high' | 'original' | undefined;
|
|
919
|
+
};
|
|
903
920
|
};
|
|
904
921
|
type OllamaOpenAIReasoningEffort = 'high' | 'medium' | 'low' | 'max' | 'none';
|
|
905
922
|
type OllamaOpenAIChatMessage = Omit<OpenAIMessage, 'content'> & {
|
|
906
923
|
readonly content: string | readonly OllamaOpenAIChatContentPart[];
|
|
907
924
|
};
|
|
908
|
-
/**
|
|
909
|
-
|
|
925
|
+
/**
|
|
926
|
+
* Strict Ollama-documented Chat Completions request. Excludes the fields
|
|
927
|
+
* https://docs.ollama.com/api/openai-compatibility marks unsupported (`tool_choice`,
|
|
928
|
+
* `logit_bias`, `user`, `n`, `logprobs`/`top_logprobs`) and the SDK-only
|
|
929
|
+
* `parallel_tool_calls` flag, so passing any of them is a compile-time error instead of
|
|
930
|
+
* a silently ignored request field.
|
|
931
|
+
*/
|
|
932
|
+
type OllamaOpenAIChatCompletionRequest = Omit<OpenAIChatCompletionRequest, 'messages' | 'parallel_tool_calls' | 'reasoning_effort' | 'reasoning' | 'tool_choice' | 'logit_bias' | 'user' | 'n' | 'logprobs' | 'top_logprobs'> & {
|
|
910
933
|
readonly messages: readonly OllamaOpenAIChatMessage[];
|
|
911
934
|
readonly reasoning_effort?: OllamaOpenAIReasoningEffort | undefined;
|
|
912
935
|
readonly reasoning?: {
|
|
@@ -985,7 +1008,10 @@ interface OpenAICompletionRequest {
|
|
|
985
1008
|
readonly model: string;
|
|
986
1009
|
/** Ollama currently accepts a string prompt for /v1/completions. */
|
|
987
1010
|
readonly prompt: string;
|
|
988
|
-
/**
|
|
1011
|
+
/**
|
|
1012
|
+
* @remarks Logprobs are documented as unsupported on Ollama's `/v1/completions`. Use
|
|
1013
|
+
* native `generate({ logprobs: true, top_logprobs })` for token log probabilities.
|
|
1014
|
+
*/
|
|
989
1015
|
readonly logprobs?: number | undefined;
|
|
990
1016
|
readonly frequency_penalty?: number | undefined;
|
|
991
1017
|
readonly presence_penalty?: number | undefined;
|
|
@@ -997,14 +1023,23 @@ interface OpenAICompletionRequest {
|
|
|
997
1023
|
readonly top_p?: number | undefined;
|
|
998
1024
|
readonly max_tokens?: number | undefined;
|
|
999
1025
|
readonly suffix?: string | undefined;
|
|
1026
|
+
/** @remarks Documented as unsupported by Ollama — accepted for OpenAI interop, ignored by the server. */
|
|
1000
1027
|
readonly best_of?: number | undefined;
|
|
1028
|
+
/** @remarks Documented as unsupported by Ollama — accepted for OpenAI interop, ignored by the server. */
|
|
1001
1029
|
readonly echo?: boolean | undefined;
|
|
1030
|
+
/** @remarks Documented as unsupported by Ollama — accepted for OpenAI interop, ignored by the server. */
|
|
1002
1031
|
readonly logit_bias?: Record<string, number> | undefined;
|
|
1032
|
+
/** @remarks Documented as unsupported by Ollama — accepted for OpenAI interop, ignored by the server. */
|
|
1003
1033
|
readonly user?: string | undefined;
|
|
1034
|
+
/** @remarks Documented as unsupported by Ollama — accepted for OpenAI interop, ignored by the server. */
|
|
1004
1035
|
readonly n?: number | undefined;
|
|
1005
1036
|
}
|
|
1006
1037
|
/** Strict Ollama-documented Completions request. */
|
|
1007
|
-
|
|
1038
|
+
/**
|
|
1039
|
+
* Strict Ollama-documented Completions request: excludes `best_of`, `echo`,
|
|
1040
|
+
* `logit_bias`, `user`, `n`, and `logprobs`, which Ollama documents as unsupported.
|
|
1041
|
+
*/
|
|
1042
|
+
type OllamaOpenAICompletionRequest = Omit<OpenAICompletionRequest, 'best_of' | 'echo' | 'logit_bias' | 'user' | 'n' | 'logprobs'>;
|
|
1008
1043
|
interface OpenAICompletionChoice {
|
|
1009
1044
|
readonly text: string;
|
|
1010
1045
|
readonly index: number;
|
|
@@ -1044,10 +1079,18 @@ interface OpenAIEmbeddingRequest {
|
|
|
1044
1079
|
readonly input: OpenAIEmbeddingInput;
|
|
1045
1080
|
readonly encoding_format?: 'float' | 'base64' | undefined;
|
|
1046
1081
|
readonly dimensions?: number | undefined;
|
|
1082
|
+
/** @remarks Documented as unsupported by Ollama — accepted for OpenAI interop, ignored by the server. */
|
|
1047
1083
|
readonly user?: string | undefined;
|
|
1048
1084
|
}
|
|
1049
1085
|
/** Strict Ollama-documented Embeddings request. */
|
|
1050
|
-
|
|
1086
|
+
/**
|
|
1087
|
+
* Strict Ollama-documented Embeddings request: `input` is a string or an array of
|
|
1088
|
+
* strings (token and token-array inputs are documented as unsupported), and `user` is
|
|
1089
|
+
* excluded.
|
|
1090
|
+
*/
|
|
1091
|
+
type OllamaOpenAIEmbeddingRequest = Omit<OpenAIEmbeddingRequest, 'input' | 'user'> & {
|
|
1092
|
+
readonly input: string | readonly string[];
|
|
1093
|
+
};
|
|
1051
1094
|
interface OpenAIEmbeddingItem {
|
|
1052
1095
|
readonly object: 'embedding';
|
|
1053
1096
|
readonly embedding: readonly number[] | string;
|
|
@@ -1084,6 +1127,7 @@ interface OpenAIResponsesRequest {
|
|
|
1084
1127
|
readonly previous_response_id?: string | undefined;
|
|
1085
1128
|
/** @remarks Not supported by Ollama, which is stateless across calls — accepted but ignored. */
|
|
1086
1129
|
readonly conversation?: string | undefined;
|
|
1130
|
+
/** @remarks Documented as unsupported by Ollama — accepted but ignored. */
|
|
1087
1131
|
readonly truncation?: string | undefined;
|
|
1088
1132
|
readonly reasoning?: {
|
|
1089
1133
|
readonly effort?: OpenAIReasoningEffort | undefined;
|
|
@@ -1091,9 +1135,12 @@ interface OpenAIResponsesRequest {
|
|
|
1091
1135
|
/** Ollama extension: boolean, model-defined string, or null for model default. */
|
|
1092
1136
|
readonly think?: boolean | string | null | undefined;
|
|
1093
1137
|
}
|
|
1094
|
-
/**
|
|
1095
|
-
|
|
1096
|
-
|
|
1138
|
+
/**
|
|
1139
|
+
* Strict Ollama-documented Responses request: excludes the stateful fields
|
|
1140
|
+
* (`previous_response_id`, `conversation`) and `truncation`, which Ollama documents as
|
|
1141
|
+
* unsupported.
|
|
1142
|
+
*/
|
|
1143
|
+
type OllamaOpenAIResponsesRequest = Omit<OpenAIResponsesRequest, 'previous_response_id' | 'conversation' | 'truncation'>;
|
|
1097
1144
|
type OpenAIResponsesStatus = 'completed' | 'failed' | 'in_progress' | 'cancelled' | 'queued' | 'incomplete';
|
|
1098
1145
|
interface OpenAIResponsesError {
|
|
1099
1146
|
readonly code?: string | undefined;
|
|
@@ -1646,4 +1693,4 @@ declare class AnthropicCompatClient {
|
|
|
1646
1693
|
messages(request: AnthropicMessagesRequest, signal?: AbortSignal): Promise<AnthropicMessagesResponse | AnthropicMessagesStream>;
|
|
1647
1694
|
}
|
|
1648
1695
|
|
|
1649
|
-
export { type OllamaAnthropicThinkingConfig as $, type AnthropicMessagesRequest as A, type AnthropicImageContentBlock as B, type AnthropicMessage as C, AnthropicMessagesStream as D, type AnthropicMetadata as E, type AnthropicOutputConfig as F, type AnthropicRedactedThinkingContentBlock as G, type AnthropicSystem as H, type AnthropicSystemTextBlock as I, type AnthropicTextContentBlock as J, type AnthropicThinkingConfig as K, type AnthropicThinkingContentBlock as L, type AnthropicTool as M, NativeApi as N, type OpenAIChatCompletionRequest as O, type AnthropicToolChoice as P, type AnthropicToolResultContentBlock as Q, type RequestRunner as R, type SystemOneChoiceAnswer as S, type AnthropicToolUseContentBlock as T, type AnthropicUnknownStreamEvent as U, type OllamaAnthropicContentBlock as V, type OllamaAnthropicMessage as W, type OllamaAnthropicMessagesRequest as X, type OllamaAnthropicSystem as Y, type OllamaAnthropicSystemTextBlock as Z, type OllamaAnthropicTextContentBlock as _, type OpenAIChatCompletionResponse as a, type
|
|
1696
|
+
export { type OllamaAnthropicThinkingConfig as $, type AnthropicMessagesRequest as A, type AnthropicImageContentBlock as B, type AnthropicMessage as C, AnthropicMessagesStream as D, type AnthropicMetadata as E, type AnthropicOutputConfig as F, type AnthropicRedactedThinkingContentBlock as G, type AnthropicSystem as H, type AnthropicSystemTextBlock as I, type AnthropicTextContentBlock as J, type AnthropicThinkingConfig as K, type AnthropicThinkingContentBlock as L, type AnthropicTool as M, NativeApi as N, type OpenAIChatCompletionRequest as O, type AnthropicToolChoice as P, type AnthropicToolResultContentBlock as Q, type RequestRunner as R, type SystemOneChoiceAnswer as S, type AnthropicToolUseContentBlock as T, type AnthropicUnknownStreamEvent as U, type OllamaAnthropicContentBlock as V, type OllamaAnthropicMessage as W, type OllamaAnthropicMessagesRequest as X, type OllamaAnthropicSystem as Y, type OllamaAnthropicSystemTextBlock as Z, type OllamaAnthropicTextContentBlock as _, type OpenAIChatCompletionResponse as a, type OpenAIToolCall as a$, type OllamaAnthropicTool as a0, type OllamaAnthropicToolResultContentBlock as a1, type OllamaOpenAIChatCompletionRequest as a2, type OllamaOpenAIChatContentPart as a3, type OllamaOpenAIChatMessage as a4, type OllamaOpenAICompletionRequest as a5, type OllamaOpenAIEmbeddingRequest as a6, type OllamaOpenAIImageDataUrl as a7, type OllamaOpenAIReasoningEffort as a8, type OllamaOpenAIResponsesRequest as a9, type OpenAIResponsesOutputContent as aA, type OpenAIResponsesOutputFunctionCall as aB, type OpenAIResponsesOutputItem as aC, type OpenAIResponsesOutputItemAddedEvent as aD, type OpenAIResponsesOutputItemDoneEvent as aE, type OpenAIResponsesOutputMessage as aF, type OpenAIResponsesOutputReasoning as aG, type OpenAIResponsesOutputRefusal as aH, type OpenAIResponsesOutputTextContent as aI, type OpenAIResponsesOutputTextDeltaEvent as aJ, type OpenAIResponsesOutputTextDoneEvent as aK, type OpenAIResponsesQueuedEvent as aL, type OpenAIResponsesReasoningSummaryPartAddedEvent as aM, type OpenAIResponsesReasoningSummaryPartDoneEvent as aN, type OpenAIResponsesReasoningSummaryTextDeltaEvent as aO, type OpenAIResponsesReasoningSummaryTextDoneEvent as aP, type OpenAIResponsesReasoningTextDeltaEvent as aQ, type OpenAIResponsesReasoningTextDoneEvent as aR, type OpenAIResponsesRefusalDeltaEvent as aS, type OpenAIResponsesRefusalDoneEvent as aT, type OpenAIResponsesStatus as aU, OpenAIResponsesStream as aV, OpenAIResponsesStreamError as aW, type OpenAIResponsesUsage as aX, type OpenAIStreamOptions as aY, type OpenAITextContentPart as aZ, type OpenAITool as a_, type OpenAIChatCompletionChoice as aa, type OpenAIChatCompletionChunkChoice as ab, type OpenAIChatCompletionDelta as ac, OpenAIChatCompletionStream as ad, type OpenAICompletionChoice as ae, OpenAICompletionStream as af, type OpenAIContentPart as ag, type OpenAIEmbeddingInput as ah, type OpenAIEmbeddingItem as ai, type OpenAIFunctionDefinition as aj, type OpenAIImageUrlContentPart as ak, type OpenAIMessage as al, type OpenAIReasoningEffort as am, type OpenAIResponseFormat as an, type OpenAIResponsesCompletedEvent as ao, type OpenAIResponsesContentPartAddedEvent as ap, type OpenAIResponsesContentPartDoneEvent as aq, type OpenAIResponsesCreatedEvent as ar, type OpenAIResponsesError as as, type OpenAIResponsesEventBase as at, type OpenAIResponsesFailedEvent as au, type OpenAIResponsesFunctionCallArgumentsDeltaEvent as av, type OpenAIResponsesFunctionCallArgumentsDoneEvent as aw, type OpenAIResponsesInProgressEvent as ax, type OpenAIResponsesIncompleteDetails as ay, type OpenAIResponsesIncompleteEvent as az, type OpenAIChatCompletionChunk as b, type OpenAIToolCallDelta as b0, type OpenAIUsage as b1, type SystemOneConfidence as b2, type SystemOneProbabilities as b3, type OpenAICompletionRequest as c, type OpenAICompletionResponse as d, type OpenAICompletionChunk as e, type OpenAIEmbeddingRequest as f, type OpenAIEmbeddingResponse as g, type OpenAIListModelsResponse as h, type OpenAIModelItem as i, type OpenAIResponsesRequest as j, type OpenAIResponsesResponse as k, type OpenAIResponsesStreamEvent as l, type AnthropicMessagesResponse as m, type AnthropicMessageStreamEvent as n, type SystemOneNoulAnswer as o, type SystemOneScoreAnswer as p, type SystemOneChoiceQuestion as q, type SystemOneNoulQuestion as r, type SystemOneScoreQuestion as s, type SystemOneRequest as t, type SystemOneResponse as u, type SystemOneContent as v, OpenAICompatClient as w, AnthropicCompatClient as x, type AnthropicCacheControl as y, type AnthropicContentBlock as z };
|
|
@@ -484,7 +484,7 @@ interface SystemOneChoiceAnswer {
|
|
|
484
484
|
interface SystemOneChoiceQuestion {
|
|
485
485
|
readonly type: 'choice';
|
|
486
486
|
readonly instructions: SystemOneContent;
|
|
487
|
-
/** Option keys mapped to descriptions
|
|
487
|
+
/** Option keys mapped to descriptions, or null for a bare label. Keys must not be blank; ties follow the model's option order. The option limit depends on the model. */
|
|
488
488
|
readonly criteria: {
|
|
489
489
|
[key: string]: string | null;
|
|
490
490
|
};
|
|
@@ -528,7 +528,7 @@ interface SystemOneNoulAnswer {
|
|
|
528
528
|
interface SystemOneNoulQuestion {
|
|
529
529
|
readonly type: 'noul';
|
|
530
530
|
readonly instructions: SystemOneContent;
|
|
531
|
-
/** Optional descriptions for the two outcomes. Omitted entries use
|
|
531
|
+
/** Optional descriptions for the two outcomes. Omitted entries use model-specific defaults. */
|
|
532
532
|
readonly criteria?: {
|
|
533
533
|
readonly false?: string | undefined;
|
|
534
534
|
readonly true?: string | undefined;
|
|
@@ -614,7 +614,7 @@ interface SystemOneScoreAnswer {
|
|
|
614
614
|
interface SystemOneScoreQuestion {
|
|
615
615
|
readonly type: 'score';
|
|
616
616
|
readonly instructions: SystemOneContent;
|
|
617
|
-
/** Descriptions ordered from the lowest score (index 0) to the highest. Defines a scale from 0 to the number of criteria minus 1. */
|
|
617
|
+
/** Descriptions ordered from the lowest score (index 0) to the highest. Defines a scale from 0 to the number of criteria minus 1. The maximum number of levels depends on the model. */
|
|
618
618
|
readonly criteria: readonly string[];
|
|
619
619
|
}
|
|
620
620
|
|
|
@@ -721,7 +721,7 @@ declare class NativeApi {
|
|
|
721
721
|
chat(request: ChatRequest & {
|
|
722
722
|
stream: true;
|
|
723
723
|
}): Promise<AsyncGenerator<ChatResponse, void, undefined>>;
|
|
724
|
-
copy(request: CopyRequest): Promise<
|
|
724
|
+
copy(request: CopyRequest): Promise<StatusResponse>;
|
|
725
725
|
create(request: CreateRequest & {
|
|
726
726
|
stream?: false;
|
|
727
727
|
}): Promise<StatusResponse>;
|
|
@@ -859,11 +859,18 @@ interface OpenAIChatCompletionRequest {
|
|
|
859
859
|
readonly seed?: number | undefined;
|
|
860
860
|
readonly presence_penalty?: number | undefined;
|
|
861
861
|
readonly frequency_penalty?: number | undefined;
|
|
862
|
+
/** @remarks Documented as unsupported by Ollama — accepted for OpenAI interop, ignored by the server. */
|
|
862
863
|
readonly user?: string | undefined;
|
|
864
|
+
/** @remarks Documented as unsupported by Ollama — accepted for OpenAI interop, ignored by the server. */
|
|
863
865
|
readonly logit_bias?: Record<string, number> | undefined;
|
|
866
|
+
/** @remarks Documented as unsupported by Ollama — accepted for OpenAI interop, ignored by the server. */
|
|
864
867
|
readonly n?: number | undefined;
|
|
865
|
-
/**
|
|
868
|
+
/**
|
|
869
|
+
* @remarks Logprobs are documented as unsupported on Ollama's `/v1/chat/completions`.
|
|
870
|
+
* Use native `chat({ logprobs: true, top_logprobs })` for token log probabilities.
|
|
871
|
+
*/
|
|
866
872
|
readonly logprobs?: boolean | undefined;
|
|
873
|
+
/** @remarks Documented as unsupported by Ollama — accepted for OpenAI interop, ignored by the server. */
|
|
867
874
|
readonly top_logprobs?: number | undefined;
|
|
868
875
|
readonly tools?: readonly OpenAITool[] | undefined;
|
|
869
876
|
/**
|
|
@@ -895,18 +902,34 @@ interface OpenAIChatCompletionRequest {
|
|
|
895
902
|
readonly effort?: OpenAIReasoningEffort | undefined;
|
|
896
903
|
} | undefined;
|
|
897
904
|
}
|
|
898
|
-
/**
|
|
905
|
+
/** A base64 data URL (`data:image/png;base64,...`) — the only image form Ollama accepts here. */
|
|
906
|
+
type OllamaOpenAIImageDataUrl = `data:${string}`;
|
|
907
|
+
/** Ollama Chat Completions supports text plus base64 image content. */
|
|
899
908
|
type OllamaOpenAIChatContentPart = OpenAITextContentPart | {
|
|
900
909
|
readonly type: 'image_url';
|
|
901
|
-
/**
|
|
902
|
-
|
|
910
|
+
/**
|
|
911
|
+
* A base64 `data:` URL, as a string or inside the OpenAI `{ url, detail? }` object.
|
|
912
|
+
* Ollama documents remote image URLs as unsupported on `/v1/chat/completions`, so
|
|
913
|
+
* `http(s)://` URLs are a compile error here; resolve remote images to base64 first
|
|
914
|
+
* (e.g. with {@link resolveImageInput}) or use the native `images` field.
|
|
915
|
+
*/
|
|
916
|
+
readonly image_url: OllamaOpenAIImageDataUrl | {
|
|
917
|
+
readonly url: OllamaOpenAIImageDataUrl;
|
|
918
|
+
readonly detail?: 'auto' | 'low' | 'high' | 'original' | undefined;
|
|
919
|
+
};
|
|
903
920
|
};
|
|
904
921
|
type OllamaOpenAIReasoningEffort = 'high' | 'medium' | 'low' | 'max' | 'none';
|
|
905
922
|
type OllamaOpenAIChatMessage = Omit<OpenAIMessage, 'content'> & {
|
|
906
923
|
readonly content: string | readonly OllamaOpenAIChatContentPart[];
|
|
907
924
|
};
|
|
908
|
-
/**
|
|
909
|
-
|
|
925
|
+
/**
|
|
926
|
+
* Strict Ollama-documented Chat Completions request. Excludes the fields
|
|
927
|
+
* https://docs.ollama.com/api/openai-compatibility marks unsupported (`tool_choice`,
|
|
928
|
+
* `logit_bias`, `user`, `n`, `logprobs`/`top_logprobs`) and the SDK-only
|
|
929
|
+
* `parallel_tool_calls` flag, so passing any of them is a compile-time error instead of
|
|
930
|
+
* a silently ignored request field.
|
|
931
|
+
*/
|
|
932
|
+
type OllamaOpenAIChatCompletionRequest = Omit<OpenAIChatCompletionRequest, 'messages' | 'parallel_tool_calls' | 'reasoning_effort' | 'reasoning' | 'tool_choice' | 'logit_bias' | 'user' | 'n' | 'logprobs' | 'top_logprobs'> & {
|
|
910
933
|
readonly messages: readonly OllamaOpenAIChatMessage[];
|
|
911
934
|
readonly reasoning_effort?: OllamaOpenAIReasoningEffort | undefined;
|
|
912
935
|
readonly reasoning?: {
|
|
@@ -985,7 +1008,10 @@ interface OpenAICompletionRequest {
|
|
|
985
1008
|
readonly model: string;
|
|
986
1009
|
/** Ollama currently accepts a string prompt for /v1/completions. */
|
|
987
1010
|
readonly prompt: string;
|
|
988
|
-
/**
|
|
1011
|
+
/**
|
|
1012
|
+
* @remarks Logprobs are documented as unsupported on Ollama's `/v1/completions`. Use
|
|
1013
|
+
* native `generate({ logprobs: true, top_logprobs })` for token log probabilities.
|
|
1014
|
+
*/
|
|
989
1015
|
readonly logprobs?: number | undefined;
|
|
990
1016
|
readonly frequency_penalty?: number | undefined;
|
|
991
1017
|
readonly presence_penalty?: number | undefined;
|
|
@@ -997,14 +1023,23 @@ interface OpenAICompletionRequest {
|
|
|
997
1023
|
readonly top_p?: number | undefined;
|
|
998
1024
|
readonly max_tokens?: number | undefined;
|
|
999
1025
|
readonly suffix?: string | undefined;
|
|
1026
|
+
/** @remarks Documented as unsupported by Ollama — accepted for OpenAI interop, ignored by the server. */
|
|
1000
1027
|
readonly best_of?: number | undefined;
|
|
1028
|
+
/** @remarks Documented as unsupported by Ollama — accepted for OpenAI interop, ignored by the server. */
|
|
1001
1029
|
readonly echo?: boolean | undefined;
|
|
1030
|
+
/** @remarks Documented as unsupported by Ollama — accepted for OpenAI interop, ignored by the server. */
|
|
1002
1031
|
readonly logit_bias?: Record<string, number> | undefined;
|
|
1032
|
+
/** @remarks Documented as unsupported by Ollama — accepted for OpenAI interop, ignored by the server. */
|
|
1003
1033
|
readonly user?: string | undefined;
|
|
1034
|
+
/** @remarks Documented as unsupported by Ollama — accepted for OpenAI interop, ignored by the server. */
|
|
1004
1035
|
readonly n?: number | undefined;
|
|
1005
1036
|
}
|
|
1006
1037
|
/** Strict Ollama-documented Completions request. */
|
|
1007
|
-
|
|
1038
|
+
/**
|
|
1039
|
+
* Strict Ollama-documented Completions request: excludes `best_of`, `echo`,
|
|
1040
|
+
* `logit_bias`, `user`, `n`, and `logprobs`, which Ollama documents as unsupported.
|
|
1041
|
+
*/
|
|
1042
|
+
type OllamaOpenAICompletionRequest = Omit<OpenAICompletionRequest, 'best_of' | 'echo' | 'logit_bias' | 'user' | 'n' | 'logprobs'>;
|
|
1008
1043
|
interface OpenAICompletionChoice {
|
|
1009
1044
|
readonly text: string;
|
|
1010
1045
|
readonly index: number;
|
|
@@ -1044,10 +1079,18 @@ interface OpenAIEmbeddingRequest {
|
|
|
1044
1079
|
readonly input: OpenAIEmbeddingInput;
|
|
1045
1080
|
readonly encoding_format?: 'float' | 'base64' | undefined;
|
|
1046
1081
|
readonly dimensions?: number | undefined;
|
|
1082
|
+
/** @remarks Documented as unsupported by Ollama — accepted for OpenAI interop, ignored by the server. */
|
|
1047
1083
|
readonly user?: string | undefined;
|
|
1048
1084
|
}
|
|
1049
1085
|
/** Strict Ollama-documented Embeddings request. */
|
|
1050
|
-
|
|
1086
|
+
/**
|
|
1087
|
+
* Strict Ollama-documented Embeddings request: `input` is a string or an array of
|
|
1088
|
+
* strings (token and token-array inputs are documented as unsupported), and `user` is
|
|
1089
|
+
* excluded.
|
|
1090
|
+
*/
|
|
1091
|
+
type OllamaOpenAIEmbeddingRequest = Omit<OpenAIEmbeddingRequest, 'input' | 'user'> & {
|
|
1092
|
+
readonly input: string | readonly string[];
|
|
1093
|
+
};
|
|
1051
1094
|
interface OpenAIEmbeddingItem {
|
|
1052
1095
|
readonly object: 'embedding';
|
|
1053
1096
|
readonly embedding: readonly number[] | string;
|
|
@@ -1084,6 +1127,7 @@ interface OpenAIResponsesRequest {
|
|
|
1084
1127
|
readonly previous_response_id?: string | undefined;
|
|
1085
1128
|
/** @remarks Not supported by Ollama, which is stateless across calls — accepted but ignored. */
|
|
1086
1129
|
readonly conversation?: string | undefined;
|
|
1130
|
+
/** @remarks Documented as unsupported by Ollama — accepted but ignored. */
|
|
1087
1131
|
readonly truncation?: string | undefined;
|
|
1088
1132
|
readonly reasoning?: {
|
|
1089
1133
|
readonly effort?: OpenAIReasoningEffort | undefined;
|
|
@@ -1091,9 +1135,12 @@ interface OpenAIResponsesRequest {
|
|
|
1091
1135
|
/** Ollama extension: boolean, model-defined string, or null for model default. */
|
|
1092
1136
|
readonly think?: boolean | string | null | undefined;
|
|
1093
1137
|
}
|
|
1094
|
-
/**
|
|
1095
|
-
|
|
1096
|
-
|
|
1138
|
+
/**
|
|
1139
|
+
* Strict Ollama-documented Responses request: excludes the stateful fields
|
|
1140
|
+
* (`previous_response_id`, `conversation`) and `truncation`, which Ollama documents as
|
|
1141
|
+
* unsupported.
|
|
1142
|
+
*/
|
|
1143
|
+
type OllamaOpenAIResponsesRequest = Omit<OpenAIResponsesRequest, 'previous_response_id' | 'conversation' | 'truncation'>;
|
|
1097
1144
|
type OpenAIResponsesStatus = 'completed' | 'failed' | 'in_progress' | 'cancelled' | 'queued' | 'incomplete';
|
|
1098
1145
|
interface OpenAIResponsesError {
|
|
1099
1146
|
readonly code?: string | undefined;
|
|
@@ -1646,4 +1693,4 @@ declare class AnthropicCompatClient {
|
|
|
1646
1693
|
messages(request: AnthropicMessagesRequest, signal?: AbortSignal): Promise<AnthropicMessagesResponse | AnthropicMessagesStream>;
|
|
1647
1694
|
}
|
|
1648
1695
|
|
|
1649
|
-
export { type OllamaAnthropicThinkingConfig as $, type AnthropicMessagesRequest as A, type AnthropicImageContentBlock as B, type AnthropicMessage as C, AnthropicMessagesStream as D, type AnthropicMetadata as E, type AnthropicOutputConfig as F, type AnthropicRedactedThinkingContentBlock as G, type AnthropicSystem as H, type AnthropicSystemTextBlock as I, type AnthropicTextContentBlock as J, type AnthropicThinkingConfig as K, type AnthropicThinkingContentBlock as L, type AnthropicTool as M, NativeApi as N, type OpenAIChatCompletionRequest as O, type AnthropicToolChoice as P, type AnthropicToolResultContentBlock as Q, type RequestRunner as R, type SystemOneChoiceAnswer as S, type AnthropicToolUseContentBlock as T, type AnthropicUnknownStreamEvent as U, type OllamaAnthropicContentBlock as V, type OllamaAnthropicMessage as W, type OllamaAnthropicMessagesRequest as X, type OllamaAnthropicSystem as Y, type OllamaAnthropicSystemTextBlock as Z, type OllamaAnthropicTextContentBlock as _, type OpenAIChatCompletionResponse as a, type
|
|
1696
|
+
export { type OllamaAnthropicThinkingConfig as $, type AnthropicMessagesRequest as A, type AnthropicImageContentBlock as B, type AnthropicMessage as C, AnthropicMessagesStream as D, type AnthropicMetadata as E, type AnthropicOutputConfig as F, type AnthropicRedactedThinkingContentBlock as G, type AnthropicSystem as H, type AnthropicSystemTextBlock as I, type AnthropicTextContentBlock as J, type AnthropicThinkingConfig as K, type AnthropicThinkingContentBlock as L, type AnthropicTool as M, NativeApi as N, type OpenAIChatCompletionRequest as O, type AnthropicToolChoice as P, type AnthropicToolResultContentBlock as Q, type RequestRunner as R, type SystemOneChoiceAnswer as S, type AnthropicToolUseContentBlock as T, type AnthropicUnknownStreamEvent as U, type OllamaAnthropicContentBlock as V, type OllamaAnthropicMessage as W, type OllamaAnthropicMessagesRequest as X, type OllamaAnthropicSystem as Y, type OllamaAnthropicSystemTextBlock as Z, type OllamaAnthropicTextContentBlock as _, type OpenAIChatCompletionResponse as a, type OpenAIToolCall as a$, type OllamaAnthropicTool as a0, type OllamaAnthropicToolResultContentBlock as a1, type OllamaOpenAIChatCompletionRequest as a2, type OllamaOpenAIChatContentPart as a3, type OllamaOpenAIChatMessage as a4, type OllamaOpenAICompletionRequest as a5, type OllamaOpenAIEmbeddingRequest as a6, type OllamaOpenAIImageDataUrl as a7, type OllamaOpenAIReasoningEffort as a8, type OllamaOpenAIResponsesRequest as a9, type OpenAIResponsesOutputContent as aA, type OpenAIResponsesOutputFunctionCall as aB, type OpenAIResponsesOutputItem as aC, type OpenAIResponsesOutputItemAddedEvent as aD, type OpenAIResponsesOutputItemDoneEvent as aE, type OpenAIResponsesOutputMessage as aF, type OpenAIResponsesOutputReasoning as aG, type OpenAIResponsesOutputRefusal as aH, type OpenAIResponsesOutputTextContent as aI, type OpenAIResponsesOutputTextDeltaEvent as aJ, type OpenAIResponsesOutputTextDoneEvent as aK, type OpenAIResponsesQueuedEvent as aL, type OpenAIResponsesReasoningSummaryPartAddedEvent as aM, type OpenAIResponsesReasoningSummaryPartDoneEvent as aN, type OpenAIResponsesReasoningSummaryTextDeltaEvent as aO, type OpenAIResponsesReasoningSummaryTextDoneEvent as aP, type OpenAIResponsesReasoningTextDeltaEvent as aQ, type OpenAIResponsesReasoningTextDoneEvent as aR, type OpenAIResponsesRefusalDeltaEvent as aS, type OpenAIResponsesRefusalDoneEvent as aT, type OpenAIResponsesStatus as aU, OpenAIResponsesStream as aV, OpenAIResponsesStreamError as aW, type OpenAIResponsesUsage as aX, type OpenAIStreamOptions as aY, type OpenAITextContentPart as aZ, type OpenAITool as a_, type OpenAIChatCompletionChoice as aa, type OpenAIChatCompletionChunkChoice as ab, type OpenAIChatCompletionDelta as ac, OpenAIChatCompletionStream as ad, type OpenAICompletionChoice as ae, OpenAICompletionStream as af, type OpenAIContentPart as ag, type OpenAIEmbeddingInput as ah, type OpenAIEmbeddingItem as ai, type OpenAIFunctionDefinition as aj, type OpenAIImageUrlContentPart as ak, type OpenAIMessage as al, type OpenAIReasoningEffort as am, type OpenAIResponseFormat as an, type OpenAIResponsesCompletedEvent as ao, type OpenAIResponsesContentPartAddedEvent as ap, type OpenAIResponsesContentPartDoneEvent as aq, type OpenAIResponsesCreatedEvent as ar, type OpenAIResponsesError as as, type OpenAIResponsesEventBase as at, type OpenAIResponsesFailedEvent as au, type OpenAIResponsesFunctionCallArgumentsDeltaEvent as av, type OpenAIResponsesFunctionCallArgumentsDoneEvent as aw, type OpenAIResponsesInProgressEvent as ax, type OpenAIResponsesIncompleteDetails as ay, type OpenAIResponsesIncompleteEvent as az, type OpenAIChatCompletionChunk as b, type OpenAIToolCallDelta as b0, type OpenAIUsage as b1, type SystemOneConfidence as b2, type SystemOneProbabilities as b3, type OpenAICompletionRequest as c, type OpenAICompletionResponse as d, type OpenAICompletionChunk as e, type OpenAIEmbeddingRequest as f, type OpenAIEmbeddingResponse as g, type OpenAIListModelsResponse as h, type OpenAIModelItem as i, type OpenAIResponsesRequest as j, type OpenAIResponsesResponse as k, type OpenAIResponsesStreamEvent as l, type AnthropicMessagesResponse as m, type AnthropicMessageStreamEvent as n, type SystemOneNoulAnswer as o, type SystemOneScoreAnswer as p, type SystemOneChoiceQuestion as q, type SystemOneNoulQuestion as r, type SystemOneScoreQuestion as s, type SystemOneRequest as t, type SystemOneResponse as u, type SystemOneContent as v, OpenAICompatClient as w, AnthropicCompatClient as x, type AnthropicCacheControl as y, type AnthropicContentBlock as z };
|
package/dist/generated-api.cjs
CHANGED
|
@@ -61,6 +61,7 @@ var copyOp = {
|
|
|
61
61
|
method: "POST",
|
|
62
62
|
path: "/api/copy",
|
|
63
63
|
request: { $ref: "#/schemas/CopyRequest" },
|
|
64
|
+
response: { $ref: "#/schemas/StatusResponse" },
|
|
64
65
|
environment: { local: true, cloud: false },
|
|
65
66
|
transport: { mode: "json", streaming: false },
|
|
66
67
|
capabilities: {},
|
|
@@ -304,7 +305,7 @@ var openaiChatCompletionsOp = {
|
|
|
304
305
|
tools: "model-dependent",
|
|
305
306
|
vision: "model-dependent",
|
|
306
307
|
structuredOutput: "supported",
|
|
307
|
-
logprobs: "
|
|
308
|
+
logprobs: "unsupported"
|
|
308
309
|
},
|
|
309
310
|
status: { documented: true },
|
|
310
311
|
domain: "openai",
|
|
@@ -318,7 +319,7 @@ var openaiCompletionsOp = {
|
|
|
318
319
|
path: "/v1/completions",
|
|
319
320
|
environment: { local: true, cloud: true },
|
|
320
321
|
transport: { mode: "sse", streaming: true, streamingDefault: false },
|
|
321
|
-
capabilities: { logprobs: "
|
|
322
|
+
capabilities: { logprobs: "unsupported" },
|
|
322
323
|
status: { documented: true },
|
|
323
324
|
domain: "openai"
|
|
324
325
|
};
|