@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.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ export { L as ListResponse, x as Logprob, y as LogprobToken, z as ModelDetails,
|
|
|
3
3
|
import { H as HttpClient, F as FetchLike, M as Middleware, L as Logger, R as RequestLifecycleHook, c as OllamaStreamEvent, A as AbortableAsyncIterable, d as OllamaStreamEventType, P as ProgressStreamResult, B as BinaryBody, O as OllamaRuntime, C as ChatStreamResult, G as GenerateStreamResult, e as RawUsageSource, T as TokenUsage } from './runtime-CFuv7Ifh.js';
|
|
4
4
|
export { D as DoneEvent, E as ErrorEvent, f as HttpBody, g as HttpClientOptions, h as HttpRequestOptions, i as LifecycleErrorEvent, j as LifecycleRetryEvent, k as LifecycleStartEvent, l as LifecycleSuccessEvent, m as LogFn, n as MessageEvent, o as MiddlewareContext, N as NANOS_PER_MS, p as NANOS_PER_SECOND, q as NETWORK_ERROR_CODES, r as NOOP_LOGGER, s as NextFunction, t as OllamaAbortError, u as OllamaAgentMaxIterationsError, v as OllamaAgentMaxToolCallsError, w as OllamaAgentToolLoopError, x as OllamaAuthError, y as OllamaBadGatewayError, z as OllamaClientError, J as OllamaClientErrorOptions, K as OllamaErrorRequestContext, Q as OllamaErrorResponseContext, U as OllamaGenericClientError, V as OllamaIncompatibleModelError, W as OllamaMcpError, X as OllamaModelRoutingError, Y as OllamaNetworkError, Z as OllamaNotFoundError, _ as OllamaOverloadedError, $ as OllamaQuotaExceededError, a0 as OllamaRateLimitError, a1 as OllamaRequestTooLargeError, a2 as OllamaRequestValidationError, a3 as OllamaResponseValidationError, a4 as OllamaServerError, a5 as OllamaServerVersionUnknownError, a6 as OllamaSkillInvalidError, a7 as OllamaSkillNotFoundError, a8 as OllamaStreamError, a9 as OllamaTimeoutError, aa as OllamaToolTimeoutError, ab as OllamaToolValidationError, ac as OllamaUnsupportedCapabilityError, ad as RequestContext, ae as RequestLifecycleEvent, af as ResponseContext, ag as SseEvent, ah as ThinkingEvent, ai as TokenEvent, aj as ToolCallEvent, ak as composeMiddleware, al as createConsoleLogger, am as extractUsage, an as isNetworkLevelError, ao as mapError, ap as parseSseStream } from './runtime-CFuv7Ifh.js';
|
|
5
5
|
import { z } from 'zod';
|
|
6
|
-
import { R as RequestRunner, S as SystemOneChoiceAnswer, o as SystemOneNoulAnswer, p as SystemOneScoreAnswer, q as SystemOneChoiceQuestion, r as SystemOneNoulQuestion, s as SystemOneScoreQuestion, t as SystemOneRequest$1, u as SystemOneResponse$1, v as SystemOneContent, N as NativeApi, w as OpenAICompatClient, x as AnthropicCompatClient } from './anthropic-
|
|
7
|
-
export { y as AnthropicCacheControl, z as AnthropicContentBlock, B as AnthropicImageContentBlock, C as AnthropicMessage, n as AnthropicMessageStreamEvent, A as AnthropicMessagesRequest, m as AnthropicMessagesResponse, D as AnthropicMessagesStream, E as AnthropicMetadata, F as AnthropicOutputConfig, G as AnthropicRedactedThinkingContentBlock, H as AnthropicSystem, I as AnthropicSystemTextBlock, J as AnthropicTextContentBlock, K as AnthropicThinkingConfig, L as AnthropicThinkingContentBlock, M as AnthropicTool, P as AnthropicToolChoice, Q as AnthropicToolResultContentBlock, T as AnthropicToolUseContentBlock, U as AnthropicUnknownStreamEvent, V as OllamaAnthropicContentBlock, W as OllamaAnthropicMessage, X as OllamaAnthropicMessagesRequest, Y as OllamaAnthropicSystem, Z as OllamaAnthropicSystemTextBlock, _ as OllamaAnthropicTextContentBlock, $ as OllamaAnthropicThinkingConfig, a0 as OllamaAnthropicTool, a1 as OllamaAnthropicToolResultContentBlock, a2 as OllamaOpenAIChatCompletionRequest, a3 as OllamaOpenAIChatContentPart, a4 as OllamaOpenAIChatMessage, a5 as OllamaOpenAICompletionRequest, a6 as OllamaOpenAIEmbeddingRequest, a7 as OllamaOpenAIImageDataUrl, a8 as OllamaOpenAIReasoningEffort, a9 as OllamaOpenAIResponsesRequest, aa as OpenAIChatCompletionChoice, b as OpenAIChatCompletionChunk, ab as OpenAIChatCompletionChunkChoice, ac as OpenAIChatCompletionDelta, O as OpenAIChatCompletionRequest, a as OpenAIChatCompletionResponse, ad as OpenAIChatCompletionStream, ae as OpenAICompletionChoice, e as OpenAICompletionChunk, c as OpenAICompletionRequest, d as OpenAICompletionResponse, af as OpenAICompletionStream, ag as OpenAIContentPart, ah as OpenAIEmbeddingInput, ai as OpenAIEmbeddingItem, f as OpenAIEmbeddingRequest, g as OpenAIEmbeddingResponse, aj as OpenAIFunctionDefinition, ak as OpenAIImageUrlContentPart, h as OpenAIListModelsResponse, al as OpenAIMessage, i as OpenAIModelItem, am as OpenAIReasoningEffort, an as OpenAIResponseFormat, ao as OpenAIResponsesCompletedEvent, ap as OpenAIResponsesContentPartAddedEvent, aq as OpenAIResponsesContentPartDoneEvent, ar as OpenAIResponsesCreatedEvent, as as OpenAIResponsesError, at as OpenAIResponsesEventBase, au as OpenAIResponsesFailedEvent, av as OpenAIResponsesFunctionCallArgumentsDeltaEvent, aw as OpenAIResponsesFunctionCallArgumentsDoneEvent, ax as OpenAIResponsesInProgressEvent, ay as OpenAIResponsesIncompleteDetails, az as OpenAIResponsesIncompleteEvent, aA as OpenAIResponsesOutputContent, aB as OpenAIResponsesOutputFunctionCall, aC as OpenAIResponsesOutputItem, aD as OpenAIResponsesOutputItemAddedEvent, aE as OpenAIResponsesOutputItemDoneEvent, aF as OpenAIResponsesOutputMessage, aG as OpenAIResponsesOutputReasoning, aH as OpenAIResponsesOutputRefusal, aI as OpenAIResponsesOutputTextContent, aJ as OpenAIResponsesOutputTextDeltaEvent, aK as OpenAIResponsesOutputTextDoneEvent, aL as OpenAIResponsesQueuedEvent, aM as OpenAIResponsesReasoningSummaryPartAddedEvent, aN as OpenAIResponsesReasoningSummaryPartDoneEvent, aO as OpenAIResponsesReasoningSummaryTextDeltaEvent, aP as OpenAIResponsesReasoningSummaryTextDoneEvent, aQ as OpenAIResponsesReasoningTextDeltaEvent, aR as OpenAIResponsesReasoningTextDoneEvent, aS as OpenAIResponsesRefusalDeltaEvent, aT as OpenAIResponsesRefusalDoneEvent, j as OpenAIResponsesRequest, k as OpenAIResponsesResponse, aU as OpenAIResponsesStatus, aV as OpenAIResponsesStream, aW as OpenAIResponsesStreamError, l as OpenAIResponsesStreamEvent, aX as OpenAIResponsesUsage, aY as OpenAIStreamOptions, aZ as OpenAITextContentPart, a_ as OpenAITool, a$ as OpenAIToolCall, b0 as OpenAIToolCallDelta, b1 as OpenAIUsage, b2 as SystemOneConfidence, b3 as SystemOneProbabilities } from './anthropic-
|
|
6
|
+
import { R as RequestRunner, S as SystemOneChoiceAnswer, o as SystemOneNoulAnswer, p as SystemOneScoreAnswer, q as SystemOneChoiceQuestion, r as SystemOneNoulQuestion, s as SystemOneScoreQuestion, t as SystemOneRequest$1, u as SystemOneResponse$1, v as SystemOneContent, N as NativeApi, w as OpenAICompatClient, x as AnthropicCompatClient } from './anthropic-CvGVSoVP.js';
|
|
7
|
+
export { y as AnthropicCacheControl, z as AnthropicContentBlock, B as AnthropicImageContentBlock, C as AnthropicMessage, n as AnthropicMessageStreamEvent, A as AnthropicMessagesRequest, m as AnthropicMessagesResponse, D as AnthropicMessagesStream, E as AnthropicMetadata, F as AnthropicOutputConfig, G as AnthropicRedactedThinkingContentBlock, H as AnthropicSystem, I as AnthropicSystemTextBlock, J as AnthropicTextContentBlock, K as AnthropicThinkingConfig, L as AnthropicThinkingContentBlock, M as AnthropicTool, P as AnthropicToolChoice, Q as AnthropicToolResultContentBlock, T as AnthropicToolUseContentBlock, U as AnthropicUnknownStreamEvent, V as OllamaAnthropicContentBlock, W as OllamaAnthropicMessage, X as OllamaAnthropicMessagesRequest, Y as OllamaAnthropicSystem, Z as OllamaAnthropicSystemTextBlock, _ as OllamaAnthropicTextContentBlock, $ as OllamaAnthropicThinkingConfig, a0 as OllamaAnthropicTool, a1 as OllamaAnthropicToolResultContentBlock, a2 as OllamaOpenAIChatCompletionRequest, a3 as OllamaOpenAIChatContentPart, a4 as OllamaOpenAIChatMessage, a5 as OllamaOpenAICompletionRequest, a6 as OllamaOpenAIEmbeddingRequest, a7 as OllamaOpenAIImageDataUrl, a8 as OllamaOpenAIReasoningEffort, a9 as OllamaOpenAIResponsesRequest, aa as OpenAIChatCompletionChoice, b as OpenAIChatCompletionChunk, ab as OpenAIChatCompletionChunkChoice, ac as OpenAIChatCompletionDelta, O as OpenAIChatCompletionRequest, a as OpenAIChatCompletionResponse, ad as OpenAIChatCompletionStream, ae as OpenAICompletionChoice, e as OpenAICompletionChunk, c as OpenAICompletionRequest, d as OpenAICompletionResponse, af as OpenAICompletionStream, ag as OpenAIContentPart, ah as OpenAIEmbeddingInput, ai as OpenAIEmbeddingItem, f as OpenAIEmbeddingRequest, g as OpenAIEmbeddingResponse, aj as OpenAIFunctionDefinition, ak as OpenAIImageUrlContentPart, h as OpenAIListModelsResponse, al as OpenAIMessage, i as OpenAIModelItem, am as OpenAIReasoningEffort, an as OpenAIResponseFormat, ao as OpenAIResponsesCompletedEvent, ap as OpenAIResponsesContentPartAddedEvent, aq as OpenAIResponsesContentPartDoneEvent, ar as OpenAIResponsesCreatedEvent, as as OpenAIResponsesError, at as OpenAIResponsesEventBase, au as OpenAIResponsesFailedEvent, av as OpenAIResponsesFunctionCallArgumentsDeltaEvent, aw as OpenAIResponsesFunctionCallArgumentsDoneEvent, ax as OpenAIResponsesInProgressEvent, ay as OpenAIResponsesIncompleteDetails, az as OpenAIResponsesIncompleteEvent, aA as OpenAIResponsesOutputContent, aB as OpenAIResponsesOutputFunctionCall, aC as OpenAIResponsesOutputItem, aD as OpenAIResponsesOutputItemAddedEvent, aE as OpenAIResponsesOutputItemDoneEvent, aF as OpenAIResponsesOutputMessage, aG as OpenAIResponsesOutputReasoning, aH as OpenAIResponsesOutputRefusal, aI as OpenAIResponsesOutputTextContent, aJ as OpenAIResponsesOutputTextDeltaEvent, aK as OpenAIResponsesOutputTextDoneEvent, aL as OpenAIResponsesQueuedEvent, aM as OpenAIResponsesReasoningSummaryPartAddedEvent, aN as OpenAIResponsesReasoningSummaryPartDoneEvent, aO as OpenAIResponsesReasoningSummaryTextDeltaEvent, aP as OpenAIResponsesReasoningSummaryTextDoneEvent, aQ as OpenAIResponsesReasoningTextDeltaEvent, aR as OpenAIResponsesReasoningTextDoneEvent, aS as OpenAIResponsesRefusalDeltaEvent, aT as OpenAIResponsesRefusalDoneEvent, j as OpenAIResponsesRequest, k as OpenAIResponsesResponse, aU as OpenAIResponsesStatus, aV as OpenAIResponsesStream, aW as OpenAIResponsesStreamError, l as OpenAIResponsesStreamEvent, aX as OpenAIResponsesUsage, aY as OpenAIStreamOptions, aZ as OpenAITextContentPart, a_ as OpenAITool, a$ as OpenAIToolCall, b0 as OpenAIToolCallDelta, b1 as OpenAIUsage, b2 as SystemOneConfidence, b3 as SystemOneProbabilities } from './anthropic-CvGVSoVP.js';
|
|
8
8
|
import { T as ToolHandler, a as Tool, A as AnyTool, b as ToolRegistry, c as ToolExecutionResult } from './compose-CeFbHJeO.js';
|
|
9
9
|
export { d as AppliedSkillResult, e as ApplySkillOptions, P as ParsedFrontmatter, S as Skill, f as SkillFrontmatter, g as SkillSummary, h as ToolExecutionContext, i as ToolExecutionFailure, j as ToolExecutionSuccess, k as ToolRegistryOptions, l as applySkill, p as parseFrontmatter } from './compose-CeFbHJeO.js';
|
|
10
10
|
import { M as McpClientLike, a as McpToolDescriptor, b as McpTask, c as McpCallToolResult } from './types-CI-gM2u5.js';
|
|
@@ -970,8 +970,8 @@ declare class ModelsClient {
|
|
|
970
970
|
* model-not-found (404), or VRAM-exhaustion failures.
|
|
971
971
|
*/
|
|
972
972
|
pin(model: string): Promise<void>;
|
|
973
|
-
createBlob(digest: string, data: BinaryBody): Promise<void>;
|
|
974
|
-
checkBlob(digest: string): Promise<boolean>;
|
|
973
|
+
createBlob(digest: string, data: BinaryBody, request?: RequestCancellationOptions): Promise<void>;
|
|
974
|
+
checkBlob(digest: string, request?: RequestCancellationOptions): Promise<boolean>;
|
|
975
975
|
/**
|
|
976
976
|
* Computes a blob digest the way Ollama's content-addressed store expects:
|
|
977
977
|
* SHA-256 over the raw bytes, formatted as `sha256:<64 lowercase hex>`.
|
|
@@ -992,17 +992,44 @@ declare class ModelsClient {
|
|
|
992
992
|
*/
|
|
993
993
|
createBlobFromData(data: Uint8Array, opts?: {
|
|
994
994
|
readonly digest?: string | undefined;
|
|
995
|
-
|
|
996
|
-
|
|
995
|
+
} & RequestCancellationOptions): Promise<BlobUploadResult>;
|
|
996
|
+
/**
|
|
997
|
+
* Streams a blob upload straight from a web `ReadableStream` — the
|
|
998
|
+
* multi-gigabyte-safe counterpart of {@link createBlobFromData}. The body
|
|
999
|
+
* is never materialized in memory: the transport hands the stream to
|
|
1000
|
+
* `fetch` directly (setting `duplex: 'half'`, which Node 18+ requires for
|
|
1001
|
+
* stream bodies), so peak heap usage is a transport-level chunk, not the
|
|
1002
|
+
* blob size.
|
|
1003
|
+
*
|
|
1004
|
+
* The digest must be known up front — it *is* the upload URL
|
|
1005
|
+
* (`/api/blobs/<digest>`), the same content-addressed protocol
|
|
1006
|
+
* `curl -T` performs. Hash first when you don't have it: in-memory bytes
|
|
1007
|
+
* via {@link computeBlobDigest}, files via {@link createBlobFromFile}
|
|
1008
|
+
* (which hashes in a streaming pass). The server verifies the streamed
|
|
1009
|
+
* bytes against the digest and rejects mismatches, so a corrupted or
|
|
1010
|
+
* truncated stream fails the upload instead of poisoning the store.
|
|
1011
|
+
*/
|
|
1012
|
+
createBlobFromStream(digest: string, stream: ReadableStream<Uint8Array>, request?: RequestCancellationOptions): Promise<BlobUploadResult>;
|
|
997
1013
|
/**
|
|
998
1014
|
* Reads a local file and uploads it as a blob (Node.js only — dynamic
|
|
999
1015
|
* `node:fs` import, so browser bundles never pull it in). The file name
|
|
1000
1016
|
* (basename) is what `/api/create`'s `files` map expects as the key, so
|
|
1001
1017
|
* this returns it alongside the digest.
|
|
1018
|
+
*
|
|
1019
|
+
* Streams both passes in fixed-size chunks — peak heap is O(chunk), not
|
|
1020
|
+
* O(file), so multi-gigabyte GGUFs never enter the Node heap:
|
|
1021
|
+
*
|
|
1022
|
+
* 1. **Hash pass** (skipped when `opts.digest` is provided): the file is
|
|
1023
|
+
* streamed through `node:crypto`'s incremental SHA-256.
|
|
1024
|
+
* 2. **Upload pass**: `node:fs` createReadStream → web ReadableStream →
|
|
1025
|
+
* `fetch` body with `duplex: 'half'` (see {@link createBlobFromStream}).
|
|
1026
|
+
*
|
|
1027
|
+
* A pre-existing blob (HEAD 200) skips the upload pass entirely, same as
|
|
1028
|
+
* {@link createBlobFromData}.
|
|
1002
1029
|
*/
|
|
1003
1030
|
createBlobFromFile(path: string, opts?: {
|
|
1004
|
-
readonly
|
|
1005
|
-
}): Promise<BlobUploadResult & {
|
|
1031
|
+
readonly digest?: string | undefined;
|
|
1032
|
+
} & RequestCancellationOptions): Promise<BlobUploadResult & {
|
|
1006
1033
|
readonly fileName: string;
|
|
1007
1034
|
}>;
|
|
1008
1035
|
/**
|
|
@@ -1790,6 +1817,14 @@ interface ChoiceDecision {
|
|
|
1790
1817
|
readonly probabilities: Record<string, number>;
|
|
1791
1818
|
/** Distribution concentration (0–1). NOT a guarantee of correctness. */
|
|
1792
1819
|
readonly confidence: number;
|
|
1820
|
+
/**
|
|
1821
|
+
* Present only when `minConfidence` was configured: `true` when
|
|
1822
|
+
* `confidence >= minConfidence`. Autonomous flows should treat `false` as
|
|
1823
|
+
* "do not act on this decision" — the official System One docs warn that a
|
|
1824
|
+
* high confidence does not guarantee correctness, and a barely-majority
|
|
1825
|
+
* choice (e.g. 0.51) is rarely safe to act on unattended.
|
|
1826
|
+
*/
|
|
1827
|
+
readonly isConfident?: boolean;
|
|
1793
1828
|
/** Token usage for the call. */
|
|
1794
1829
|
readonly usage: {
|
|
1795
1830
|
readonly input_tokens: number;
|
|
@@ -1803,7 +1838,11 @@ interface ChoiceDecision {
|
|
|
1803
1838
|
interface NoulDecision {
|
|
1804
1839
|
/** Probability of true (0–1). */
|
|
1805
1840
|
readonly noul: number;
|
|
1806
|
-
/**
|
|
1841
|
+
/**
|
|
1842
|
+
* Boolean decision: `true` if `noul >= minProbability` (default 0.5).
|
|
1843
|
+
* Raise the bar for safety gates with `minProbability` — e.g. 0.8 for
|
|
1844
|
+
* irreversible actions.
|
|
1845
|
+
*/
|
|
1807
1846
|
readonly bool: boolean;
|
|
1808
1847
|
/** Token usage for the call. */
|
|
1809
1848
|
readonly usage: {
|
|
@@ -1825,6 +1864,8 @@ interface ScoreDecision {
|
|
|
1825
1864
|
readonly probabilities: Record<string, number>;
|
|
1826
1865
|
/** Distribution concentration (0–1). NOT a guarantee of correctness. */
|
|
1827
1866
|
readonly confidence: number;
|
|
1867
|
+
/** Present only when `minConfidence` was configured: `confidence >= minConfidence`. */
|
|
1868
|
+
readonly isConfident?: boolean;
|
|
1828
1869
|
/** Token usage for the call. */
|
|
1829
1870
|
readonly usage: {
|
|
1830
1871
|
readonly input_tokens: number;
|
|
@@ -1839,6 +1880,8 @@ interface RankResult<T extends string> {
|
|
|
1839
1880
|
readonly candidate: T;
|
|
1840
1881
|
readonly score: number;
|
|
1841
1882
|
readonly confidence: number;
|
|
1883
|
+
/** Present only when `minConfidence` was configured: `confidence >= minConfidence`. */
|
|
1884
|
+
readonly isConfident?: boolean;
|
|
1842
1885
|
}
|
|
1843
1886
|
/**
|
|
1844
1887
|
* Higher-level System One decision helpers.
|
|
@@ -1879,6 +1922,12 @@ interface Decision {
|
|
|
1879
1922
|
criteria: Record<string, string | null>;
|
|
1880
1923
|
images?: string[];
|
|
1881
1924
|
keepAlive?: string | number;
|
|
1925
|
+
/**
|
|
1926
|
+
* Opt-in confidence gate in (0, 1]. When set, the result carries
|
|
1927
|
+
* `isConfident: confidence >= minConfidence` so autonomous flows can
|
|
1928
|
+
* refuse to act on barely-majority decisions. Off by default.
|
|
1929
|
+
*/
|
|
1930
|
+
minConfidence?: number;
|
|
1882
1931
|
}): Promise<ChoiceDecision>;
|
|
1883
1932
|
/**
|
|
1884
1933
|
* Ask a single yes/no (noul) question. Returns the probability of
|
|
@@ -1893,6 +1942,12 @@ interface Decision {
|
|
|
1893
1942
|
instructions: SystemOneContent;
|
|
1894
1943
|
images?: string[];
|
|
1895
1944
|
keepAlive?: string | number;
|
|
1945
|
+
/**
|
|
1946
|
+
* Inclusive lower bound in (0, 1] the probability of `true` must meet
|
|
1947
|
+
* for `bool` to be `true`. Default 0.5 (a coin-flip majority). Raise it
|
|
1948
|
+
* (e.g. 0.8) for safety gates and irreversible actions.
|
|
1949
|
+
*/
|
|
1950
|
+
minProbability?: number;
|
|
1896
1951
|
}): Promise<NoulDecision>;
|
|
1897
1952
|
/**
|
|
1898
1953
|
* Ask a single score question. Returns the probability-weighted
|
|
@@ -1905,10 +1960,12 @@ interface Decision {
|
|
|
1905
1960
|
model: string;
|
|
1906
1961
|
state: SystemOneContent;
|
|
1907
1962
|
instructions: SystemOneContent;
|
|
1908
|
-
/** Ordered criteria from lowest (index 0) to highest. 2–
|
|
1963
|
+
/** Ordered criteria from lowest (index 0) to highest. 2–10 items. */
|
|
1909
1964
|
criteria: string[];
|
|
1910
1965
|
images?: string[];
|
|
1911
1966
|
keepAlive?: string | number;
|
|
1967
|
+
/** Opt-in confidence gate in (0, 1] — see {@link Decision.choice}. */
|
|
1968
|
+
minConfidence?: number;
|
|
1912
1969
|
}): Promise<ScoreDecision>;
|
|
1913
1970
|
/**
|
|
1914
1971
|
* Route a request to one of N named options. Convenience wrapper
|
|
@@ -1924,9 +1981,12 @@ interface Decision {
|
|
|
1924
1981
|
criteria: Record<T, string | null>;
|
|
1925
1982
|
images?: string[];
|
|
1926
1983
|
keepAlive?: string | number;
|
|
1984
|
+
/** Opt-in confidence gate in (0, 1] — see {@link Decision.choice}. */
|
|
1985
|
+
minConfidence?: number;
|
|
1927
1986
|
}): Promise<{
|
|
1928
1987
|
readonly route: T;
|
|
1929
1988
|
readonly confidence: number;
|
|
1989
|
+
readonly isConfident?: boolean;
|
|
1930
1990
|
}>;
|
|
1931
1991
|
/**
|
|
1932
1992
|
* Verify whether a claim is supported by evidence. Convenience
|
|
@@ -1945,6 +2005,11 @@ interface Decision {
|
|
|
1945
2005
|
instructions?: SystemOneContent;
|
|
1946
2006
|
images?: string[];
|
|
1947
2007
|
keepAlive?: string | number;
|
|
2008
|
+
/**
|
|
2009
|
+
* Inclusive lower bound in (0, 1] the probability of `true` must meet
|
|
2010
|
+
* for `verified`. Default 0.5. See {@link Decision.noul}.
|
|
2011
|
+
*/
|
|
2012
|
+
minProbability?: number;
|
|
1948
2013
|
}): Promise<{
|
|
1949
2014
|
readonly verified: boolean;
|
|
1950
2015
|
readonly probability: number;
|
|
@@ -1964,7 +2029,7 @@ interface Decision {
|
|
|
1964
2029
|
rank<T extends string>(params: {
|
|
1965
2030
|
model: string;
|
|
1966
2031
|
instructions: SystemOneContent;
|
|
1967
|
-
/** Ordered criteria from lowest (index 0) to highest. 2–
|
|
2032
|
+
/** Ordered criteria from lowest (index 0) to highest. 2–10 items. */
|
|
1968
2033
|
criteria: string[];
|
|
1969
2034
|
candidates: ReadonlyArray<{
|
|
1970
2035
|
readonly id: T;
|
|
@@ -1972,6 +2037,8 @@ interface Decision {
|
|
|
1972
2037
|
}>;
|
|
1973
2038
|
images?: string[];
|
|
1974
2039
|
keepAlive?: string | number;
|
|
2040
|
+
/** Opt-in confidence gate in (0, 1] — flags each result with `isConfident`. */
|
|
2041
|
+
minConfidence?: number;
|
|
1975
2042
|
}): Promise<ReadonlyArray<RankResult<T>>>;
|
|
1976
2043
|
}
|
|
1977
2044
|
/** Create a Decision helper bound to an OllamaClient. */
|
|
@@ -2277,8 +2344,8 @@ declare class OllamaClient {
|
|
|
2277
2344
|
*/
|
|
2278
2345
|
readonly getContextLength: (request: ContextDiscoveryRequestOptions) => Promise<DiscoveredContextLength>;
|
|
2279
2346
|
readonly version: () => Promise<VersionResponse>;
|
|
2280
|
-
readonly createBlob: (digest: string, data: BinaryBody) => Promise<void>;
|
|
2281
|
-
readonly checkBlob: (digest: string) => Promise<boolean>;
|
|
2347
|
+
readonly createBlob: (digest: string, data: BinaryBody, request?: RequestCancellationOptions) => Promise<void>;
|
|
2348
|
+
readonly checkBlob: (digest: string, request?: RequestCancellationOptions) => Promise<boolean>;
|
|
2282
2349
|
/**
|
|
2283
2350
|
* Immediately unloads `model` from VRAM. Convenience alias for
|
|
2284
2351
|
* {@link ModelsClient.unload} — see that method for the full
|
|
@@ -2780,6 +2847,180 @@ declare function toDataStream<TChunk, TFinal>(stream: OllamaStream<TChunk, TFina
|
|
|
2780
2847
|
*/
|
|
2781
2848
|
declare function toResponse<TChunk, TFinal>(stream: OllamaStream<TChunk, TFinal>, init?: ResponseInit): Response;
|
|
2782
2849
|
|
|
2850
|
+
/**
|
|
2851
|
+
* Typed progress callback helpers for `/api/pull` and `/api/push` streams.
|
|
2852
|
+
*
|
|
2853
|
+
* Ollama emits newline-delimited progress frames of the shape:
|
|
2854
|
+
*
|
|
2855
|
+
* ```json
|
|
2856
|
+
* {"status":"pulling manifest"}
|
|
2857
|
+
* {"status":"downloading","digest":"sha256:...","total":1234567,"completed":123}
|
|
2858
|
+
* {"status":"verifying sha256 digest"}
|
|
2859
|
+
* {"status":"writing manifest","digest":"sha256:...","total":42,"completed":42}
|
|
2860
|
+
* {"status":"success"}
|
|
2861
|
+
* ```
|
|
2862
|
+
*
|
|
2863
|
+
* The SDK already exposes these as a typed {@link OllamaStream} via
|
|
2864
|
+
* {@link ModelsClient.pull} / {@link ModelsClient.push} when called
|
|
2865
|
+
* with `{ stream: true }`. This file adds a higher-level helper that
|
|
2866
|
+
* invokes a typed callback on every progress event with a pre-computed
|
|
2867
|
+
* `percent` field — for callers who want a fire-and-forget pull/push
|
|
2868
|
+
* without manually iterating the stream.
|
|
2869
|
+
*
|
|
2870
|
+
* ## When to use this vs. the raw `OllamaStream`
|
|
2871
|
+
*
|
|
2872
|
+
* - **`onProgress(stream, cb)`** — best for download/upload UIs that
|
|
2873
|
+
* just need to render a progress bar. Resolves on `success`,
|
|
2874
|
+
* rejects on stream error.
|
|
2875
|
+
* - **Raw `for await ... of stream`** — best for callers who want
|
|
2876
|
+
* every chunk as a typed event (e.g. for structured logging, or
|
|
2877
|
+
* to react to specific `status` values like `"downloading"` vs
|
|
2878
|
+
* `"verifying sha256 digest"`).
|
|
2879
|
+
*/
|
|
2880
|
+
|
|
2881
|
+
/**
|
|
2882
|
+
* A single progress event delivered to {@link onProgress}'s callback.
|
|
2883
|
+
*
|
|
2884
|
+
* `percent` is `undefined` when the server hasn't reported byte
|
|
2885
|
+
* totals (e.g. for `pulling manifest`, `verifying sha256 digest`,
|
|
2886
|
+
* `success` — these status lines carry no `total`/`completed`).
|
|
2887
|
+
* For `downloading` / `writing manifest` / `writing layer` style
|
|
2888
|
+
* events, `percent` is the ratio of `completed / total`, clamped
|
|
2889
|
+
* to `[0, 100]` and rounded to two decimals.
|
|
2890
|
+
*
|
|
2891
|
+
* `bytesPerSecond` and `etaSeconds` are populated by {@link onProgress}
|
|
2892
|
+
* (via {@link createProgressSpeedTracker}) once at least two
|
|
2893
|
+
* byte-bearing frames for the same layer have arrived. Callers using
|
|
2894
|
+
* {@link toPullProgressEvent} directly get them from their own tracker
|
|
2895
|
+
* — the pure wrapper never measures time.
|
|
2896
|
+
*/
|
|
2897
|
+
interface PullProgressEvent {
|
|
2898
|
+
/** Ollama's status string (`"pulling manifest"`, `"downloading"`, `"success"`, …). */
|
|
2899
|
+
readonly status: string;
|
|
2900
|
+
/** SHA-256 digest of the layer being transferred, when applicable. */
|
|
2901
|
+
readonly digest?: string | undefined;
|
|
2902
|
+
/** Total bytes for this transfer, when the server has reported it. */
|
|
2903
|
+
readonly total?: number | undefined;
|
|
2904
|
+
/** Bytes transferred so far, when the server has reported it. */
|
|
2905
|
+
readonly completed?: number | undefined;
|
|
2906
|
+
/** Completion percentage in `[0, 100]`, or `undefined` when no byte total. */
|
|
2907
|
+
readonly percent?: number | undefined;
|
|
2908
|
+
/**
|
|
2909
|
+
* Cumulative-average transfer speed for the current layer, in bytes per
|
|
2910
|
+
* second (measured since the layer's first byte-bearing frame). `undefined`
|
|
2911
|
+
* until a second byte-bearing frame of the same layer arrives.
|
|
2912
|
+
*/
|
|
2913
|
+
readonly bytesPerSecond?: number | undefined;
|
|
2914
|
+
/**
|
|
2915
|
+
* Estimated seconds remaining for the current layer at the observed
|
|
2916
|
+
* speed: `(total - completed) / bytesPerSecond`. `undefined` while the
|
|
2917
|
+
* speed is unknown or the server hasn't reported a total; `0` once
|
|
2918
|
+
* `completed >= total`.
|
|
2919
|
+
*/
|
|
2920
|
+
readonly etaSeconds?: number | undefined;
|
|
2921
|
+
/** The raw upstream frame, for callers who need fields this helper skips. */
|
|
2922
|
+
readonly raw: ProgressResponse;
|
|
2923
|
+
}
|
|
2924
|
+
/**
|
|
2925
|
+
* Callback shape accepted by {@link onProgress}.
|
|
2926
|
+
*/
|
|
2927
|
+
type ProgressCallback = (event: PullProgressEvent) => void;
|
|
2928
|
+
/**
|
|
2929
|
+
* Compute the completion percentage from a progress chunk.
|
|
2930
|
+
*
|
|
2931
|
+
* Returns `undefined` when either `total` or `completed` is missing
|
|
2932
|
+
* or zero (the server emits byte totals only for `downloading` /
|
|
2933
|
+
* `writing manifest` / `writing layer` style events; for
|
|
2934
|
+
* `pulling manifest`, `verifying sha256 digest`, `success`, etc. the
|
|
2935
|
+
* totals are absent and percent is undefined).
|
|
2936
|
+
*
|
|
2937
|
+
* When both are present, returns `Math.round((completed / total) * 10000) / 100`
|
|
2938
|
+
* — i.e. percent with two decimal places (e.g. `42.37`), clamped to
|
|
2939
|
+
* `[0, 100]` to guard against upstream reporting inconsistencies
|
|
2940
|
+
* (sometimes the server briefly reports `completed > total` during
|
|
2941
|
+
* dedup / verification phases).
|
|
2942
|
+
*/
|
|
2943
|
+
declare function computeProgressPercent(chunk: ProgressResponse): number | undefined;
|
|
2944
|
+
/**
|
|
2945
|
+
* Wrap a {@link ProgressResponse} into a {@link PullProgressEvent}
|
|
2946
|
+
* with a pre-computed `percent` field.
|
|
2947
|
+
*/
|
|
2948
|
+
declare function toPullProgressEvent(chunk: ProgressResponse): PullProgressEvent;
|
|
2949
|
+
/**
|
|
2950
|
+
* Speed/ETA readings produced by {@link createProgressSpeedTracker}.
|
|
2951
|
+
*/
|
|
2952
|
+
interface ProgressSpeed {
|
|
2953
|
+
/** Cumulative-average bytes/second for the current layer, once measurable. */
|
|
2954
|
+
readonly bytesPerSecond?: number | undefined;
|
|
2955
|
+
/** Estimated seconds remaining for the current layer; `0` once complete. */
|
|
2956
|
+
readonly etaSeconds?: number | undefined;
|
|
2957
|
+
}
|
|
2958
|
+
/**
|
|
2959
|
+
* A stateful per-layer transfer-speed measurer. Feed it every raw
|
|
2960
|
+
* `ProgressResponse` chunk, in arrival order; it returns the current
|
|
2961
|
+
* speed/ETA readings for that chunk's layer.
|
|
2962
|
+
*
|
|
2963
|
+
* This is the building block {@link onProgress} uses internally, exported
|
|
2964
|
+
* for consumers who iterate the raw `OllamaStream` themselves (structured
|
|
2965
|
+
* logging, custom dashboards) and would otherwise have to hand-roll a
|
|
2966
|
+
* stateful byte counter.
|
|
2967
|
+
*
|
|
2968
|
+
* Semantics:
|
|
2969
|
+
* - **Per-layer epochs.** A pull/push transfers several layers; each has
|
|
2970
|
+
* its own `digest` and byte range, and `completed` restarts from a low
|
|
2971
|
+
* value when the next layer begins. The tracker starts a fresh epoch
|
|
2972
|
+
* whenever the digest changes or `completed` regresses, so the speed
|
|
2973
|
+
* never averages across layers.
|
|
2974
|
+
* - **Cumulative average.** Speed is measured from the layer's first
|
|
2975
|
+
* byte-bearing frame — `(completed - firstCompleted) / elapsed` — which
|
|
2976
|
+
* is stable for progress bars (instantaneous frame-to-frame rates jitter
|
|
2977
|
+
* wildly).
|
|
2978
|
+
* - **Monotonic clock.** `performance.now()`, immune to wall-clock
|
|
2979
|
+
* adjustments.
|
|
2980
|
+
*
|
|
2981
|
+
* @example
|
|
2982
|
+
* ```ts
|
|
2983
|
+
* const speed = createProgressSpeedTracker();
|
|
2984
|
+
* const stream = await client.models.pull({ model: 'llama3.2', stream: true });
|
|
2985
|
+
* for await (const event of stream) {
|
|
2986
|
+
* if (event.type === 'message') {
|
|
2987
|
+
* const { bytesPerSecond, etaSeconds } = speed(event.data.chunk);
|
|
2988
|
+
* // render: 42.37% at 8.1 MiB/s, ETA 3s
|
|
2989
|
+
* }
|
|
2990
|
+
* }
|
|
2991
|
+
* ```
|
|
2992
|
+
*/
|
|
2993
|
+
declare function createProgressSpeedTracker(): (chunk: ProgressResponse) => ProgressSpeed;
|
|
2994
|
+
/**
|
|
2995
|
+
* Subscribe to a pull/push stream with a typed progress callback.
|
|
2996
|
+
*
|
|
2997
|
+
* Iterates the stream, invokes `callback` on every progress event
|
|
2998
|
+
* with a pre-computed `percent` field, and resolves when the stream
|
|
2999
|
+
* completes (`success` status). Rejects with {@link OllamaStreamError}
|
|
3000
|
+
* if the stream emits an in-band `{"error": "..."}` frame, or with
|
|
3001
|
+
* whatever error the underlying transport surfaces for HTTP-level
|
|
3002
|
+
* failures.
|
|
3003
|
+
*
|
|
3004
|
+
* @example
|
|
3005
|
+
* ```ts
|
|
3006
|
+
* const stream = await client.models.pull({ model: 'llama3.2', stream: true });
|
|
3007
|
+
* await onProgress(stream, (event) => {
|
|
3008
|
+
* if (event.percent !== undefined) {
|
|
3009
|
+
* console.log(`${event.status}: ${event.percent}% (${event.digest?.slice(0, 12) ?? '-'})`);
|
|
3010
|
+
* } else {
|
|
3011
|
+
* console.log(event.status);
|
|
3012
|
+
* }
|
|
3013
|
+
* });
|
|
3014
|
+
* console.log('pull complete');
|
|
3015
|
+
* ```
|
|
3016
|
+
*
|
|
3017
|
+
* @param stream The `OllamaStream` returned by `models.pull({ stream: true })`.
|
|
3018
|
+
* @param callback Invoked on every progress event.
|
|
3019
|
+
* @returns A promise that resolves to the final {@link ProgressStreamResult}
|
|
3020
|
+
* (carrying `status: 'success'`) when the stream completes.
|
|
3021
|
+
*/
|
|
3022
|
+
declare function onProgress(stream: OllamaStream<ProgressResponse, ProgressStreamResult>, callback: ProgressCallback): Promise<ProgressStreamResult>;
|
|
3023
|
+
|
|
2783
3024
|
/**
|
|
2784
3025
|
* Zero-copy stream observation — the safe alternative to `ReadableStream.tee()`
|
|
2785
3026
|
* for multi-sink consumption (audit logging, token counting, telemetry taps).
|
|
@@ -4022,4 +4263,4 @@ declare class ModelAffinityScheduler {
|
|
|
4022
4263
|
/** Convenience factory — `createModelAffinityScheduler(client, opts)` reads better in setups. */
|
|
4023
4264
|
declare function createModelAffinityScheduler(client: ModelAffinityClient | OllamaClient, options?: ModelAffinitySchedulerOptions): ModelAffinityScheduler;
|
|
4024
4265
|
|
|
4025
|
-
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, AbortableAsyncIterable, type AffinityRunningModel, Agent, type AgentChatClient, type AgentConfig, type AgentHooks, type AgentResult, type AgentRunInput, type AgentTurn, type AnswerFor, AnthropicCompatClient, AnyTool, type BackoffOptions, BalanceRequestOptions, type BalanceResponse, type BlobUploadResult, ChatRequestOptions, ChatResponse, ChatStreamResult, type ChoiceDecision, type CompactionOptions, type CompareDraftPerformanceOptions, type ContextCheck, type ContextCheckOptions, type ContextDiscoveryRequestOptions, type ContextLengthSignals, type ContextLengthSource, type ContextWindowSource, type ConversationSendOptions, ConversationSession, type ConversationSessionOptions, CopyRequestOptions, type CreateModelFromGgufOptions, CreateRequestOptions, type CumulativeCacheStats, 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, type Decision, type DefineToolOptions, DeleteRequestOptions, type DiscoveredContextLength, type DraftBenchmarkClient, type DraftPerformanceComparison, type DraftRunStats, type EmbedBatchOptions, type EmbedBatchResult, EmbedRequestOptions, EmbedResponse, EmbeddingsRequestOptions, EmbeddingsResponse, type EndpointHealth, type EndpointHealthCheckResult, EndpointRegistry, type EndpointRegistryOptions, FetchLike, type FetchWithBackoffConfig, FormatOption, type FormattedTelemetry, GEN_AI_SYSTEM_OLLAMA, GenerateRequestOptions, GenerateResponse, GenerateStreamResult, type HistorySanitizeOptions, HttpClient, IMAGE_TOKEN_ESTIMATE, type IncludedBalance, KEEP_ALIVE_INDEFINITE, KEEP_ALIVE_UNLOAD, KNOWN_DONE_REASONS, type KeepAlive, type KnownDoneReason, type LegacyBalanceLimit, type LegacyIncludedBalance, type LoadMcpToolsOptions, Logger, MAX_SYSTEM_ONE_IMAGES_BYTES, MAX_SYSTEM_ONE_REQUEST_BYTES, MESSAGE_OVERHEAD_TOKENS, McpBridge, type McpBridgeOptions, McpCallToolResult, McpClientLike, McpTask, McpToolDescriptor, Message, Middleware, type ModelAffinityClient, ModelAffinityRouter, type ModelAffinityRoutingOptions, ModelAffinityScheduler, type ModelAffinitySchedulerOptions, type ModelAffinitySnapshot, type ModelAffinityStats, type ModelCapabilities, ModelOptions, ModelResponse, ModelsClient, type NoulDecision, OLLAMA_CLOUD_BASE_URL, OLLAMA_FALLBACK_CONTEXT_LENGTH, OllamaClient, type OllamaClientConfig, type OllamaCloudFreeTierQuotaBudgets, type OllamaCredentialConfig, type OllamaEndpoint, OllamaStream, OllamaStreamEvent, OllamaStreamEventType, OpenAICompatClient, type OversizedEmbedInput, type ParallelToolCallBehavior, PingResult, ProgressResponse, ProgressStreamResult, PsResponse, PullRequestOptions, PushRequestOptions, QuotaManager, type QuotaManagerOptions, type QuotaWindowConfig, type QuotaWindowStatus, RETRYABLE_STATUS_CODES, type RankResult, type RawOllamaMetrics, RawUsageSource, RequestCancellationOptions, RequestLifecycleHook, RequestRunner, type ResponsesCreateRequest, type ResponsesCreateResponse, ResponsesModule, type ResponsesReasoningEffort, type ResponsesStreamEvent, type ResponsesToolDefinition, type ResponsesUsage, type RetryConfig, type RuntimeMode, type ScoreDecision, type SessionCompactionOptions, type SessionCompactionResult, type SessionTurn, ShowRequestOptions, ShowResponse, type SpanAttributeValue, type SpanAttributes, StatusResponse, type StreamObserverCallbacks, type StreamObserverPhase, type SupportedSchema, type SystemOneAnswer, type SystemOneAnswers, SystemOneChoiceAnswer, SystemOneChoiceQuestion, SystemOneContent, SystemOneNoulAnswer, SystemOneNoulQuestion, type SystemOneQuestion, type SystemOneQuestions, type SystemOneRequest, type SystemOneResponse, SystemOneScoreAnswer, SystemOneScoreQuestion, type SystemOneUsage, ThinkValue, ThinkingMetadata, type TimeoutSignal, TokenUsage, Tool, ToolCall, ToolCallAccumulator, ToolDefinition, ToolExecutionResult, ToolHandler, ToolParameters, ToolRegistry, type TurnCacheStats, type UsageBucket, type UsageMetrics, UsageRequestOptions, type UsageResponse, VersionResponse, VisionInput, WEB_FETCH_TOOL_NAME, WEB_SEARCH_TOOL_NAME, WebFetchRequestOptions, WebFetchResponse, type WebFetchToolParams, WebSearchRequestOptions, WebSearchResponse, type WebSearchToolParams, type WebToolsClient, type WebToolsOptions, addSpanEvent, batchEmbed, calculateBackoff, canonicalToolCallSignature, checkChatContext, checkEndpointHealth, checkGenerateContext, compactConversationHistory, compareDraftPerformance, contextWarningMessage, createDecision, createModelAffinityScheduler, createOllamaCloudFreeTierQuota, createTimeoutSignal, createWebFetchTool, createWebSearchTool, createWebTools, defineTool, detectModelCapabilities, embedBatchOverflowMessage, encodeImage, estimateChatRequestTokens, estimateGenerateRequestTokens, estimateMessageTokens, estimateSystemOneRequestBytes, estimateTokens, extractContextLength as extractNativeContextLength, extractParameterNumCtx, fetchWithBackoff, findOversizedEmbedInputs, findRunningModelContextLength, formatTelemetry, formatWebFetchResult, formatWebSearchResult, inferRuntimeMode, isKeepAliveSugar, isKnownDoneReason, isModelResident, isSameToolCall, listAllMcpTools, listAvailableModels, loadMcpTools, mergeToolCall, mergeToolCallArgumentsString, mergeToolCallArrays, normalizeChatStream, normalizeGenerateStream, normalizeKeepAlive, normalizeProgressStream, observeStream, parseNdjsonStream, parseStructuredOutput, recommendContextWindow, registerMcpTools, resolveContextLength, resolveCredentialEndpoints, sanitizeHistoryForNextTurn, setSpanError, toDataStream, toResponse, toTextStream, withRetry, withSpan, zodToJsonSchema };
|
|
4266
|
+
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, AbortableAsyncIterable, type AffinityRunningModel, Agent, type AgentChatClient, type AgentConfig, type AgentHooks, type AgentResult, type AgentRunInput, type AgentTurn, type AnswerFor, AnthropicCompatClient, AnyTool, type BackoffOptions, BalanceRequestOptions, type BalanceResponse, type BlobUploadResult, ChatRequestOptions, ChatResponse, ChatStreamResult, type ChoiceDecision, type CompactionOptions, type CompareDraftPerformanceOptions, type ContextCheck, type ContextCheckOptions, type ContextDiscoveryRequestOptions, type ContextLengthSignals, type ContextLengthSource, type ContextWindowSource, type ConversationSendOptions, ConversationSession, type ConversationSessionOptions, CopyRequestOptions, type CreateModelFromGgufOptions, CreateRequestOptions, type CumulativeCacheStats, 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, type Decision, type DefineToolOptions, DeleteRequestOptions, type DiscoveredContextLength, type DraftBenchmarkClient, type DraftPerformanceComparison, type DraftRunStats, type EmbedBatchOptions, type EmbedBatchResult, EmbedRequestOptions, EmbedResponse, EmbeddingsRequestOptions, EmbeddingsResponse, type EndpointHealth, type EndpointHealthCheckResult, EndpointRegistry, type EndpointRegistryOptions, FetchLike, type FetchWithBackoffConfig, FormatOption, type FormattedTelemetry, GEN_AI_SYSTEM_OLLAMA, GenerateRequestOptions, GenerateResponse, GenerateStreamResult, type HistorySanitizeOptions, HttpClient, IMAGE_TOKEN_ESTIMATE, type IncludedBalance, KEEP_ALIVE_INDEFINITE, KEEP_ALIVE_UNLOAD, KNOWN_DONE_REASONS, type KeepAlive, type KnownDoneReason, type LegacyBalanceLimit, type LegacyIncludedBalance, type LoadMcpToolsOptions, Logger, MAX_SYSTEM_ONE_IMAGES_BYTES, MAX_SYSTEM_ONE_REQUEST_BYTES, MESSAGE_OVERHEAD_TOKENS, McpBridge, type McpBridgeOptions, McpCallToolResult, McpClientLike, McpTask, McpToolDescriptor, Message, Middleware, type ModelAffinityClient, ModelAffinityRouter, type ModelAffinityRoutingOptions, ModelAffinityScheduler, type ModelAffinitySchedulerOptions, type ModelAffinitySnapshot, type ModelAffinityStats, type ModelCapabilities, ModelOptions, ModelResponse, ModelsClient, type NoulDecision, OLLAMA_CLOUD_BASE_URL, OLLAMA_FALLBACK_CONTEXT_LENGTH, OllamaClient, type OllamaClientConfig, type OllamaCloudFreeTierQuotaBudgets, type OllamaCredentialConfig, type OllamaEndpoint, OllamaStream, OllamaStreamEvent, OllamaStreamEventType, OpenAICompatClient, type OversizedEmbedInput, type ParallelToolCallBehavior, PingResult, type ProgressCallback, ProgressResponse, type ProgressSpeed, ProgressStreamResult, PsResponse, type PullProgressEvent, PullRequestOptions, PushRequestOptions, QuotaManager, type QuotaManagerOptions, type QuotaWindowConfig, type QuotaWindowStatus, RETRYABLE_STATUS_CODES, type RankResult, type RawOllamaMetrics, RawUsageSource, RequestCancellationOptions, RequestLifecycleHook, RequestRunner, type ResponsesCreateRequest, type ResponsesCreateResponse, ResponsesModule, type ResponsesReasoningEffort, type ResponsesStreamEvent, type ResponsesToolDefinition, type ResponsesUsage, type RetryConfig, type RuntimeMode, type ScoreDecision, type SessionCompactionOptions, type SessionCompactionResult, type SessionTurn, ShowRequestOptions, ShowResponse, type SpanAttributeValue, type SpanAttributes, StatusResponse, type StreamObserverCallbacks, type StreamObserverPhase, type SupportedSchema, type SystemOneAnswer, type SystemOneAnswers, SystemOneChoiceAnswer, SystemOneChoiceQuestion, SystemOneContent, SystemOneNoulAnswer, SystemOneNoulQuestion, type SystemOneQuestion, type SystemOneQuestions, type SystemOneRequest, type SystemOneResponse, SystemOneScoreAnswer, SystemOneScoreQuestion, type SystemOneUsage, ThinkValue, ThinkingMetadata, type TimeoutSignal, TokenUsage, Tool, ToolCall, ToolCallAccumulator, ToolDefinition, ToolExecutionResult, ToolHandler, ToolParameters, ToolRegistry, type TurnCacheStats, type UsageBucket, type UsageMetrics, UsageRequestOptions, type UsageResponse, VersionResponse, VisionInput, WEB_FETCH_TOOL_NAME, WEB_SEARCH_TOOL_NAME, WebFetchRequestOptions, WebFetchResponse, type WebFetchToolParams, WebSearchRequestOptions, WebSearchResponse, type WebSearchToolParams, type WebToolsClient, type WebToolsOptions, addSpanEvent, batchEmbed, calculateBackoff, canonicalToolCallSignature, checkChatContext, checkEndpointHealth, checkGenerateContext, compactConversationHistory, compareDraftPerformance, computeProgressPercent, contextWarningMessage, createDecision, createModelAffinityScheduler, createOllamaCloudFreeTierQuota, createProgressSpeedTracker, createTimeoutSignal, createWebFetchTool, createWebSearchTool, createWebTools, defineTool, detectModelCapabilities, embedBatchOverflowMessage, encodeImage, estimateChatRequestTokens, estimateGenerateRequestTokens, estimateMessageTokens, estimateSystemOneRequestBytes, estimateTokens, extractContextLength as extractNativeContextLength, extractParameterNumCtx, fetchWithBackoff, findOversizedEmbedInputs, findRunningModelContextLength, formatTelemetry, formatWebFetchResult, formatWebSearchResult, inferRuntimeMode, isKeepAliveSugar, isKnownDoneReason, isModelResident, isSameToolCall, listAllMcpTools, listAvailableModels, loadMcpTools, mergeToolCall, mergeToolCallArgumentsString, mergeToolCallArrays, normalizeChatStream, normalizeGenerateStream, normalizeKeepAlive, normalizeProgressStream, observeStream, onProgress, parseNdjsonStream, parseStructuredOutput, recommendContextWindow, registerMcpTools, resolveContextLength, resolveCredentialEndpoints, sanitizeHistoryForNextTurn, setSpanError, toDataStream, toPullProgressEvent, toResponse, toTextStream, withRetry, withSpan, zodToJsonSchema };
|