@nemesis-oss/ollama-sdk 1.17.0 → 1.19.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 +58 -0
- package/README.md +79 -0
- package/dist/{anthropic-AKbXnWJU.d.cts → anthropic-CAvwqIjx.d.ts} +5 -5
- package/dist/{anthropic-CTv2acbj.d.ts → anthropic-DIPnBwlf.d.cts} +5 -5
- package/dist/{compose-CeFbHJeO.d.ts → compose-75UFDzOO.d.ts} +1 -1
- package/dist/{compose-DFkmtUOP.d.cts → compose-C4QxEZOS.d.cts} +1 -1
- package/dist/generated-api.cjs +5 -3
- package/dist/generated-api.cjs.map +1 -1
- package/dist/generated-api.d.cts +9 -9
- package/dist/generated-api.d.ts +9 -9
- package/dist/generated-api.js +5 -3
- package/dist/generated-api.js.map +1 -1
- 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 +24 -6
- package/dist/generated-runtime.cjs.map +1 -1
- package/dist/generated-runtime.d.cts +2 -2
- package/dist/generated-runtime.d.ts +2 -2
- package/dist/generated-runtime.js +24 -6
- package/dist/generated-runtime.js.map +1 -1
- package/dist/index.cjs +132 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +294 -40
- package/dist/index.d.ts +294 -40
- package/dist/index.js +128 -21
- package/dist/index.js.map +1 -1
- package/dist/mcp/tools.json +8 -10
- package/dist/mcp-generated.cjs +5 -3
- package/dist/mcp-generated.cjs.map +1 -1
- package/dist/mcp-generated.d.cts +2 -2
- package/dist/mcp-generated.d.ts +2 -2
- package/dist/mcp-generated.js +5 -3
- package/dist/mcp-generated.js.map +1 -1
- package/dist/{runtime-CdZP-N7j.d.cts → runtime-C28YEAHC.d.cts} +28 -5
- package/dist/{runtime-CFuv7Ifh.d.ts → runtime-DYCxYGG-.d.ts} +28 -5
- package/dist/skills.cjs.map +1 -1
- package/dist/skills.d.cts +3 -3
- package/dist/skills.d.ts +3 -3
- package/dist/skills.js.map +1 -1
- package/dist/{types-DbPnfVh-.d.cts → types-Y3u0FtdN.d.cts} +10 -0
- package/dist/{types-DbPnfVh-.d.ts → types-Y3u0FtdN.d.ts} +10 -0
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -191,6 +191,11 @@ var OllamaAuthError = class extends OllamaClientError {
|
|
|
191
191
|
super(message, { ...options, code: "auth_error", retryable: false });
|
|
192
192
|
}
|
|
193
193
|
};
|
|
194
|
+
var OllamaPaymentRequiredError = class extends OllamaClientError {
|
|
195
|
+
constructor(message, options) {
|
|
196
|
+
super(message, { ...options, code: "payment_required", retryable: false, status: 402 });
|
|
197
|
+
}
|
|
198
|
+
};
|
|
194
199
|
var OllamaNotFoundError = class extends OllamaClientError {
|
|
195
200
|
constructor(message, options) {
|
|
196
201
|
super(message, { ...options, code: "not_found", retryable: false });
|
|
@@ -425,6 +430,9 @@ function statusToError(status, message, options) {
|
|
|
425
430
|
if (status === 401 || status === 403) {
|
|
426
431
|
return new OllamaAuthError(message, { ...options, status });
|
|
427
432
|
}
|
|
433
|
+
if (status === 402) {
|
|
434
|
+
return new OllamaPaymentRequiredError(message, options);
|
|
435
|
+
}
|
|
428
436
|
if (status === 404) {
|
|
429
437
|
return new OllamaNotFoundError(message, { ...options, status });
|
|
430
438
|
}
|
|
@@ -4177,7 +4185,7 @@ var SystemOneNoulQuestionSchema = z.object({
|
|
|
4177
4185
|
var SystemOneScoreQuestionSchema = z.object({
|
|
4178
4186
|
type: z.enum(["score"]),
|
|
4179
4187
|
instructions: SystemOneContentSchema,
|
|
4180
|
-
criteria: z.array(z.string()).min(2).max(
|
|
4188
|
+
criteria: z.array(z.string()).min(2).max(10)
|
|
4181
4189
|
});
|
|
4182
4190
|
|
|
4183
4191
|
// src/generated/models/SystemOneRequest.schema.ts
|
|
@@ -4212,7 +4220,7 @@ var SystemOneNoulAnswerSchema = z.object({
|
|
|
4212
4220
|
});
|
|
4213
4221
|
var SystemOneScoreAnswerSchema = z.object({
|
|
4214
4222
|
type: z.enum(["score"]),
|
|
4215
|
-
score: z.number().min(0).max(
|
|
4223
|
+
score: z.number().min(0).max(9),
|
|
4216
4224
|
legend: z.object({}).catchall(z.string()),
|
|
4217
4225
|
probabilities: SystemOneProbabilitiesSchema,
|
|
4218
4226
|
confidence: SystemOneConfidenceSchema
|
|
@@ -4423,14 +4431,25 @@ var OllamaRuntime = class {
|
|
|
4423
4431
|
const hasImages = bodyHasImages(body);
|
|
4424
4432
|
const maxBytesWithImages = req.operation.constraints?.maxRequestBytesWithImages;
|
|
4425
4433
|
const maxBytesBase = req.operation.constraints?.maxRequestBytes;
|
|
4426
|
-
const
|
|
4427
|
-
if (
|
|
4434
|
+
const textAndSchemaBytes = hasImages ? serializeWithoutImages(body).byteLength : serialized.byteLength;
|
|
4435
|
+
if (maxBytesBase !== void 0 && textAndSchemaBytes > maxBytesBase) {
|
|
4436
|
+
throw new OllamaRequestTooLargeError(
|
|
4437
|
+
`Operation ${req.operation.operationId} (${req.operation.method} ${req.operation.path}) text and schema (images excluded) is ${textAndSchemaBytes} bytes, exceeding the contract limit of ${maxBytesBase} bytes.`,
|
|
4438
|
+
{
|
|
4439
|
+
operationId: req.operation.operationId,
|
|
4440
|
+
actualBytes: textAndSchemaBytes,
|
|
4441
|
+
maxBytes: maxBytesBase,
|
|
4442
|
+
request: { method: req.operation.method, url: req.operation.path }
|
|
4443
|
+
}
|
|
4444
|
+
);
|
|
4445
|
+
}
|
|
4446
|
+
if (maxBytesWithImages !== void 0 && serialized.byteLength > maxBytesWithImages) {
|
|
4428
4447
|
throw new OllamaRequestTooLargeError(
|
|
4429
|
-
`Operation ${req.operation.operationId} (${req.operation.method} ${req.operation.path}) request body is ${serialized.byteLength} bytes, exceeding the contract limit of ${
|
|
4448
|
+
`Operation ${req.operation.operationId} (${req.operation.method} ${req.operation.path}) request body is ${serialized.byteLength} bytes, exceeding the contract limit of ${maxBytesWithImages} bytes (whole request, images included).`,
|
|
4430
4449
|
{
|
|
4431
4450
|
operationId: req.operation.operationId,
|
|
4432
4451
|
actualBytes: serialized.byteLength,
|
|
4433
|
-
maxBytes:
|
|
4452
|
+
maxBytes: maxBytesWithImages,
|
|
4434
4453
|
request: { method: req.operation.method, url: req.operation.path }
|
|
4435
4454
|
}
|
|
4436
4455
|
);
|
|
@@ -4572,6 +4591,13 @@ function bodyHasImages(body) {
|
|
|
4572
4591
|
const images = obj.images;
|
|
4573
4592
|
return Array.isArray(images) && images.length > 0;
|
|
4574
4593
|
}
|
|
4594
|
+
function serializeWithoutImages(body) {
|
|
4595
|
+
if (typeof body === "object" && body !== null && !Array.isArray(body)) {
|
|
4596
|
+
const { images: _images, ...rest } = body;
|
|
4597
|
+
return serializeForByteCount(rest);
|
|
4598
|
+
}
|
|
4599
|
+
return serializeForByteCount(body);
|
|
4600
|
+
}
|
|
4575
4601
|
function resolvePathParams(pathTemplate, pathParams) {
|
|
4576
4602
|
if (!pathTemplate.includes("{")) return pathTemplate;
|
|
4577
4603
|
const params = pathParams ?? {};
|
|
@@ -5324,7 +5350,7 @@ var systemOneOp = {
|
|
|
5324
5350
|
path: "/v1/systemone",
|
|
5325
5351
|
request: { $ref: "#/schemas/SystemOneRequest" },
|
|
5326
5352
|
response: { $ref: "#/schemas/SystemOneResponse" },
|
|
5327
|
-
environment: { local: true, cloud:
|
|
5353
|
+
environment: { local: true, cloud: true },
|
|
5328
5354
|
transport: { mode: "json", streaming: false },
|
|
5329
5355
|
capabilities: {
|
|
5330
5356
|
thinking: "unsupported",
|
|
@@ -5342,8 +5368,10 @@ var systemOneOp = {
|
|
|
5342
5368
|
status: { documented: true, experimental: true },
|
|
5343
5369
|
domain: "native",
|
|
5344
5370
|
notes: [
|
|
5345
|
-
"Local
|
|
5346
|
-
"64 KiB
|
|
5371
|
+
"Local and cloud: model accepts cloud models (e.g. clef:cloud); cloud models require Ollama >= 0.40.5 or the hosted https://ollama.com endpoint.",
|
|
5372
|
+
"Local dual cap: text and schema (excluding images) within 64 KiB AND the whole request within 32 MiB, including base64 and JSON overhead.",
|
|
5373
|
+
"Cloud requests: paid plan or usage credits required; up to 64 questions named with up to 100 ASCII letters, digits, `_`, `.`, or `-`; up to 4 images of at most 4 MiB and 16 megapixels each (8 MiB total); requests within 13 MiB; input within the model's 65,536-token context window.",
|
|
5374
|
+
"401 when a cloud model is requested without signing in or with an invalid API key (through a local server the response includes a signin_url); 402 when the cloud model is not included in the Free plan or a payment fails.",
|
|
5347
5375
|
"No tools, no generation controls (temperature, top_p, etc.).",
|
|
5348
5376
|
"Vision is model-dependent: images are accepted by vision-weighted models (Clef/Clef Flash) but not by text-only models.",
|
|
5349
5377
|
"Experimental: behavioral surface may change between Ollama releases."
|
|
@@ -5523,9 +5551,16 @@ var FailoverHttpClient = class {
|
|
|
5523
5551
|
};
|
|
5524
5552
|
|
|
5525
5553
|
// src/decision.ts
|
|
5554
|
+
function validateThreshold(value, name) {
|
|
5555
|
+
if (value === void 0) return;
|
|
5556
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0 || value > 1) {
|
|
5557
|
+
throw new RangeError(`${name} must be a number in (0, 1] \u2014 got ${String(value)}`);
|
|
5558
|
+
}
|
|
5559
|
+
}
|
|
5526
5560
|
function createDecision(client) {
|
|
5527
5561
|
return {
|
|
5528
5562
|
async choice(params) {
|
|
5563
|
+
validateThreshold(params.minConfidence, "minConfidence");
|
|
5529
5564
|
const response = await client.systemOne({
|
|
5530
5565
|
model: params.model,
|
|
5531
5566
|
state: params.state,
|
|
@@ -5544,10 +5579,12 @@ function createDecision(client) {
|
|
|
5544
5579
|
choice: answer.choice,
|
|
5545
5580
|
probabilities: answer.probabilities,
|
|
5546
5581
|
confidence: answer.confidence,
|
|
5582
|
+
...params.minConfidence !== void 0 ? { isConfident: answer.confidence >= params.minConfidence } : {},
|
|
5547
5583
|
usage: response.usage
|
|
5548
5584
|
};
|
|
5549
5585
|
},
|
|
5550
5586
|
async noul(params) {
|
|
5587
|
+
validateThreshold(params.minProbability, "minProbability");
|
|
5551
5588
|
const response = await client.systemOne({
|
|
5552
5589
|
model: params.model,
|
|
5553
5590
|
state: params.state,
|
|
@@ -5563,11 +5600,12 @@ function createDecision(client) {
|
|
|
5563
5600
|
const answer = response.answers.decision;
|
|
5564
5601
|
return {
|
|
5565
5602
|
noul: answer.noul,
|
|
5566
|
-
bool: answer.noul >= 0.5,
|
|
5603
|
+
bool: answer.noul >= (params.minProbability ?? 0.5),
|
|
5567
5604
|
usage: response.usage
|
|
5568
5605
|
};
|
|
5569
5606
|
},
|
|
5570
5607
|
async score(params) {
|
|
5608
|
+
validateThreshold(params.minConfidence, "minConfidence");
|
|
5571
5609
|
const response = await client.systemOne({
|
|
5572
5610
|
model: params.model,
|
|
5573
5611
|
state: params.state,
|
|
@@ -5587,10 +5625,12 @@ function createDecision(client) {
|
|
|
5587
5625
|
legend: answer.legend,
|
|
5588
5626
|
probabilities: answer.probabilities,
|
|
5589
5627
|
confidence: answer.confidence,
|
|
5628
|
+
...params.minConfidence !== void 0 ? { isConfident: answer.confidence >= params.minConfidence } : {},
|
|
5590
5629
|
usage: response.usage
|
|
5591
5630
|
};
|
|
5592
5631
|
},
|
|
5593
5632
|
async route(params) {
|
|
5633
|
+
validateThreshold(params.minConfidence, "minConfidence");
|
|
5594
5634
|
const response = await client.systemOne({
|
|
5595
5635
|
model: params.model,
|
|
5596
5636
|
state: params.state,
|
|
@@ -5607,10 +5647,12 @@ function createDecision(client) {
|
|
|
5607
5647
|
const answer = response.answers.decision;
|
|
5608
5648
|
return {
|
|
5609
5649
|
route: answer.choice,
|
|
5610
|
-
confidence: answer.confidence
|
|
5650
|
+
confidence: answer.confidence,
|
|
5651
|
+
...params.minConfidence !== void 0 ? { isConfident: answer.confidence >= params.minConfidence } : {}
|
|
5611
5652
|
};
|
|
5612
5653
|
},
|
|
5613
5654
|
async verify(params) {
|
|
5655
|
+
validateThreshold(params.minProbability, "minProbability");
|
|
5614
5656
|
const state = {
|
|
5615
5657
|
claim: params.claim,
|
|
5616
5658
|
evidence: params.evidence
|
|
@@ -5629,11 +5671,12 @@ function createDecision(client) {
|
|
|
5629
5671
|
});
|
|
5630
5672
|
const answer = response.answers.decision;
|
|
5631
5673
|
return {
|
|
5632
|
-
verified: answer.noul >= 0.5,
|
|
5674
|
+
verified: answer.noul >= (params.minProbability ?? 0.5),
|
|
5633
5675
|
probability: answer.noul
|
|
5634
5676
|
};
|
|
5635
5677
|
},
|
|
5636
5678
|
async rank(params) {
|
|
5679
|
+
validateThreshold(params.minConfidence, "minConfidence");
|
|
5637
5680
|
const promises = params.candidates.map(async (candidate) => {
|
|
5638
5681
|
const response = await client.systemOne({
|
|
5639
5682
|
model: params.model,
|
|
@@ -5652,7 +5695,8 @@ function createDecision(client) {
|
|
|
5652
5695
|
return {
|
|
5653
5696
|
candidate: candidate.id,
|
|
5654
5697
|
score: answer.score,
|
|
5655
|
-
confidence: answer.confidence
|
|
5698
|
+
confidence: answer.confidence,
|
|
5699
|
+
...params.minConfidence !== void 0 ? { isConfident: answer.confidence >= params.minConfidence } : {}
|
|
5656
5700
|
};
|
|
5657
5701
|
});
|
|
5658
5702
|
const results = await Promise.all(promises);
|
|
@@ -6283,11 +6327,15 @@ var OllamaClient = class _OllamaClient {
|
|
|
6283
6327
|
* 1–64 typed questions (choice, noul, or score) against a provided state
|
|
6284
6328
|
* and returns typed answers with probabilities and confidence.
|
|
6285
6329
|
*
|
|
6286
|
-
* Local
|
|
6287
|
-
*
|
|
6288
|
-
*
|
|
6289
|
-
*
|
|
6290
|
-
*
|
|
6330
|
+
* Local and cloud (since the 2026-10-16 upstream System One cloud
|
|
6331
|
+
* launch): `model` also accepts cloud models such as `clef:cloud` —
|
|
6332
|
+
* cloud models require Ollama >= 0.40.5 or the hosted
|
|
6333
|
+
* `https://ollama.com` endpoint. Requires Ollama >= 0.35.0 locally.
|
|
6334
|
+
* The runtime enforces the version constraint automatically (lazily
|
|
6335
|
+
* fetching `/api/version` when `enforceVersion` is `'auto'` or
|
|
6336
|
+
* `'strict'`). Request size is checked client-side as a dual cap:
|
|
6337
|
+
* text and schema (images excluded) within 64 KiB AND the whole
|
|
6338
|
+
* request within 32 MiB.
|
|
6291
6339
|
*
|
|
6292
6340
|
* The generic `Q` parameter captures the caller's question map at
|
|
6293
6341
|
* compile time, giving key-safe answer access:
|
|
@@ -6784,6 +6832,64 @@ function toResponse(stream, init = {}) {
|
|
|
6784
6832
|
return new Response(body, { ...init, headers });
|
|
6785
6833
|
}
|
|
6786
6834
|
|
|
6835
|
+
// src/streaming/progress.ts
|
|
6836
|
+
function computeProgressPercent(chunk) {
|
|
6837
|
+
if (typeof chunk.total !== "number" || typeof chunk.completed !== "number") return void 0;
|
|
6838
|
+
if (chunk.total <= 0) return void 0;
|
|
6839
|
+
const ratio = chunk.completed / chunk.total;
|
|
6840
|
+
const clamped = Math.max(0, Math.min(1, ratio));
|
|
6841
|
+
return Math.round(clamped * 1e4) / 100;
|
|
6842
|
+
}
|
|
6843
|
+
function toPullProgressEvent(chunk) {
|
|
6844
|
+
return {
|
|
6845
|
+
status: chunk.status,
|
|
6846
|
+
...chunk.digest !== void 0 ? { digest: chunk.digest } : {},
|
|
6847
|
+
...chunk.total !== void 0 ? { total: chunk.total } : {},
|
|
6848
|
+
...chunk.completed !== void 0 ? { completed: chunk.completed } : {},
|
|
6849
|
+
percent: computeProgressPercent(chunk),
|
|
6850
|
+
raw: chunk
|
|
6851
|
+
};
|
|
6852
|
+
}
|
|
6853
|
+
function createProgressSpeedTracker() {
|
|
6854
|
+
let epochDigest;
|
|
6855
|
+
let epochStartMs = 0;
|
|
6856
|
+
let epochStartCompleted = 0;
|
|
6857
|
+
return (chunk) => {
|
|
6858
|
+
if (typeof chunk.completed !== "number") return {};
|
|
6859
|
+
const digestChanged = chunk.digest !== void 0 && chunk.digest !== epochDigest;
|
|
6860
|
+
const regressed = chunk.completed < epochStartCompleted;
|
|
6861
|
+
if (digestChanged || regressed) {
|
|
6862
|
+
epochDigest = chunk.digest;
|
|
6863
|
+
epochStartMs = performance.now();
|
|
6864
|
+
epochStartCompleted = chunk.completed;
|
|
6865
|
+
return {};
|
|
6866
|
+
}
|
|
6867
|
+
const elapsedSeconds = (performance.now() - epochStartMs) / 1e3;
|
|
6868
|
+
if (elapsedSeconds <= 0) return {};
|
|
6869
|
+
const transferred = chunk.completed - epochStartCompleted;
|
|
6870
|
+
if (transferred <= 0) return {};
|
|
6871
|
+
const bytesPerSecond = transferred / elapsedSeconds;
|
|
6872
|
+
const etaSeconds = typeof chunk.total === "number" ? Math.max(0, (chunk.total - chunk.completed) / bytesPerSecond) : void 0;
|
|
6873
|
+
return { bytesPerSecond, etaSeconds };
|
|
6874
|
+
};
|
|
6875
|
+
}
|
|
6876
|
+
async function onProgress(stream, callback) {
|
|
6877
|
+
void stream.finalResult.catch(() => void 0);
|
|
6878
|
+
const speed = createProgressSpeedTracker();
|
|
6879
|
+
for await (const event of stream) {
|
|
6880
|
+
if (event.type === "message") {
|
|
6881
|
+
callback({ ...toPullProgressEvent(event.data.chunk), ...speed(event.data.chunk) });
|
|
6882
|
+
}
|
|
6883
|
+
if (event.type === "done") {
|
|
6884
|
+
return event.data.result;
|
|
6885
|
+
}
|
|
6886
|
+
if (event.type === "error") {
|
|
6887
|
+
throw event.data.error;
|
|
6888
|
+
}
|
|
6889
|
+
}
|
|
6890
|
+
throw new OllamaStreamError("Pull/push stream ended before reporting success");
|
|
6891
|
+
}
|
|
6892
|
+
|
|
6787
6893
|
// src/streaming/observe.ts
|
|
6788
6894
|
async function* observeStream(source, callbacks = {}) {
|
|
6789
6895
|
const { onChunk, onError, onDone, onAbandon, onListenerError } = callbacks;
|
|
@@ -8180,10 +8286,11 @@ function createModelAffinityScheduler(client, options) {
|
|
|
8180
8286
|
// src/system-one.ts
|
|
8181
8287
|
var MAX_SYSTEM_ONE_IMAGES_BYTES = 32 * 1024 * 1024;
|
|
8182
8288
|
var MAX_SYSTEM_ONE_REQUEST_BYTES = 64 * 1024;
|
|
8183
|
-
function estimateSystemOneRequestBytes(request) {
|
|
8184
|
-
|
|
8289
|
+
function estimateSystemOneRequestBytes(request, options) {
|
|
8290
|
+
const body = options?.excludeImages && request.images !== void 0 ? { ...request, images: void 0 } : request;
|
|
8291
|
+
return new TextEncoder().encode(JSON.stringify(body)).byteLength;
|
|
8185
8292
|
}
|
|
8186
8293
|
|
|
8187
|
-
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 };
|
|
8294
|
+
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, OllamaPaymentRequiredError, 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 };
|
|
8188
8295
|
//# sourceMappingURL=index.js.map
|
|
8189
8296
|
//# sourceMappingURL=index.js.map
|