@nemesis-oss/ollama-sdk 1.16.0 → 1.18.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 +60 -0
- package/README.md +127 -1
- package/dist/{anthropic-AKbXnWJU.d.cts → anthropic-BvHOsidk.d.cts} +3 -3
- package/dist/{anthropic-CTv2acbj.d.ts → anthropic-CvGVSoVP.d.ts} +3 -3
- package/dist/generated-api.d.cts +2 -2
- package/dist/generated-api.d.ts +2 -2
- package/dist/generated-models-schemas.cjs +2 -2
- package/dist/generated-models-schemas.cjs.map +1 -1
- package/dist/generated-models-schemas.js +2 -2
- package/dist/generated-models-schemas.js.map +1 -1
- package/dist/generated-runtime.cjs +2 -2
- package/dist/generated-runtime.cjs.map +1 -1
- package/dist/generated-runtime.js +2 -2
- package/dist/generated-runtime.js.map +1 -1
- package/dist/index.cjs +180 -33
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +255 -14
- package/dist/index.d.ts +255 -14
- package/dist/index.js +177 -34
- package/dist/index.js.map +1 -1
- package/dist/mcp/tools.json +6 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1111,6 +1111,18 @@ function createRequestId() {
|
|
|
1111
1111
|
requestSequence += 1;
|
|
1112
1112
|
return `ollama-http-${requestSequence}`;
|
|
1113
1113
|
}
|
|
1114
|
+
function isWebReadableStreamBody(body) {
|
|
1115
|
+
return typeof body === "object" && body !== null && typeof body.getReader === "function";
|
|
1116
|
+
}
|
|
1117
|
+
function buildFetchInit(req) {
|
|
1118
|
+
return {
|
|
1119
|
+
method: req.method,
|
|
1120
|
+
headers: req.headers,
|
|
1121
|
+
...req.body !== void 0 ? { body: req.body } : {},
|
|
1122
|
+
...req.signal !== void 0 ? { signal: req.signal } : {},
|
|
1123
|
+
...isWebReadableStreamBody(req.body) ? { duplex: "half" } : {}
|
|
1124
|
+
};
|
|
1125
|
+
}
|
|
1114
1126
|
function sameHeaders(actual, expected) {
|
|
1115
1127
|
const actualEntries = Object.fromEntries(
|
|
1116
1128
|
Object.entries(actual).map(([key, value]) => [key.toLowerCase(), value])
|
|
@@ -1160,13 +1172,7 @@ var HttpClient = class {
|
|
|
1160
1172
|
timestamp: startedAt
|
|
1161
1173
|
});
|
|
1162
1174
|
const finalHandler = async (req) => {
|
|
1163
|
-
const
|
|
1164
|
-
method: req.method,
|
|
1165
|
-
headers: req.headers,
|
|
1166
|
-
...req.body !== void 0 ? { body: req.body } : {},
|
|
1167
|
-
...req.signal !== void 0 ? { signal: req.signal } : {}
|
|
1168
|
-
};
|
|
1169
|
-
const response = await this.fetchImpl(req.url, init);
|
|
1175
|
+
const response = await this.fetchImpl(req.url, buildFetchInit(req));
|
|
1170
1176
|
rawResponse = response;
|
|
1171
1177
|
const responseHeaders = response.headers && typeof response.headers.entries === "function" ? Object.fromEntries(response.headers.entries()) : {};
|
|
1172
1178
|
return {
|
|
@@ -1177,12 +1183,7 @@ var HttpClient = class {
|
|
|
1177
1183
|
};
|
|
1178
1184
|
try {
|
|
1179
1185
|
if (this.middleware.length === 0) {
|
|
1180
|
-
const response2 = await this.fetchImpl(request.url,
|
|
1181
|
-
method: request.method,
|
|
1182
|
-
headers: request.headers,
|
|
1183
|
-
...request.body !== void 0 ? { body: request.body } : {},
|
|
1184
|
-
...request.signal !== void 0 ? { signal: request.signal } : {}
|
|
1185
|
-
});
|
|
1186
|
+
const response2 = await this.fetchImpl(request.url, buildFetchInit(request));
|
|
1186
1187
|
if (response2.status >= 200 && response2.status < 300) {
|
|
1187
1188
|
this.onLifecycleEvent?.({
|
|
1188
1189
|
type: "success",
|
|
@@ -2773,7 +2774,7 @@ var ModelsClient = class {
|
|
|
2773
2774
|
{ model, singleEndpoint: true }
|
|
2774
2775
|
);
|
|
2775
2776
|
}
|
|
2776
|
-
async createBlob(digest, data) {
|
|
2777
|
+
async createBlob(digest, data, request) {
|
|
2777
2778
|
await this.runner(
|
|
2778
2779
|
(http, signal) => http.request({
|
|
2779
2780
|
path: `/api/blobs/${encodeURIComponent(digest)}`,
|
|
@@ -2781,10 +2782,10 @@ var ModelsClient = class {
|
|
|
2781
2782
|
rawBody: data,
|
|
2782
2783
|
signal
|
|
2783
2784
|
}),
|
|
2784
|
-
{ singleEndpoint: true }
|
|
2785
|
+
{ ...request, singleEndpoint: true }
|
|
2785
2786
|
);
|
|
2786
2787
|
}
|
|
2787
|
-
async checkBlob(digest) {
|
|
2788
|
+
async checkBlob(digest, request) {
|
|
2788
2789
|
try {
|
|
2789
2790
|
await this.runner(
|
|
2790
2791
|
(http, signal) => http.request({
|
|
@@ -2792,7 +2793,7 @@ var ModelsClient = class {
|
|
|
2792
2793
|
method: "HEAD",
|
|
2793
2794
|
signal
|
|
2794
2795
|
}),
|
|
2795
|
-
{ singleEndpoint: true }
|
|
2796
|
+
{ ...request, singleEndpoint: true }
|
|
2796
2797
|
);
|
|
2797
2798
|
return true;
|
|
2798
2799
|
} catch (err) {
|
|
@@ -2834,9 +2835,32 @@ var ModelsClient = class {
|
|
|
2834
2835
|
*/
|
|
2835
2836
|
async createBlobFromData(data, opts) {
|
|
2836
2837
|
const digest = opts?.digest ?? await this.computeBlobDigest(data);
|
|
2837
|
-
const alreadyExisted = await this.checkBlob(digest);
|
|
2838
|
+
const alreadyExisted = await this.checkBlob(digest, opts);
|
|
2838
2839
|
if (!alreadyExisted) {
|
|
2839
|
-
await this.createBlob(digest, data);
|
|
2840
|
+
await this.createBlob(digest, data, opts);
|
|
2841
|
+
}
|
|
2842
|
+
return { digest, alreadyExisted };
|
|
2843
|
+
}
|
|
2844
|
+
/**
|
|
2845
|
+
* Streams a blob upload straight from a web `ReadableStream` — the
|
|
2846
|
+
* multi-gigabyte-safe counterpart of {@link createBlobFromData}. The body
|
|
2847
|
+
* is never materialized in memory: the transport hands the stream to
|
|
2848
|
+
* `fetch` directly (setting `duplex: 'half'`, which Node 18+ requires for
|
|
2849
|
+
* stream bodies), so peak heap usage is a transport-level chunk, not the
|
|
2850
|
+
* blob size.
|
|
2851
|
+
*
|
|
2852
|
+
* The digest must be known up front — it *is* the upload URL
|
|
2853
|
+
* (`/api/blobs/<digest>`), the same content-addressed protocol
|
|
2854
|
+
* `curl -T` performs. Hash first when you don't have it: in-memory bytes
|
|
2855
|
+
* via {@link computeBlobDigest}, files via {@link createBlobFromFile}
|
|
2856
|
+
* (which hashes in a streaming pass). The server verifies the streamed
|
|
2857
|
+
* bytes against the digest and rejects mismatches, so a corrupted or
|
|
2858
|
+
* truncated stream fails the upload instead of poisoning the store.
|
|
2859
|
+
*/
|
|
2860
|
+
async createBlobFromStream(digest, stream, request) {
|
|
2861
|
+
const alreadyExisted = await this.checkBlob(digest, request);
|
|
2862
|
+
if (!alreadyExisted) {
|
|
2863
|
+
await this.createBlob(digest, stream, request);
|
|
2840
2864
|
}
|
|
2841
2865
|
return { digest, alreadyExisted };
|
|
2842
2866
|
}
|
|
@@ -2845,16 +2869,61 @@ var ModelsClient = class {
|
|
|
2845
2869
|
* `node:fs` import, so browser bundles never pull it in). The file name
|
|
2846
2870
|
* (basename) is what `/api/create`'s `files` map expects as the key, so
|
|
2847
2871
|
* this returns it alongside the digest.
|
|
2872
|
+
*
|
|
2873
|
+
* Streams both passes in fixed-size chunks — peak heap is O(chunk), not
|
|
2874
|
+
* O(file), so multi-gigabyte GGUFs never enter the Node heap:
|
|
2875
|
+
*
|
|
2876
|
+
* 1. **Hash pass** (skipped when `opts.digest` is provided): the file is
|
|
2877
|
+
* streamed through `node:crypto`'s incremental SHA-256.
|
|
2878
|
+
* 2. **Upload pass**: `node:fs` createReadStream → web ReadableStream →
|
|
2879
|
+
* `fetch` body with `duplex: 'half'` (see {@link createBlobFromStream}).
|
|
2880
|
+
*
|
|
2881
|
+
* A pre-existing blob (HEAD 200) skips the upload pass entirely, same as
|
|
2882
|
+
* {@link createBlobFromData}.
|
|
2848
2883
|
*/
|
|
2849
2884
|
async createBlobFromFile(path, opts) {
|
|
2850
2885
|
const nodeFsModule = "node:fs";
|
|
2851
|
-
const {
|
|
2852
|
-
const
|
|
2853
|
-
const
|
|
2854
|
-
|
|
2855
|
-
});
|
|
2886
|
+
const { createReadStream } = await import(nodeFsModule);
|
|
2887
|
+
const nodeCryptoModule = "node:crypto";
|
|
2888
|
+
const { createHash } = await import(nodeCryptoModule);
|
|
2889
|
+
const nodeStreamModule = "node:stream";
|
|
2890
|
+
const { Readable } = await import(nodeStreamModule);
|
|
2891
|
+
const CHUNK_BYTES = 256 * 1024;
|
|
2892
|
+
let digest = opts?.digest;
|
|
2893
|
+
if (digest === void 0) {
|
|
2894
|
+
const hash = createHash("sha256");
|
|
2895
|
+
const hashStream = createReadStream(path, { highWaterMark: CHUNK_BYTES });
|
|
2896
|
+
try {
|
|
2897
|
+
for await (const chunk of hashStream) {
|
|
2898
|
+
if (opts?.signal?.aborted) {
|
|
2899
|
+
throw new OllamaAbortError("createBlobFromFile: aborted while hashing", {});
|
|
2900
|
+
}
|
|
2901
|
+
hash.update(chunk);
|
|
2902
|
+
}
|
|
2903
|
+
} finally {
|
|
2904
|
+
hashStream.destroy();
|
|
2905
|
+
}
|
|
2906
|
+
digest = `sha256:${hash.digest("hex")}`;
|
|
2907
|
+
}
|
|
2908
|
+
const alreadyExisted = await this.checkBlob(digest, opts);
|
|
2909
|
+
if (!alreadyExisted) {
|
|
2910
|
+
const uploadStream = createReadStream(path, { highWaterMark: CHUNK_BYTES });
|
|
2911
|
+
const onAbort = () => {
|
|
2912
|
+
uploadStream.destroy();
|
|
2913
|
+
};
|
|
2914
|
+
opts?.signal?.addEventListener("abort", onAbort, { once: true });
|
|
2915
|
+
try {
|
|
2916
|
+
await this.createBlob(
|
|
2917
|
+
digest,
|
|
2918
|
+
Readable.toWeb(uploadStream),
|
|
2919
|
+
opts
|
|
2920
|
+
);
|
|
2921
|
+
} finally {
|
|
2922
|
+
opts?.signal?.removeEventListener("abort", onAbort);
|
|
2923
|
+
}
|
|
2924
|
+
}
|
|
2856
2925
|
const fileName = path.split(/[\\/]/).pop() ?? path;
|
|
2857
|
-
return {
|
|
2926
|
+
return { digest, alreadyExisted, fileName };
|
|
2858
2927
|
}
|
|
2859
2928
|
/**
|
|
2860
2929
|
* One-shot custom-model publishing from raw GGUF weights, following the
|
|
@@ -4108,7 +4177,7 @@ var SystemOneNoulQuestionSchema = z.object({
|
|
|
4108
4177
|
var SystemOneScoreQuestionSchema = z.object({
|
|
4109
4178
|
type: z.enum(["score"]),
|
|
4110
4179
|
instructions: SystemOneContentSchema,
|
|
4111
|
-
criteria: z.array(z.string()).min(2).max(
|
|
4180
|
+
criteria: z.array(z.string()).min(2).max(10)
|
|
4112
4181
|
});
|
|
4113
4182
|
|
|
4114
4183
|
// src/generated/models/SystemOneRequest.schema.ts
|
|
@@ -4143,7 +4212,7 @@ var SystemOneNoulAnswerSchema = z.object({
|
|
|
4143
4212
|
});
|
|
4144
4213
|
var SystemOneScoreAnswerSchema = z.object({
|
|
4145
4214
|
type: z.enum(["score"]),
|
|
4146
|
-
score: z.number().min(0).max(
|
|
4215
|
+
score: z.number().min(0).max(9),
|
|
4147
4216
|
legend: z.object({}).catchall(z.string()),
|
|
4148
4217
|
probabilities: SystemOneProbabilitiesSchema,
|
|
4149
4218
|
confidence: SystemOneConfidenceSchema
|
|
@@ -5454,9 +5523,16 @@ var FailoverHttpClient = class {
|
|
|
5454
5523
|
};
|
|
5455
5524
|
|
|
5456
5525
|
// src/decision.ts
|
|
5526
|
+
function validateThreshold(value, name) {
|
|
5527
|
+
if (value === void 0) return;
|
|
5528
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0 || value > 1) {
|
|
5529
|
+
throw new RangeError(`${name} must be a number in (0, 1] \u2014 got ${String(value)}`);
|
|
5530
|
+
}
|
|
5531
|
+
}
|
|
5457
5532
|
function createDecision(client) {
|
|
5458
5533
|
return {
|
|
5459
5534
|
async choice(params) {
|
|
5535
|
+
validateThreshold(params.minConfidence, "minConfidence");
|
|
5460
5536
|
const response = await client.systemOne({
|
|
5461
5537
|
model: params.model,
|
|
5462
5538
|
state: params.state,
|
|
@@ -5475,10 +5551,12 @@ function createDecision(client) {
|
|
|
5475
5551
|
choice: answer.choice,
|
|
5476
5552
|
probabilities: answer.probabilities,
|
|
5477
5553
|
confidence: answer.confidence,
|
|
5554
|
+
...params.minConfidence !== void 0 ? { isConfident: answer.confidence >= params.minConfidence } : {},
|
|
5478
5555
|
usage: response.usage
|
|
5479
5556
|
};
|
|
5480
5557
|
},
|
|
5481
5558
|
async noul(params) {
|
|
5559
|
+
validateThreshold(params.minProbability, "minProbability");
|
|
5482
5560
|
const response = await client.systemOne({
|
|
5483
5561
|
model: params.model,
|
|
5484
5562
|
state: params.state,
|
|
@@ -5494,11 +5572,12 @@ function createDecision(client) {
|
|
|
5494
5572
|
const answer = response.answers.decision;
|
|
5495
5573
|
return {
|
|
5496
5574
|
noul: answer.noul,
|
|
5497
|
-
bool: answer.noul >= 0.5,
|
|
5575
|
+
bool: answer.noul >= (params.minProbability ?? 0.5),
|
|
5498
5576
|
usage: response.usage
|
|
5499
5577
|
};
|
|
5500
5578
|
},
|
|
5501
5579
|
async score(params) {
|
|
5580
|
+
validateThreshold(params.minConfidence, "minConfidence");
|
|
5502
5581
|
const response = await client.systemOne({
|
|
5503
5582
|
model: params.model,
|
|
5504
5583
|
state: params.state,
|
|
@@ -5518,10 +5597,12 @@ function createDecision(client) {
|
|
|
5518
5597
|
legend: answer.legend,
|
|
5519
5598
|
probabilities: answer.probabilities,
|
|
5520
5599
|
confidence: answer.confidence,
|
|
5600
|
+
...params.minConfidence !== void 0 ? { isConfident: answer.confidence >= params.minConfidence } : {},
|
|
5521
5601
|
usage: response.usage
|
|
5522
5602
|
};
|
|
5523
5603
|
},
|
|
5524
5604
|
async route(params) {
|
|
5605
|
+
validateThreshold(params.minConfidence, "minConfidence");
|
|
5525
5606
|
const response = await client.systemOne({
|
|
5526
5607
|
model: params.model,
|
|
5527
5608
|
state: params.state,
|
|
@@ -5538,10 +5619,12 @@ function createDecision(client) {
|
|
|
5538
5619
|
const answer = response.answers.decision;
|
|
5539
5620
|
return {
|
|
5540
5621
|
route: answer.choice,
|
|
5541
|
-
confidence: answer.confidence
|
|
5622
|
+
confidence: answer.confidence,
|
|
5623
|
+
...params.minConfidence !== void 0 ? { isConfident: answer.confidence >= params.minConfidence } : {}
|
|
5542
5624
|
};
|
|
5543
5625
|
},
|
|
5544
5626
|
async verify(params) {
|
|
5627
|
+
validateThreshold(params.minProbability, "minProbability");
|
|
5545
5628
|
const state = {
|
|
5546
5629
|
claim: params.claim,
|
|
5547
5630
|
evidence: params.evidence
|
|
@@ -5560,11 +5643,12 @@ function createDecision(client) {
|
|
|
5560
5643
|
});
|
|
5561
5644
|
const answer = response.answers.decision;
|
|
5562
5645
|
return {
|
|
5563
|
-
verified: answer.noul >= 0.5,
|
|
5646
|
+
verified: answer.noul >= (params.minProbability ?? 0.5),
|
|
5564
5647
|
probability: answer.noul
|
|
5565
5648
|
};
|
|
5566
5649
|
},
|
|
5567
5650
|
async rank(params) {
|
|
5651
|
+
validateThreshold(params.minConfidence, "minConfidence");
|
|
5568
5652
|
const promises = params.candidates.map(async (candidate) => {
|
|
5569
5653
|
const response = await client.systemOne({
|
|
5570
5654
|
model: params.model,
|
|
@@ -5583,7 +5667,8 @@ function createDecision(client) {
|
|
|
5583
5667
|
return {
|
|
5584
5668
|
candidate: candidate.id,
|
|
5585
5669
|
score: answer.score,
|
|
5586
|
-
confidence: answer.confidence
|
|
5670
|
+
confidence: answer.confidence,
|
|
5671
|
+
...params.minConfidence !== void 0 ? { isConfident: answer.confidence >= params.minConfidence } : {}
|
|
5587
5672
|
};
|
|
5588
5673
|
});
|
|
5589
5674
|
const results = await Promise.all(promises);
|
|
@@ -6194,8 +6279,8 @@ var OllamaClient = class _OllamaClient {
|
|
|
6194
6279
|
*/
|
|
6195
6280
|
getContextLength = (request) => this.models.getContextLength(request);
|
|
6196
6281
|
version = () => this.models.version();
|
|
6197
|
-
createBlob = (digest, data) => this.models.createBlob(digest, data);
|
|
6198
|
-
checkBlob = (digest) => this.models.checkBlob(digest);
|
|
6282
|
+
createBlob = (digest, data, request) => this.models.createBlob(digest, data, request);
|
|
6283
|
+
checkBlob = (digest, request) => this.models.checkBlob(digest, request);
|
|
6199
6284
|
/**
|
|
6200
6285
|
* Immediately unloads `model` from VRAM. Convenience alias for
|
|
6201
6286
|
* {@link ModelsClient.unload} — see that method for the full
|
|
@@ -6715,6 +6800,64 @@ function toResponse(stream, init = {}) {
|
|
|
6715
6800
|
return new Response(body, { ...init, headers });
|
|
6716
6801
|
}
|
|
6717
6802
|
|
|
6803
|
+
// src/streaming/progress.ts
|
|
6804
|
+
function computeProgressPercent(chunk) {
|
|
6805
|
+
if (typeof chunk.total !== "number" || typeof chunk.completed !== "number") return void 0;
|
|
6806
|
+
if (chunk.total <= 0) return void 0;
|
|
6807
|
+
const ratio = chunk.completed / chunk.total;
|
|
6808
|
+
const clamped = Math.max(0, Math.min(1, ratio));
|
|
6809
|
+
return Math.round(clamped * 1e4) / 100;
|
|
6810
|
+
}
|
|
6811
|
+
function toPullProgressEvent(chunk) {
|
|
6812
|
+
return {
|
|
6813
|
+
status: chunk.status,
|
|
6814
|
+
...chunk.digest !== void 0 ? { digest: chunk.digest } : {},
|
|
6815
|
+
...chunk.total !== void 0 ? { total: chunk.total } : {},
|
|
6816
|
+
...chunk.completed !== void 0 ? { completed: chunk.completed } : {},
|
|
6817
|
+
percent: computeProgressPercent(chunk),
|
|
6818
|
+
raw: chunk
|
|
6819
|
+
};
|
|
6820
|
+
}
|
|
6821
|
+
function createProgressSpeedTracker() {
|
|
6822
|
+
let epochDigest;
|
|
6823
|
+
let epochStartMs = 0;
|
|
6824
|
+
let epochStartCompleted = 0;
|
|
6825
|
+
return (chunk) => {
|
|
6826
|
+
if (typeof chunk.completed !== "number") return {};
|
|
6827
|
+
const digestChanged = chunk.digest !== void 0 && chunk.digest !== epochDigest;
|
|
6828
|
+
const regressed = chunk.completed < epochStartCompleted;
|
|
6829
|
+
if (digestChanged || regressed) {
|
|
6830
|
+
epochDigest = chunk.digest;
|
|
6831
|
+
epochStartMs = performance.now();
|
|
6832
|
+
epochStartCompleted = chunk.completed;
|
|
6833
|
+
return {};
|
|
6834
|
+
}
|
|
6835
|
+
const elapsedSeconds = (performance.now() - epochStartMs) / 1e3;
|
|
6836
|
+
if (elapsedSeconds <= 0) return {};
|
|
6837
|
+
const transferred = chunk.completed - epochStartCompleted;
|
|
6838
|
+
if (transferred <= 0) return {};
|
|
6839
|
+
const bytesPerSecond = transferred / elapsedSeconds;
|
|
6840
|
+
const etaSeconds = typeof chunk.total === "number" ? Math.max(0, (chunk.total - chunk.completed) / bytesPerSecond) : void 0;
|
|
6841
|
+
return { bytesPerSecond, etaSeconds };
|
|
6842
|
+
};
|
|
6843
|
+
}
|
|
6844
|
+
async function onProgress(stream, callback) {
|
|
6845
|
+
void stream.finalResult.catch(() => void 0);
|
|
6846
|
+
const speed = createProgressSpeedTracker();
|
|
6847
|
+
for await (const event of stream) {
|
|
6848
|
+
if (event.type === "message") {
|
|
6849
|
+
callback({ ...toPullProgressEvent(event.data.chunk), ...speed(event.data.chunk) });
|
|
6850
|
+
}
|
|
6851
|
+
if (event.type === "done") {
|
|
6852
|
+
return event.data.result;
|
|
6853
|
+
}
|
|
6854
|
+
if (event.type === "error") {
|
|
6855
|
+
throw event.data.error;
|
|
6856
|
+
}
|
|
6857
|
+
}
|
|
6858
|
+
throw new OllamaStreamError("Pull/push stream ended before reporting success");
|
|
6859
|
+
}
|
|
6860
|
+
|
|
6718
6861
|
// src/streaming/observe.ts
|
|
6719
6862
|
async function* observeStream(source, callbacks = {}) {
|
|
6720
6863
|
const { onChunk, onError, onDone, onAbandon, onListenerError } = callbacks;
|
|
@@ -8115,6 +8258,6 @@ function estimateSystemOneRequestBytes(request) {
|
|
|
8115
8258
|
return new TextEncoder().encode(JSON.stringify(request)).byteLength;
|
|
8116
8259
|
}
|
|
8117
8260
|
|
|
8118
|
-
export { ATTR_GEN_AI_OPERATION_NAME, ATTR_GEN_AI_REQUEST_MODEL, ATTR_GEN_AI_RESPONSE_MODEL, ATTR_GEN_AI_SYSTEM, ATTR_GEN_AI_TOOL_CALL_ID, ATTR_GEN_AI_TOOL_NAME, ATTR_GEN_AI_USAGE_INPUT_TOKENS, ATTR_GEN_AI_USAGE_OUTPUT_TOKENS, ATTR_HTTP_REQUEST_METHOD, ATTR_HTTP_RESPONSE_STATUS_CODE, ATTR_OLLAMA_AGENT_ITERATION, ATTR_OLLAMA_AGENT_MAX_ITERATIONS, ATTR_OLLAMA_ENDPOINT_ATTEMPT, ATTR_OLLAMA_ENDPOINT_NAME, ATTR_SERVER_ADDRESS, ATTR_SERVER_PORT, ATTR_URL_FULL, Agent, AnthropicCompatClient, AnthropicMessagesStream, ConversationSession, DEFAULT_BACKOFF, DEFAULT_BASE_URL, DEFAULT_CONTEXT_WARNING_THRESHOLD, DEFAULT_EMBED_BATCH_SIZE, DEFAULT_EMBED_CONCURRENCY, DEFAULT_FAILOVER_CODES, DEFAULT_FETCH_BACKOFF_CONFIG, DEFAULT_RETRY_CONFIG, DEFAULT_TIMEOUT_MS, EndpointRegistry, GEN_AI_SYSTEM_OLLAMA, HttpClient, IMAGE_TOKEN_ESTIMATE, KEEP_ALIVE_INDEFINITE, KEEP_ALIVE_UNLOAD, KNOWN_DONE_REASONS, MAX_SYSTEM_ONE_IMAGES_BYTES, MAX_SYSTEM_ONE_REQUEST_BYTES, MESSAGE_OVERHEAD_TOKENS, McpBridge, ModelAffinityRouter, ModelAffinityScheduler, ModelsClient, NANOS_PER_MS, NANOS_PER_SECOND, NETWORK_ERROR_CODES, NOOP_LOGGER, OLLAMA_CLOUD_BASE_URL, OLLAMA_FALLBACK_CONTEXT_LENGTH, OllamaAbortError, OllamaAgentMaxIterationsError, OllamaAgentMaxToolCallsError, OllamaAgentToolLoopError, OllamaAuthError, OllamaBadGatewayError, OllamaClient, OllamaClientError, OllamaGenericClientError, OllamaIncompatibleModelError, OllamaMcpError, OllamaModelRoutingError, OllamaNetworkError, OllamaNotFoundError, OllamaOverloadedError, OllamaQuotaExceededError, OllamaRateLimitError, OllamaRequestTooLargeError, OllamaRequestValidationError, OllamaResponseValidationError, OllamaServerError, OllamaServerVersionUnknownError, OllamaSkillInvalidError, OllamaSkillNotFoundError, OllamaStream, OllamaStreamError, OllamaTimeoutError, OllamaToolTimeoutError, OllamaToolValidationError, OllamaUnsupportedCapabilityError, OpenAIChatCompletionStream, OpenAICompatClient, OpenAICompletionStream, OpenAIResponsesStream, OpenAIResponsesStreamError, QuotaManager, RETRYABLE_STATUS_CODES, ResponsesModule, ToolCallAccumulator, ToolRegistry, WEB_FETCH_TOOL_NAME, WEB_SEARCH_TOOL_NAME, addSpanEvent, applySkill, batchEmbed, calculateBackoff, canonicalToolCallSignature, checkChatContext, checkEndpointHealth, checkGenerateContext, compactConversationHistory, compareDraftPerformance, composeMiddleware, contextWarningMessage, createConsoleLogger, createDecision, createModelAffinityScheduler, createOllamaCloudFreeTierQuota, createTimeoutSignal, createWebFetchTool, createWebSearchTool, createWebTools, defineTool, detectModelCapabilities, embedBatchOverflowMessage, encodeImage, estimateChatRequestTokens, estimateGenerateRequestTokens, estimateMessageTokens, estimateSystemOneRequestBytes, estimateTokens, extractContextLength as extractNativeContextLength, extractParameterNumCtx, extractUsage, fetchWithBackoff, findOversizedEmbedInputs, findRunningModelContextLength, formatTelemetry, formatWebFetchResult, formatWebSearchResult, imageStringNeedsResolution, inferRuntimeMode, isKeepAliveSugar, isKnownDoneReason, isModelResident, isNetworkLevelError, isSameToolCall, listAllMcpTools, listAvailableModels, loadMcpTools, mapError, mergeToolCall, mergeToolCallArgumentsString, mergeToolCallArrays, normalizeChatStream, normalizeGenerateStream, normalizeKeepAlive, normalizeProgressStream, observeStream, parseFrontmatter, parseNdjsonStream, parseSseStream, parseStructuredOutput, recommendContextWindow, registerMcpTools, resolveContextLength, resolveCredentialEndpoints, resolveImageInput, sanitizeHistoryForNextTurn, setSpanError, toDataStream, toResponse, toTextStream, withRetry, withSpan, zodToJsonSchema };
|
|
8261
|
+
export { ATTR_GEN_AI_OPERATION_NAME, ATTR_GEN_AI_REQUEST_MODEL, ATTR_GEN_AI_RESPONSE_MODEL, ATTR_GEN_AI_SYSTEM, ATTR_GEN_AI_TOOL_CALL_ID, ATTR_GEN_AI_TOOL_NAME, ATTR_GEN_AI_USAGE_INPUT_TOKENS, ATTR_GEN_AI_USAGE_OUTPUT_TOKENS, ATTR_HTTP_REQUEST_METHOD, ATTR_HTTP_RESPONSE_STATUS_CODE, ATTR_OLLAMA_AGENT_ITERATION, ATTR_OLLAMA_AGENT_MAX_ITERATIONS, ATTR_OLLAMA_ENDPOINT_ATTEMPT, ATTR_OLLAMA_ENDPOINT_NAME, ATTR_SERVER_ADDRESS, ATTR_SERVER_PORT, ATTR_URL_FULL, Agent, AnthropicCompatClient, AnthropicMessagesStream, ConversationSession, DEFAULT_BACKOFF, DEFAULT_BASE_URL, DEFAULT_CONTEXT_WARNING_THRESHOLD, DEFAULT_EMBED_BATCH_SIZE, DEFAULT_EMBED_CONCURRENCY, DEFAULT_FAILOVER_CODES, DEFAULT_FETCH_BACKOFF_CONFIG, DEFAULT_RETRY_CONFIG, DEFAULT_TIMEOUT_MS, EndpointRegistry, GEN_AI_SYSTEM_OLLAMA, HttpClient, IMAGE_TOKEN_ESTIMATE, KEEP_ALIVE_INDEFINITE, KEEP_ALIVE_UNLOAD, KNOWN_DONE_REASONS, MAX_SYSTEM_ONE_IMAGES_BYTES, MAX_SYSTEM_ONE_REQUEST_BYTES, MESSAGE_OVERHEAD_TOKENS, McpBridge, ModelAffinityRouter, ModelAffinityScheduler, ModelsClient, NANOS_PER_MS, NANOS_PER_SECOND, NETWORK_ERROR_CODES, NOOP_LOGGER, OLLAMA_CLOUD_BASE_URL, OLLAMA_FALLBACK_CONTEXT_LENGTH, OllamaAbortError, OllamaAgentMaxIterationsError, OllamaAgentMaxToolCallsError, OllamaAgentToolLoopError, OllamaAuthError, OllamaBadGatewayError, OllamaClient, OllamaClientError, OllamaGenericClientError, OllamaIncompatibleModelError, OllamaMcpError, OllamaModelRoutingError, OllamaNetworkError, OllamaNotFoundError, OllamaOverloadedError, OllamaQuotaExceededError, OllamaRateLimitError, OllamaRequestTooLargeError, OllamaRequestValidationError, OllamaResponseValidationError, OllamaServerError, OllamaServerVersionUnknownError, OllamaSkillInvalidError, OllamaSkillNotFoundError, OllamaStream, OllamaStreamError, OllamaTimeoutError, OllamaToolTimeoutError, OllamaToolValidationError, OllamaUnsupportedCapabilityError, OpenAIChatCompletionStream, OpenAICompatClient, OpenAICompletionStream, OpenAIResponsesStream, OpenAIResponsesStreamError, QuotaManager, RETRYABLE_STATUS_CODES, ResponsesModule, ToolCallAccumulator, ToolRegistry, WEB_FETCH_TOOL_NAME, WEB_SEARCH_TOOL_NAME, addSpanEvent, applySkill, batchEmbed, calculateBackoff, canonicalToolCallSignature, checkChatContext, checkEndpointHealth, checkGenerateContext, compactConversationHistory, compareDraftPerformance, composeMiddleware, computeProgressPercent, contextWarningMessage, createConsoleLogger, createDecision, createModelAffinityScheduler, createOllamaCloudFreeTierQuota, createProgressSpeedTracker, createTimeoutSignal, createWebFetchTool, createWebSearchTool, createWebTools, defineTool, detectModelCapabilities, embedBatchOverflowMessage, encodeImage, estimateChatRequestTokens, estimateGenerateRequestTokens, estimateMessageTokens, estimateSystemOneRequestBytes, estimateTokens, extractContextLength as extractNativeContextLength, extractParameterNumCtx, extractUsage, fetchWithBackoff, findOversizedEmbedInputs, findRunningModelContextLength, formatTelemetry, formatWebFetchResult, formatWebSearchResult, imageStringNeedsResolution, inferRuntimeMode, isKeepAliveSugar, isKnownDoneReason, isModelResident, isNetworkLevelError, isSameToolCall, listAllMcpTools, listAvailableModels, loadMcpTools, mapError, mergeToolCall, mergeToolCallArgumentsString, mergeToolCallArrays, normalizeChatStream, normalizeGenerateStream, normalizeKeepAlive, normalizeProgressStream, observeStream, onProgress, parseFrontmatter, parseNdjsonStream, parseSseStream, parseStructuredOutput, recommendContextWindow, registerMcpTools, resolveContextLength, resolveCredentialEndpoints, resolveImageInput, sanitizeHistoryForNextTurn, setSpanError, toDataStream, toPullProgressEvent, toResponse, toTextStream, withRetry, withSpan, zodToJsonSchema };
|
|
8119
8262
|
//# sourceMappingURL=index.js.map
|
|
8120
8263
|
//# sourceMappingURL=index.js.map
|