@nemesis-oss/ollama-sdk 1.0.0 → 1.1.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 +34 -0
- package/README.md +36 -10
- package/dist/{compose-DC11aDJn.d.cts → compose-DJjVpDrk.d.cts} +29 -2
- package/dist/{compose-DC11aDJn.d.ts → compose-DJjVpDrk.d.ts} +29 -2
- package/dist/index.cjs +54 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +107 -10
- package/dist/index.d.ts +107 -10
- package/dist/index.js +54 -13
- package/dist/index.js.map +1 -1
- package/dist/skills.d.cts +2 -2
- package/dist/skills.d.ts +2 -2
- package/package.json +5 -4
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { M as Message, C as ChatResponse, G as GenerateResponse, T as ToolCall, P as ProgressResponse, a as ModelResponse, S as ShowRequestOptions, b as ShowResponse, c as PullRequestOptions, d as PushRequestOptions, e as CreateRequestOptions, D as DeleteRequestOptions, f as StatusResponse, g as CopyRequestOptions, h as PsResponse, V as VersionResponse, i as ChatRequestOptions, j as GenerateRequestOptions, E as EmbedRequestOptions, k as EmbedResponse, l as EmbeddingsRequestOptions, m as EmbeddingsResponse, W as WebSearchRequestOptions, n as WebSearchResponse, o as WebFetchRequestOptions, p as WebFetchResponse, q as ToolHandler, r as Tool, A as AnyTool, s as ToolRegistry, t as ToolExecutionResult, u as ModelOptions, v as ToolDefinition } from './compose-
|
|
2
|
-
export { w as AppliedSkillResult, x as ApplySkillOptions, F as FormatOption, L as ListResponse, y as ModelDetails, z as ParsedFrontmatter, R as RequestCancellationOptions, B as Role, H as Skill, I as SkillFrontmatter, J as SkillSummary, K as ToolCallFunction, N as ToolExecutionContext, O as ToolExecutionFailure, Q as ToolExecutionSuccess, U as ToolFunctionDefinition, X as ToolProperty, Y as ToolRegistryOptions, Z as WebSearchResult, _ as applySkill, $ as parseFrontmatter } from './compose-
|
|
1
|
+
import { M as Message, C as ChatResponse, G as GenerateResponse, T as ToolCall, P as ProgressResponse, a as ModelResponse, S as ShowRequestOptions, b as ShowResponse, c as PullRequestOptions, d as PushRequestOptions, e as CreateRequestOptions, D as DeleteRequestOptions, f as StatusResponse, g as CopyRequestOptions, h as PsResponse, V as VersionResponse, i as ChatRequestOptions, j as GenerateRequestOptions, E as EmbedRequestOptions, k as EmbedResponse, l as EmbeddingsRequestOptions, m as EmbeddingsResponse, W as WebSearchRequestOptions, n as WebSearchResponse, o as WebFetchRequestOptions, p as WebFetchResponse, q as ToolHandler, r as Tool, A as AnyTool, s as ToolRegistry, t as ToolExecutionResult, u as ModelOptions, v as ToolDefinition } from './compose-DJjVpDrk.cjs';
|
|
2
|
+
export { w as AppliedSkillResult, x as ApplySkillOptions, F as FormatOption, L as ListResponse, y as ModelDetails, z as ParsedFrontmatter, R as RequestCancellationOptions, B as Role, H as Skill, I as SkillFrontmatter, J as SkillSummary, K as ToolCallFunction, N as ToolExecutionContext, O as ToolExecutionFailure, Q as ToolExecutionSuccess, U as ToolFunctionDefinition, X as ToolProperty, Y as ToolRegistryOptions, Z as WebSearchResult, _ as applySkill, $ as parseFrontmatter } from './compose-DJjVpDrk.cjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import * as Otel from '@opentelemetry/api';
|
|
5
5
|
|
|
@@ -202,6 +202,8 @@ interface ChatStreamResult {
|
|
|
202
202
|
readonly message: Message;
|
|
203
203
|
readonly model: string;
|
|
204
204
|
readonly done: boolean;
|
|
205
|
+
/** Mirrors the final chunk's `done_reason` (e.g. `"stop"`, `"load"`, `"unload"`). */
|
|
206
|
+
readonly doneReason?: string | undefined;
|
|
205
207
|
readonly totalDurationMs?: number | undefined;
|
|
206
208
|
readonly usage?: TokenUsage | undefined;
|
|
207
209
|
readonly raw?: ChatResponse | undefined;
|
|
@@ -210,6 +212,8 @@ interface GenerateStreamResult {
|
|
|
210
212
|
readonly response: string;
|
|
211
213
|
readonly model: string;
|
|
212
214
|
readonly done: boolean;
|
|
215
|
+
/** Mirrors the final chunk's `done_reason` (e.g. `"stop"`, `"load"`, `"unload"`). */
|
|
216
|
+
readonly doneReason?: string | undefined;
|
|
213
217
|
readonly totalDurationMs?: number | undefined;
|
|
214
218
|
readonly usage?: TokenUsage | undefined;
|
|
215
219
|
readonly raw?: GenerateResponse | undefined;
|
|
@@ -568,13 +572,15 @@ declare class ModelsClient {
|
|
|
568
572
|
*
|
|
569
573
|
* @remarks
|
|
570
574
|
* This is a typed pass-through to Ollama's own OpenAI-compatible `/v1` endpoints — it
|
|
571
|
-
* implements the subset of the OpenAI
|
|
572
|
-
*
|
|
573
|
-
*
|
|
574
|
-
*
|
|
575
|
-
*
|
|
576
|
-
*
|
|
577
|
-
*
|
|
575
|
+
* implements the subset of the OpenAI API surface that Ollama documents as supported
|
|
576
|
+
* (https://docs.ollama.com/api/openai-compatibility), not the full OpenAI surface (hosted
|
|
577
|
+
* tools like web/file search, computer use, code interpreter, or stateful server-side
|
|
578
|
+
* conversation state). Notably, `tools` is supported by Ollama's compat layer but
|
|
579
|
+
* `tool_choice` and `parallel_tool_calls` are not — both are still typed on
|
|
580
|
+
* {@link OpenAIChatCompletionRequest} (accepted-but-ignored) so consumers passing a
|
|
581
|
+
* standard OpenAI request object don't get spurious type errors; see the `@remarks` on
|
|
582
|
+
* each field. `/v1/responses` is supported non-statefully — see
|
|
583
|
+
* {@link OpenAIResponsesRequest}.
|
|
578
584
|
*/
|
|
579
585
|
|
|
580
586
|
interface OpenAIToolCall {
|
|
@@ -621,6 +627,34 @@ interface OpenAIChatCompletionRequest {
|
|
|
621
627
|
readonly frequency_penalty?: number | undefined;
|
|
622
628
|
readonly user?: string | undefined;
|
|
623
629
|
readonly tools?: readonly OpenAITool[] | undefined;
|
|
630
|
+
/**
|
|
631
|
+
* @remarks Accepted for OpenAI compatibility but ignored by Ollama — every tool the
|
|
632
|
+
* model is given remains callable regardless of this value.
|
|
633
|
+
*/
|
|
634
|
+
readonly tool_choice?: 'none' | 'auto' | 'required' | {
|
|
635
|
+
readonly type: 'function';
|
|
636
|
+
readonly function: {
|
|
637
|
+
readonly name: string;
|
|
638
|
+
};
|
|
639
|
+
} | undefined;
|
|
640
|
+
/**
|
|
641
|
+
* @remarks Accepted for OpenAI compatibility but ignored by Ollama — Ollama does not
|
|
642
|
+
* control tool-call parallelism through this flag.
|
|
643
|
+
*/
|
|
644
|
+
readonly parallel_tool_calls?: boolean | undefined;
|
|
645
|
+
/**
|
|
646
|
+
* Effort level for thinking models (e.g. `deepseek-r1`, `qwen3`). Equivalent to
|
|
647
|
+
* `reasoning.effort`; only effective for models that support reasoning/thinking.
|
|
648
|
+
*/
|
|
649
|
+
readonly reasoning_effort?: 'high' | 'medium' | 'low' | 'max' | 'none' | undefined;
|
|
650
|
+
/**
|
|
651
|
+
* Effort level for thinking models (e.g. `deepseek-r1`, `qwen3`), nested OpenAI-style.
|
|
652
|
+
* Equivalent to `reasoning_effort`; only effective for models that support
|
|
653
|
+
* reasoning/thinking.
|
|
654
|
+
*/
|
|
655
|
+
readonly reasoning?: {
|
|
656
|
+
readonly effort?: 'high' | 'medium' | 'low' | 'max' | 'none' | undefined;
|
|
657
|
+
} | undefined;
|
|
624
658
|
}
|
|
625
659
|
interface OpenAIChatCompletionChoice {
|
|
626
660
|
readonly index: number;
|
|
@@ -649,12 +683,60 @@ interface OpenAIListModelsResponse {
|
|
|
649
683
|
readonly object: 'list';
|
|
650
684
|
readonly data: readonly OpenAIModelItem[];
|
|
651
685
|
}
|
|
686
|
+
/**
|
|
687
|
+
* Request body for OpenAI's Responses API (`/v1/responses`), added in Ollama v0.13.3.
|
|
688
|
+
*
|
|
689
|
+
* @remarks
|
|
690
|
+
* Ollama implements this **non-statefully**: every call is independent, so
|
|
691
|
+
* {@link previous_response_id} and {@link conversation} — OpenAI's mechanisms for
|
|
692
|
+
* resuming server-side conversation state — are accepted for compatibility but ignored.
|
|
693
|
+
* Send the full conversation in `input` on every call, the same as `/api/chat`.
|
|
694
|
+
*/
|
|
695
|
+
interface OpenAIResponsesRequest {
|
|
696
|
+
readonly model: string;
|
|
697
|
+
readonly input: string | readonly OpenAIMessage[];
|
|
698
|
+
readonly instructions?: string | undefined;
|
|
699
|
+
readonly tools?: readonly OpenAITool[] | undefined;
|
|
700
|
+
readonly stream?: boolean | undefined;
|
|
701
|
+
readonly temperature?: number | undefined;
|
|
702
|
+
readonly top_p?: number | undefined;
|
|
703
|
+
readonly max_output_tokens?: number | undefined;
|
|
704
|
+
/** @remarks Not supported by Ollama, which is stateless across calls — accepted but ignored. */
|
|
705
|
+
readonly previous_response_id?: string | undefined;
|
|
706
|
+
/** @remarks Not supported by Ollama, which is stateless across calls — accepted but ignored. */
|
|
707
|
+
readonly conversation?: string | undefined;
|
|
708
|
+
readonly truncation?: string | undefined;
|
|
709
|
+
}
|
|
710
|
+
interface OpenAIResponsesOutputTextContent {
|
|
711
|
+
readonly type: 'output_text';
|
|
712
|
+
readonly text: string;
|
|
713
|
+
}
|
|
714
|
+
interface OpenAIResponsesOutputMessage {
|
|
715
|
+
readonly type: 'message';
|
|
716
|
+
readonly role?: string | undefined;
|
|
717
|
+
readonly content: readonly OpenAIResponsesOutputTextContent[];
|
|
718
|
+
}
|
|
719
|
+
/** Non-stateful response shape for `/v1/responses`; see {@link OpenAIResponsesRequest}. */
|
|
720
|
+
interface OpenAIResponsesResponse {
|
|
721
|
+
readonly id: string;
|
|
722
|
+
readonly object: 'response';
|
|
723
|
+
readonly created: number;
|
|
724
|
+
readonly model: string;
|
|
725
|
+
readonly output: readonly OpenAIResponsesOutputMessage[];
|
|
726
|
+
readonly usage?: {
|
|
727
|
+
readonly input_tokens: number;
|
|
728
|
+
readonly output_tokens: number;
|
|
729
|
+
readonly total_tokens: number;
|
|
730
|
+
} | undefined;
|
|
731
|
+
}
|
|
652
732
|
declare class OpenAICompatClient {
|
|
653
733
|
private readonly http;
|
|
654
734
|
constructor(http: HttpClient);
|
|
655
735
|
createChatCompletion(request: OpenAIChatCompletionRequest, signal?: AbortSignal): Promise<OpenAIChatCompletionResponse>;
|
|
656
736
|
chatCompletions(request: OpenAIChatCompletionRequest, signal?: AbortSignal): Promise<OpenAIChatCompletionResponse>;
|
|
657
737
|
listModels(signal?: AbortSignal): Promise<OpenAIListModelsResponse>;
|
|
738
|
+
createResponses(request: OpenAIResponsesRequest, signal?: AbortSignal): Promise<OpenAIResponsesResponse>;
|
|
739
|
+
responses(request: OpenAIResponsesRequest, signal?: AbortSignal): Promise<OpenAIResponsesResponse>;
|
|
658
740
|
}
|
|
659
741
|
|
|
660
742
|
/**
|
|
@@ -1041,4 +1123,19 @@ declare const ATTR_OLLAMA_AGENT_MAX_ITERATIONS = "ollama.agent.max_iterations";
|
|
|
1041
1123
|
declare const ATTR_OLLAMA_AGENT_ITERATION = "ollama.agent.iteration";
|
|
1042
1124
|
declare const GEN_AI_SYSTEM_OLLAMA = "ollama";
|
|
1043
1125
|
|
|
1044
|
-
|
|
1126
|
+
/**
|
|
1127
|
+
* Cross-runtime helpers with no Node.js API dependency, so they stay safe to import from
|
|
1128
|
+
* the core client bundle (see ADR 0006 — Edge Runtime CI).
|
|
1129
|
+
*/
|
|
1130
|
+
/**
|
|
1131
|
+
* Encodes an image to a base64 string, matching the wire format Ollama's `/api/chat` and
|
|
1132
|
+
* `/api/generate` `images` arrays expect.
|
|
1133
|
+
*
|
|
1134
|
+
* - A `string` is assumed to already be base64-encoded and is returned unchanged.
|
|
1135
|
+
* - A `Uint8Array` is base64-encoded using whichever universal primitive the runtime
|
|
1136
|
+
* exposes: `Buffer` on Node.js, `btoa` on browsers/Edge runtimes. Chunked so it doesn't
|
|
1137
|
+
* blow the engine's max call-stack/argument-count limits on large images.
|
|
1138
|
+
*/
|
|
1139
|
+
declare function encodeImage(image: Uint8Array | string): Promise<string>;
|
|
1140
|
+
|
|
1141
|
+
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, type AbortableAsyncIterable, Agent, type AgentChatClient, type AgentConfig, type AgentHooks, type AgentResult, type AgentRunInput, type AgentTurn, type AnthropicCacheControl, AnthropicCompatClient, type AnthropicContentBlock, type AnthropicMessage, type AnthropicMessagesRequest, type AnthropicMessagesResponse, AnyTool, type BackoffOptions, ChatRequestOptions, ChatResponse, type ChatStreamResult, CopyRequestOptions, CreateRequestOptions, DEFAULT_BACKOFF, DEFAULT_BASE_URL, DEFAULT_FAILOVER_CODES, DEFAULT_RETRY_CONFIG, DEFAULT_TIMEOUT_MS, type DefineToolOptions, DeleteRequestOptions, type DoneEvent, EmbedRequestOptions, EmbedResponse, EmbeddingsRequestOptions, EmbeddingsResponse, type EndpointHealth, type EndpointHealthCheckResult, EndpointRegistry, type EndpointRegistryOptions, type ErrorEvent, type FetchLike, GEN_AI_SYSTEM_OLLAMA, GenerateRequestOptions, GenerateResponse, type GenerateStreamResult, type HttpBody, HttpClient, type HttpClientOptions, type HttpRequestOptions, type LifecycleErrorEvent, type LifecycleRetryEvent, type LifecycleStartEvent, type LifecycleSuccessEvent, type LoadMcpToolsOptions, type LogFn, type Logger, type McpCallToolResult, type McpClientLike, type McpContentBlock, type McpListToolsResult, type McpToolDescriptor, Message, type MessageEvent, type Middleware, type MiddlewareContext, type ModelCapabilities, ModelOptions, ModelResponse, ModelsClient, NANOS_PER_MS, NANOS_PER_SECOND, NOOP_LOGGER, type NextFunction, OllamaAbortError, OllamaAgentMaxIterationsError, OllamaAuthError, OllamaClient, type OllamaClientConfig, OllamaClientError, type OllamaClientErrorOptions, type OllamaEndpoint, type OllamaErrorRequestContext, type OllamaErrorResponseContext, OllamaGenericClientError, OllamaMcpError, OllamaNetworkError, OllamaNotFoundError, OllamaRateLimitError, OllamaServerError, OllamaSkillInvalidError, OllamaSkillNotFoundError, OllamaStream, type OllamaStreamEvent, type OllamaStreamEventType, OllamaTimeoutError, OllamaToolTimeoutError, OllamaToolValidationError, OllamaUnsupportedCapabilityError, type OpenAIChatCompletionChoice, type OpenAIChatCompletionRequest, type OpenAIChatCompletionResponse, OpenAICompatClient, type OpenAIFunctionDefinition, type OpenAIListModelsResponse, type OpenAIMessage, type OpenAIModelItem, type OpenAIResponsesOutputMessage, type OpenAIResponsesOutputTextContent, type OpenAIResponsesRequest, type OpenAIResponsesResponse, type OpenAIStreamOptions, type OpenAITool, type OpenAIToolCall, ProgressResponse, type ProgressStreamResult, PsResponse, PullRequestOptions, PushRequestOptions, type RawUsageSource, type RequestContext, type RequestLifecycleEvent, type RequestLifecycleHook, type RequestRunner, type ResponseContext, type RetryConfig, type RuntimeMode, ShowRequestOptions, ShowResponse, type SpanAttributeValue, type SpanAttributes, StatusResponse, type SupportedSchema, type ThinkingEvent, type TimeoutSignal, type TokenEvent, type TokenUsage, Tool, ToolCall, type ToolCallEvent, ToolDefinition, ToolExecutionResult, ToolHandler, ToolRegistry, VersionResponse, WebFetchRequestOptions, WebFetchResponse, WebSearchRequestOptions, WebSearchResponse, addSpanEvent, calculateBackoff, checkEndpointHealth, composeMiddleware, createConsoleLogger, createTimeoutSignal, defineTool, detectModelCapabilities, encodeImage, extractUsage, inferRuntimeMode, listAvailableModels, loadMcpTools, mapError, normalizeChatStream, normalizeGenerateStream, normalizeProgressStream, parseNdjsonStream, parseStructuredOutput, registerMcpTools, setSpanError, toDataStream, toResponse, toTextStream, withRetry, withSpan, zodToJsonSchema };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { M as Message, C as ChatResponse, G as GenerateResponse, T as ToolCall, P as ProgressResponse, a as ModelResponse, S as ShowRequestOptions, b as ShowResponse, c as PullRequestOptions, d as PushRequestOptions, e as CreateRequestOptions, D as DeleteRequestOptions, f as StatusResponse, g as CopyRequestOptions, h as PsResponse, V as VersionResponse, i as ChatRequestOptions, j as GenerateRequestOptions, E as EmbedRequestOptions, k as EmbedResponse, l as EmbeddingsRequestOptions, m as EmbeddingsResponse, W as WebSearchRequestOptions, n as WebSearchResponse, o as WebFetchRequestOptions, p as WebFetchResponse, q as ToolHandler, r as Tool, A as AnyTool, s as ToolRegistry, t as ToolExecutionResult, u as ModelOptions, v as ToolDefinition } from './compose-
|
|
2
|
-
export { w as AppliedSkillResult, x as ApplySkillOptions, F as FormatOption, L as ListResponse, y as ModelDetails, z as ParsedFrontmatter, R as RequestCancellationOptions, B as Role, H as Skill, I as SkillFrontmatter, J as SkillSummary, K as ToolCallFunction, N as ToolExecutionContext, O as ToolExecutionFailure, Q as ToolExecutionSuccess, U as ToolFunctionDefinition, X as ToolProperty, Y as ToolRegistryOptions, Z as WebSearchResult, _ as applySkill, $ as parseFrontmatter } from './compose-
|
|
1
|
+
import { M as Message, C as ChatResponse, G as GenerateResponse, T as ToolCall, P as ProgressResponse, a as ModelResponse, S as ShowRequestOptions, b as ShowResponse, c as PullRequestOptions, d as PushRequestOptions, e as CreateRequestOptions, D as DeleteRequestOptions, f as StatusResponse, g as CopyRequestOptions, h as PsResponse, V as VersionResponse, i as ChatRequestOptions, j as GenerateRequestOptions, E as EmbedRequestOptions, k as EmbedResponse, l as EmbeddingsRequestOptions, m as EmbeddingsResponse, W as WebSearchRequestOptions, n as WebSearchResponse, o as WebFetchRequestOptions, p as WebFetchResponse, q as ToolHandler, r as Tool, A as AnyTool, s as ToolRegistry, t as ToolExecutionResult, u as ModelOptions, v as ToolDefinition } from './compose-DJjVpDrk.js';
|
|
2
|
+
export { w as AppliedSkillResult, x as ApplySkillOptions, F as FormatOption, L as ListResponse, y as ModelDetails, z as ParsedFrontmatter, R as RequestCancellationOptions, B as Role, H as Skill, I as SkillFrontmatter, J as SkillSummary, K as ToolCallFunction, N as ToolExecutionContext, O as ToolExecutionFailure, Q as ToolExecutionSuccess, U as ToolFunctionDefinition, X as ToolProperty, Y as ToolRegistryOptions, Z as WebSearchResult, _ as applySkill, $ as parseFrontmatter } from './compose-DJjVpDrk.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import * as Otel from '@opentelemetry/api';
|
|
5
5
|
|
|
@@ -202,6 +202,8 @@ interface ChatStreamResult {
|
|
|
202
202
|
readonly message: Message;
|
|
203
203
|
readonly model: string;
|
|
204
204
|
readonly done: boolean;
|
|
205
|
+
/** Mirrors the final chunk's `done_reason` (e.g. `"stop"`, `"load"`, `"unload"`). */
|
|
206
|
+
readonly doneReason?: string | undefined;
|
|
205
207
|
readonly totalDurationMs?: number | undefined;
|
|
206
208
|
readonly usage?: TokenUsage | undefined;
|
|
207
209
|
readonly raw?: ChatResponse | undefined;
|
|
@@ -210,6 +212,8 @@ interface GenerateStreamResult {
|
|
|
210
212
|
readonly response: string;
|
|
211
213
|
readonly model: string;
|
|
212
214
|
readonly done: boolean;
|
|
215
|
+
/** Mirrors the final chunk's `done_reason` (e.g. `"stop"`, `"load"`, `"unload"`). */
|
|
216
|
+
readonly doneReason?: string | undefined;
|
|
213
217
|
readonly totalDurationMs?: number | undefined;
|
|
214
218
|
readonly usage?: TokenUsage | undefined;
|
|
215
219
|
readonly raw?: GenerateResponse | undefined;
|
|
@@ -568,13 +572,15 @@ declare class ModelsClient {
|
|
|
568
572
|
*
|
|
569
573
|
* @remarks
|
|
570
574
|
* This is a typed pass-through to Ollama's own OpenAI-compatible `/v1` endpoints — it
|
|
571
|
-
* implements the subset of the OpenAI
|
|
572
|
-
*
|
|
573
|
-
*
|
|
574
|
-
*
|
|
575
|
-
*
|
|
576
|
-
*
|
|
577
|
-
*
|
|
575
|
+
* implements the subset of the OpenAI API surface that Ollama documents as supported
|
|
576
|
+
* (https://docs.ollama.com/api/openai-compatibility), not the full OpenAI surface (hosted
|
|
577
|
+
* tools like web/file search, computer use, code interpreter, or stateful server-side
|
|
578
|
+
* conversation state). Notably, `tools` is supported by Ollama's compat layer but
|
|
579
|
+
* `tool_choice` and `parallel_tool_calls` are not — both are still typed on
|
|
580
|
+
* {@link OpenAIChatCompletionRequest} (accepted-but-ignored) so consumers passing a
|
|
581
|
+
* standard OpenAI request object don't get spurious type errors; see the `@remarks` on
|
|
582
|
+
* each field. `/v1/responses` is supported non-statefully — see
|
|
583
|
+
* {@link OpenAIResponsesRequest}.
|
|
578
584
|
*/
|
|
579
585
|
|
|
580
586
|
interface OpenAIToolCall {
|
|
@@ -621,6 +627,34 @@ interface OpenAIChatCompletionRequest {
|
|
|
621
627
|
readonly frequency_penalty?: number | undefined;
|
|
622
628
|
readonly user?: string | undefined;
|
|
623
629
|
readonly tools?: readonly OpenAITool[] | undefined;
|
|
630
|
+
/**
|
|
631
|
+
* @remarks Accepted for OpenAI compatibility but ignored by Ollama — every tool the
|
|
632
|
+
* model is given remains callable regardless of this value.
|
|
633
|
+
*/
|
|
634
|
+
readonly tool_choice?: 'none' | 'auto' | 'required' | {
|
|
635
|
+
readonly type: 'function';
|
|
636
|
+
readonly function: {
|
|
637
|
+
readonly name: string;
|
|
638
|
+
};
|
|
639
|
+
} | undefined;
|
|
640
|
+
/**
|
|
641
|
+
* @remarks Accepted for OpenAI compatibility but ignored by Ollama — Ollama does not
|
|
642
|
+
* control tool-call parallelism through this flag.
|
|
643
|
+
*/
|
|
644
|
+
readonly parallel_tool_calls?: boolean | undefined;
|
|
645
|
+
/**
|
|
646
|
+
* Effort level for thinking models (e.g. `deepseek-r1`, `qwen3`). Equivalent to
|
|
647
|
+
* `reasoning.effort`; only effective for models that support reasoning/thinking.
|
|
648
|
+
*/
|
|
649
|
+
readonly reasoning_effort?: 'high' | 'medium' | 'low' | 'max' | 'none' | undefined;
|
|
650
|
+
/**
|
|
651
|
+
* Effort level for thinking models (e.g. `deepseek-r1`, `qwen3`), nested OpenAI-style.
|
|
652
|
+
* Equivalent to `reasoning_effort`; only effective for models that support
|
|
653
|
+
* reasoning/thinking.
|
|
654
|
+
*/
|
|
655
|
+
readonly reasoning?: {
|
|
656
|
+
readonly effort?: 'high' | 'medium' | 'low' | 'max' | 'none' | undefined;
|
|
657
|
+
} | undefined;
|
|
624
658
|
}
|
|
625
659
|
interface OpenAIChatCompletionChoice {
|
|
626
660
|
readonly index: number;
|
|
@@ -649,12 +683,60 @@ interface OpenAIListModelsResponse {
|
|
|
649
683
|
readonly object: 'list';
|
|
650
684
|
readonly data: readonly OpenAIModelItem[];
|
|
651
685
|
}
|
|
686
|
+
/**
|
|
687
|
+
* Request body for OpenAI's Responses API (`/v1/responses`), added in Ollama v0.13.3.
|
|
688
|
+
*
|
|
689
|
+
* @remarks
|
|
690
|
+
* Ollama implements this **non-statefully**: every call is independent, so
|
|
691
|
+
* {@link previous_response_id} and {@link conversation} — OpenAI's mechanisms for
|
|
692
|
+
* resuming server-side conversation state — are accepted for compatibility but ignored.
|
|
693
|
+
* Send the full conversation in `input` on every call, the same as `/api/chat`.
|
|
694
|
+
*/
|
|
695
|
+
interface OpenAIResponsesRequest {
|
|
696
|
+
readonly model: string;
|
|
697
|
+
readonly input: string | readonly OpenAIMessage[];
|
|
698
|
+
readonly instructions?: string | undefined;
|
|
699
|
+
readonly tools?: readonly OpenAITool[] | undefined;
|
|
700
|
+
readonly stream?: boolean | undefined;
|
|
701
|
+
readonly temperature?: number | undefined;
|
|
702
|
+
readonly top_p?: number | undefined;
|
|
703
|
+
readonly max_output_tokens?: number | undefined;
|
|
704
|
+
/** @remarks Not supported by Ollama, which is stateless across calls — accepted but ignored. */
|
|
705
|
+
readonly previous_response_id?: string | undefined;
|
|
706
|
+
/** @remarks Not supported by Ollama, which is stateless across calls — accepted but ignored. */
|
|
707
|
+
readonly conversation?: string | undefined;
|
|
708
|
+
readonly truncation?: string | undefined;
|
|
709
|
+
}
|
|
710
|
+
interface OpenAIResponsesOutputTextContent {
|
|
711
|
+
readonly type: 'output_text';
|
|
712
|
+
readonly text: string;
|
|
713
|
+
}
|
|
714
|
+
interface OpenAIResponsesOutputMessage {
|
|
715
|
+
readonly type: 'message';
|
|
716
|
+
readonly role?: string | undefined;
|
|
717
|
+
readonly content: readonly OpenAIResponsesOutputTextContent[];
|
|
718
|
+
}
|
|
719
|
+
/** Non-stateful response shape for `/v1/responses`; see {@link OpenAIResponsesRequest}. */
|
|
720
|
+
interface OpenAIResponsesResponse {
|
|
721
|
+
readonly id: string;
|
|
722
|
+
readonly object: 'response';
|
|
723
|
+
readonly created: number;
|
|
724
|
+
readonly model: string;
|
|
725
|
+
readonly output: readonly OpenAIResponsesOutputMessage[];
|
|
726
|
+
readonly usage?: {
|
|
727
|
+
readonly input_tokens: number;
|
|
728
|
+
readonly output_tokens: number;
|
|
729
|
+
readonly total_tokens: number;
|
|
730
|
+
} | undefined;
|
|
731
|
+
}
|
|
652
732
|
declare class OpenAICompatClient {
|
|
653
733
|
private readonly http;
|
|
654
734
|
constructor(http: HttpClient);
|
|
655
735
|
createChatCompletion(request: OpenAIChatCompletionRequest, signal?: AbortSignal): Promise<OpenAIChatCompletionResponse>;
|
|
656
736
|
chatCompletions(request: OpenAIChatCompletionRequest, signal?: AbortSignal): Promise<OpenAIChatCompletionResponse>;
|
|
657
737
|
listModels(signal?: AbortSignal): Promise<OpenAIListModelsResponse>;
|
|
738
|
+
createResponses(request: OpenAIResponsesRequest, signal?: AbortSignal): Promise<OpenAIResponsesResponse>;
|
|
739
|
+
responses(request: OpenAIResponsesRequest, signal?: AbortSignal): Promise<OpenAIResponsesResponse>;
|
|
658
740
|
}
|
|
659
741
|
|
|
660
742
|
/**
|
|
@@ -1041,4 +1123,19 @@ declare const ATTR_OLLAMA_AGENT_MAX_ITERATIONS = "ollama.agent.max_iterations";
|
|
|
1041
1123
|
declare const ATTR_OLLAMA_AGENT_ITERATION = "ollama.agent.iteration";
|
|
1042
1124
|
declare const GEN_AI_SYSTEM_OLLAMA = "ollama";
|
|
1043
1125
|
|
|
1044
|
-
|
|
1126
|
+
/**
|
|
1127
|
+
* Cross-runtime helpers with no Node.js API dependency, so they stay safe to import from
|
|
1128
|
+
* the core client bundle (see ADR 0006 — Edge Runtime CI).
|
|
1129
|
+
*/
|
|
1130
|
+
/**
|
|
1131
|
+
* Encodes an image to a base64 string, matching the wire format Ollama's `/api/chat` and
|
|
1132
|
+
* `/api/generate` `images` arrays expect.
|
|
1133
|
+
*
|
|
1134
|
+
* - A `string` is assumed to already be base64-encoded and is returned unchanged.
|
|
1135
|
+
* - A `Uint8Array` is base64-encoded using whichever universal primitive the runtime
|
|
1136
|
+
* exposes: `Buffer` on Node.js, `btoa` on browsers/Edge runtimes. Chunked so it doesn't
|
|
1137
|
+
* blow the engine's max call-stack/argument-count limits on large images.
|
|
1138
|
+
*/
|
|
1139
|
+
declare function encodeImage(image: Uint8Array | string): Promise<string>;
|
|
1140
|
+
|
|
1141
|
+
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, type AbortableAsyncIterable, Agent, type AgentChatClient, type AgentConfig, type AgentHooks, type AgentResult, type AgentRunInput, type AgentTurn, type AnthropicCacheControl, AnthropicCompatClient, type AnthropicContentBlock, type AnthropicMessage, type AnthropicMessagesRequest, type AnthropicMessagesResponse, AnyTool, type BackoffOptions, ChatRequestOptions, ChatResponse, type ChatStreamResult, CopyRequestOptions, CreateRequestOptions, DEFAULT_BACKOFF, DEFAULT_BASE_URL, DEFAULT_FAILOVER_CODES, DEFAULT_RETRY_CONFIG, DEFAULT_TIMEOUT_MS, type DefineToolOptions, DeleteRequestOptions, type DoneEvent, EmbedRequestOptions, EmbedResponse, EmbeddingsRequestOptions, EmbeddingsResponse, type EndpointHealth, type EndpointHealthCheckResult, EndpointRegistry, type EndpointRegistryOptions, type ErrorEvent, type FetchLike, GEN_AI_SYSTEM_OLLAMA, GenerateRequestOptions, GenerateResponse, type GenerateStreamResult, type HttpBody, HttpClient, type HttpClientOptions, type HttpRequestOptions, type LifecycleErrorEvent, type LifecycleRetryEvent, type LifecycleStartEvent, type LifecycleSuccessEvent, type LoadMcpToolsOptions, type LogFn, type Logger, type McpCallToolResult, type McpClientLike, type McpContentBlock, type McpListToolsResult, type McpToolDescriptor, Message, type MessageEvent, type Middleware, type MiddlewareContext, type ModelCapabilities, ModelOptions, ModelResponse, ModelsClient, NANOS_PER_MS, NANOS_PER_SECOND, NOOP_LOGGER, type NextFunction, OllamaAbortError, OllamaAgentMaxIterationsError, OllamaAuthError, OllamaClient, type OllamaClientConfig, OllamaClientError, type OllamaClientErrorOptions, type OllamaEndpoint, type OllamaErrorRequestContext, type OllamaErrorResponseContext, OllamaGenericClientError, OllamaMcpError, OllamaNetworkError, OllamaNotFoundError, OllamaRateLimitError, OllamaServerError, OllamaSkillInvalidError, OllamaSkillNotFoundError, OllamaStream, type OllamaStreamEvent, type OllamaStreamEventType, OllamaTimeoutError, OllamaToolTimeoutError, OllamaToolValidationError, OllamaUnsupportedCapabilityError, type OpenAIChatCompletionChoice, type OpenAIChatCompletionRequest, type OpenAIChatCompletionResponse, OpenAICompatClient, type OpenAIFunctionDefinition, type OpenAIListModelsResponse, type OpenAIMessage, type OpenAIModelItem, type OpenAIResponsesOutputMessage, type OpenAIResponsesOutputTextContent, type OpenAIResponsesRequest, type OpenAIResponsesResponse, type OpenAIStreamOptions, type OpenAITool, type OpenAIToolCall, ProgressResponse, type ProgressStreamResult, PsResponse, PullRequestOptions, PushRequestOptions, type RawUsageSource, type RequestContext, type RequestLifecycleEvent, type RequestLifecycleHook, type RequestRunner, type ResponseContext, type RetryConfig, type RuntimeMode, ShowRequestOptions, ShowResponse, type SpanAttributeValue, type SpanAttributes, StatusResponse, type SupportedSchema, type ThinkingEvent, type TimeoutSignal, type TokenEvent, type TokenUsage, Tool, ToolCall, type ToolCallEvent, ToolDefinition, ToolExecutionResult, ToolHandler, ToolRegistry, VersionResponse, WebFetchRequestOptions, WebFetchResponse, WebSearchRequestOptions, WebSearchResponse, addSpanEvent, calculateBackoff, checkEndpointHealth, composeMiddleware, createConsoleLogger, createTimeoutSignal, defineTool, detectModelCapabilities, encodeImage, extractUsage, inferRuntimeMode, listAvailableModels, loadMcpTools, mapError, normalizeChatStream, normalizeGenerateStream, normalizeProgressStream, parseNdjsonStream, parseStructuredOutput, registerMcpTools, setSpanError, toDataStream, toResponse, toTextStream, withRetry, withSpan, zodToJsonSchema };
|
package/dist/index.js
CHANGED
|
@@ -820,6 +820,7 @@ function aggregateChat(accumulated, chunk) {
|
|
|
820
820
|
},
|
|
821
821
|
model: chunk.model,
|
|
822
822
|
done: chunk.done,
|
|
823
|
+
doneReason: chunk.done ? chunk.done_reason : accumulated.doneReason,
|
|
823
824
|
totalDurationMs: chunk.done && chunk.total_duration !== void 0 ? chunk.total_duration / NANOS_PER_MS : accumulated.totalDurationMs,
|
|
824
825
|
usage: chunk.done ? extractUsage(chunk) : accumulated.usage,
|
|
825
826
|
raw: chunk
|
|
@@ -869,6 +870,7 @@ function aggregateGenerate(accumulated, chunk) {
|
|
|
869
870
|
response: accumulated.response + (chunk.response ?? ""),
|
|
870
871
|
model: chunk.model,
|
|
871
872
|
done: chunk.done,
|
|
873
|
+
doneReason: chunk.done ? chunk.done_reason : accumulated.doneReason,
|
|
872
874
|
totalDurationMs: chunk.done && chunk.total_duration !== void 0 ? chunk.total_duration / NANOS_PER_MS : accumulated.totalDurationMs,
|
|
873
875
|
usage: chunk.done ? extractUsage(chunk) : accumulated.usage,
|
|
874
876
|
raw: chunk
|
|
@@ -1157,6 +1159,16 @@ var OpenAICompatClient = class {
|
|
|
1157
1159
|
signal
|
|
1158
1160
|
});
|
|
1159
1161
|
}
|
|
1162
|
+
async createResponses(request, signal) {
|
|
1163
|
+
return this.http.request({
|
|
1164
|
+
path: "/v1/responses",
|
|
1165
|
+
body: request,
|
|
1166
|
+
signal
|
|
1167
|
+
});
|
|
1168
|
+
}
|
|
1169
|
+
async responses(request, signal) {
|
|
1170
|
+
return this.createResponses(request, signal);
|
|
1171
|
+
}
|
|
1160
1172
|
};
|
|
1161
1173
|
|
|
1162
1174
|
// src/integrations/anthropic.ts
|
|
@@ -1177,6 +1189,32 @@ var AnthropicCompatClient = class {
|
|
|
1177
1189
|
}
|
|
1178
1190
|
};
|
|
1179
1191
|
|
|
1192
|
+
// src/utils.ts
|
|
1193
|
+
async function encodeImage(image) {
|
|
1194
|
+
if (typeof image === "string") return image;
|
|
1195
|
+
const bufferCtor = globalThis.Buffer;
|
|
1196
|
+
if (bufferCtor !== void 0) return bufferCtor.from(image).toString("base64");
|
|
1197
|
+
const CHUNK_SIZE = 32768;
|
|
1198
|
+
let binary = "";
|
|
1199
|
+
for (let i = 0; i < image.length; i += CHUNK_SIZE) {
|
|
1200
|
+
binary += String.fromCharCode(...image.subarray(i, i + CHUNK_SIZE));
|
|
1201
|
+
}
|
|
1202
|
+
return btoa(binary);
|
|
1203
|
+
}
|
|
1204
|
+
async function encodeImages(images) {
|
|
1205
|
+
if (images === void 0) return void 0;
|
|
1206
|
+
return Promise.all(images.map((image) => encodeImage(image)));
|
|
1207
|
+
}
|
|
1208
|
+
async function withEncodedImages(req) {
|
|
1209
|
+
if (!req.images?.some((image) => image instanceof Uint8Array)) return req;
|
|
1210
|
+
return { ...req, images: await encodeImages(req.images) };
|
|
1211
|
+
}
|
|
1212
|
+
async function withEncodedMessageImages(messages) {
|
|
1213
|
+
if (!messages.some((message) => message.images?.some((image) => image instanceof Uint8Array)))
|
|
1214
|
+
return messages;
|
|
1215
|
+
return Promise.all(messages.map((message) => withEncodedImages(message)));
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1180
1218
|
// src/client.ts
|
|
1181
1219
|
var OllamaClient = class {
|
|
1182
1220
|
registry;
|
|
@@ -1262,12 +1300,13 @@ var OllamaClient = class {
|
|
|
1262
1300
|
}
|
|
1263
1301
|
}
|
|
1264
1302
|
async chat(req) {
|
|
1303
|
+
const messages = await withEncodedMessageImages(req.messages);
|
|
1265
1304
|
if (req.stream) {
|
|
1266
1305
|
return this.executeWithFailover(async (http, signal) => {
|
|
1267
1306
|
if (req.format !== void 0) this.assertStructuredOutputSupported(http.baseUrl, req.model);
|
|
1268
1307
|
const stream = await http.requestStream({
|
|
1269
1308
|
path: "/api/chat",
|
|
1270
|
-
body: { ...req, stream: true },
|
|
1309
|
+
body: { ...req, messages, stream: true },
|
|
1271
1310
|
signal
|
|
1272
1311
|
});
|
|
1273
1312
|
return normalizeChatStream(stream);
|
|
@@ -1286,7 +1325,7 @@ var OllamaClient = class {
|
|
|
1286
1325
|
this.assertStructuredOutputSupported(http.baseUrl, req.model);
|
|
1287
1326
|
return http.request({
|
|
1288
1327
|
path: "/api/chat",
|
|
1289
|
-
body: { ...req, stream: false },
|
|
1328
|
+
body: { ...req, messages, stream: false },
|
|
1290
1329
|
signal
|
|
1291
1330
|
});
|
|
1292
1331
|
}, req);
|
|
@@ -1313,34 +1352,36 @@ var OllamaClient = class {
|
|
|
1313
1352
|
return parseStructuredOutput(res.message.content, schema);
|
|
1314
1353
|
}
|
|
1315
1354
|
async generate(req) {
|
|
1316
|
-
|
|
1355
|
+
const encodedReq = await withEncodedImages(req);
|
|
1356
|
+
if (encodedReq.stream) {
|
|
1317
1357
|
return this.executeWithFailover(async (http, signal) => {
|
|
1318
|
-
if (
|
|
1358
|
+
if (encodedReq.format !== void 0)
|
|
1359
|
+
this.assertStructuredOutputSupported(http.baseUrl, encodedReq.model);
|
|
1319
1360
|
const stream = await http.requestStream({
|
|
1320
1361
|
path: "/api/generate",
|
|
1321
|
-
body: { ...
|
|
1362
|
+
body: { ...encodedReq, stream: true },
|
|
1322
1363
|
signal
|
|
1323
1364
|
});
|
|
1324
1365
|
return normalizeGenerateStream(stream);
|
|
1325
|
-
},
|
|
1366
|
+
}, encodedReq);
|
|
1326
1367
|
}
|
|
1327
1368
|
return withSpan(
|
|
1328
|
-
`text_completion ${
|
|
1369
|
+
`text_completion ${encodedReq.model}`,
|
|
1329
1370
|
{
|
|
1330
1371
|
[ATTR_GEN_AI_SYSTEM]: GEN_AI_SYSTEM_OLLAMA,
|
|
1331
1372
|
[ATTR_GEN_AI_OPERATION_NAME]: "text_completion",
|
|
1332
|
-
[ATTR_GEN_AI_REQUEST_MODEL]:
|
|
1373
|
+
[ATTR_GEN_AI_REQUEST_MODEL]: encodedReq.model
|
|
1333
1374
|
},
|
|
1334
1375
|
async (span) => {
|
|
1335
1376
|
const res = await this.executeWithFailover((http, signal) => {
|
|
1336
|
-
if (
|
|
1337
|
-
this.assertStructuredOutputSupported(http.baseUrl,
|
|
1377
|
+
if (encodedReq.format !== void 0)
|
|
1378
|
+
this.assertStructuredOutputSupported(http.baseUrl, encodedReq.model);
|
|
1338
1379
|
return http.request({
|
|
1339
1380
|
path: "/api/generate",
|
|
1340
|
-
body: { ...
|
|
1381
|
+
body: { ...encodedReq, stream: false },
|
|
1341
1382
|
signal
|
|
1342
1383
|
});
|
|
1343
|
-
},
|
|
1384
|
+
}, encodedReq);
|
|
1344
1385
|
span?.setAttributes({
|
|
1345
1386
|
[ATTR_GEN_AI_RESPONSE_MODEL]: res.model,
|
|
1346
1387
|
...res.prompt_eval_count !== void 0 ? { [ATTR_GEN_AI_USAGE_INPUT_TOKENS]: res.prompt_eval_count } : {},
|
|
@@ -1964,6 +2005,6 @@ var Agent = class {
|
|
|
1964
2005
|
}
|
|
1965
2006
|
};
|
|
1966
2007
|
|
|
1967
|
-
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, DEFAULT_BACKOFF, DEFAULT_BASE_URL, DEFAULT_FAILOVER_CODES, DEFAULT_RETRY_CONFIG, DEFAULT_TIMEOUT_MS, EndpointRegistry, GEN_AI_SYSTEM_OLLAMA, HttpClient, ModelsClient, NANOS_PER_MS, NANOS_PER_SECOND, NOOP_LOGGER, OllamaAbortError, OllamaAgentMaxIterationsError, OllamaAuthError, OllamaClient, OllamaClientError, OllamaGenericClientError, OllamaMcpError, OllamaNetworkError, OllamaNotFoundError, OllamaRateLimitError, OllamaServerError, OllamaSkillInvalidError, OllamaSkillNotFoundError, OllamaStream, OllamaTimeoutError, OllamaToolTimeoutError, OllamaToolValidationError, OllamaUnsupportedCapabilityError, OpenAICompatClient, ToolRegistry, addSpanEvent, applySkill, calculateBackoff, checkEndpointHealth, composeMiddleware, createConsoleLogger, createTimeoutSignal, defineTool, detectModelCapabilities, extractUsage, inferRuntimeMode, listAvailableModels, loadMcpTools, mapError, normalizeChatStream, normalizeGenerateStream, normalizeProgressStream, parseFrontmatter, parseNdjsonStream, parseStructuredOutput, registerMcpTools, setSpanError, toDataStream, toResponse, toTextStream, withRetry, withSpan, zodToJsonSchema };
|
|
2008
|
+
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, DEFAULT_BACKOFF, DEFAULT_BASE_URL, DEFAULT_FAILOVER_CODES, DEFAULT_RETRY_CONFIG, DEFAULT_TIMEOUT_MS, EndpointRegistry, GEN_AI_SYSTEM_OLLAMA, HttpClient, ModelsClient, NANOS_PER_MS, NANOS_PER_SECOND, NOOP_LOGGER, OllamaAbortError, OllamaAgentMaxIterationsError, OllamaAuthError, OllamaClient, OllamaClientError, OllamaGenericClientError, OllamaMcpError, OllamaNetworkError, OllamaNotFoundError, OllamaRateLimitError, OllamaServerError, OllamaSkillInvalidError, OllamaSkillNotFoundError, OllamaStream, OllamaTimeoutError, OllamaToolTimeoutError, OllamaToolValidationError, OllamaUnsupportedCapabilityError, OpenAICompatClient, ToolRegistry, addSpanEvent, applySkill, calculateBackoff, checkEndpointHealth, composeMiddleware, createConsoleLogger, createTimeoutSignal, defineTool, detectModelCapabilities, encodeImage, extractUsage, inferRuntimeMode, listAvailableModels, loadMcpTools, mapError, normalizeChatStream, normalizeGenerateStream, normalizeProgressStream, parseFrontmatter, parseNdjsonStream, parseStructuredOutput, registerMcpTools, setSpanError, toDataStream, toResponse, toTextStream, withRetry, withSpan, zodToJsonSchema };
|
|
1968
2009
|
//# sourceMappingURL=index.js.map
|
|
1969
2010
|
//# sourceMappingURL=index.js.map
|