@nemesis-oss/ollama-sdk 1.1.0 → 1.3.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 +120 -0
- package/README.md +368 -3
- package/dist/{compose-DJjVpDrk.d.cts → compose-CDWq8oxJ.d.cts} +51 -2
- package/dist/{compose-DJjVpDrk.d.ts → compose-CDWq8oxJ.d.ts} +51 -2
- package/dist/index.cjs +455 -63
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +344 -6
- package/dist/index.d.ts +344 -6
- package/dist/index.js +450 -64
- package/dist/index.js.map +1 -1
- package/dist/skills.cjs.map +1 -1
- package/dist/skills.d.cts +2 -2
- package/dist/skills.d.ts +2 -2
- package/dist/skills.js.map +1 -1
- package/package.json +1 -1
|
@@ -61,6 +61,21 @@ interface ToolDefinition {
|
|
|
61
61
|
readonly function: ToolFunctionDefinition;
|
|
62
62
|
}
|
|
63
63
|
type FormatOption = 'json' | Record<string, unknown>;
|
|
64
|
+
/** One alternative token considered at a generated position, and its log probability. */
|
|
65
|
+
interface LogprobToken {
|
|
66
|
+
readonly token: string;
|
|
67
|
+
readonly logprob: number;
|
|
68
|
+
readonly bytes?: readonly number[] | undefined;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Log probability info for one generated token, returned when `logprobs: true` is set on
|
|
72
|
+
* a `/api/chat` or `/api/generate` request. `top_logprobs` holds the `top_logprobs` most
|
|
73
|
+
* likely alternative tokens considered at this position (see `top_logprobs` on
|
|
74
|
+
* {@link ChatRequestOptions}/{@link GenerateRequestOptions}).
|
|
75
|
+
*/
|
|
76
|
+
interface Logprob extends LogprobToken {
|
|
77
|
+
readonly top_logprobs?: readonly LogprobToken[] | undefined;
|
|
78
|
+
}
|
|
64
79
|
interface ModelOptions {
|
|
65
80
|
readonly num_keep?: number | undefined;
|
|
66
81
|
readonly seed?: number | undefined;
|
|
@@ -104,6 +119,10 @@ interface ChatRequestOptions extends RequestCancellationOptions {
|
|
|
104
119
|
readonly stream?: boolean | undefined;
|
|
105
120
|
readonly keep_alive?: string | number | undefined;
|
|
106
121
|
readonly think?: boolean | 'low' | 'medium' | 'high' | 'max' | undefined;
|
|
122
|
+
/** Whether to return log probabilities of the output tokens. See {@link ChatResponse.logprobs}. */
|
|
123
|
+
readonly logprobs?: boolean | undefined;
|
|
124
|
+
/** Number of most likely alternative tokens to return at each position. Requires `logprobs: true`. */
|
|
125
|
+
readonly top_logprobs?: number | undefined;
|
|
107
126
|
}
|
|
108
127
|
interface ChatResponse {
|
|
109
128
|
readonly model: string;
|
|
@@ -117,6 +136,8 @@ interface ChatResponse {
|
|
|
117
136
|
readonly prompt_eval_duration?: number | undefined;
|
|
118
137
|
readonly eval_count?: number | undefined;
|
|
119
138
|
readonly eval_duration?: number | undefined;
|
|
139
|
+
/** Present when the request set `logprobs: true`. */
|
|
140
|
+
readonly logprobs?: readonly Logprob[] | undefined;
|
|
120
141
|
}
|
|
121
142
|
interface GenerateRequestOptions extends RequestCancellationOptions {
|
|
122
143
|
readonly model: string;
|
|
@@ -137,6 +158,10 @@ interface GenerateRequestOptions extends RequestCancellationOptions {
|
|
|
137
158
|
readonly options?: ModelOptions | undefined;
|
|
138
159
|
readonly keep_alive?: string | number | undefined;
|
|
139
160
|
readonly think?: boolean | 'low' | 'medium' | 'high' | 'max' | undefined;
|
|
161
|
+
/** Whether to return log probabilities of the output tokens. See {@link GenerateResponse.logprobs}. */
|
|
162
|
+
readonly logprobs?: boolean | undefined;
|
|
163
|
+
/** Number of most likely alternative tokens to return at each position. Requires `logprobs: true`. */
|
|
164
|
+
readonly top_logprobs?: number | undefined;
|
|
140
165
|
}
|
|
141
166
|
interface GenerateResponse {
|
|
142
167
|
readonly model: string;
|
|
@@ -152,6 +177,8 @@ interface GenerateResponse {
|
|
|
152
177
|
readonly eval_count?: number | undefined;
|
|
153
178
|
readonly eval_duration?: number | undefined;
|
|
154
179
|
readonly thinking?: string | undefined;
|
|
180
|
+
/** Present when the request set `logprobs: true`. */
|
|
181
|
+
readonly logprobs?: readonly Logprob[] | undefined;
|
|
155
182
|
}
|
|
156
183
|
interface EmbedRequestOptions extends RequestCancellationOptions {
|
|
157
184
|
readonly model: string;
|
|
@@ -275,23 +302,45 @@ interface VersionResponse {
|
|
|
275
302
|
interface PsResponse {
|
|
276
303
|
readonly models: readonly ModelResponse[];
|
|
277
304
|
}
|
|
305
|
+
/**
|
|
306
|
+
* `webSearch`/`webFetch` call Ollama's hosted web tools at `https://ollama.com` — a
|
|
307
|
+
* fixed cloud service, unrelated to any locally-configured `baseUrl`/`endpoints` — and
|
|
308
|
+
* require an Ollama account API key (`apiKey`/`OLLAMA_API_KEY`). See
|
|
309
|
+
* {@link OllamaClient.webSearch}.
|
|
310
|
+
*/
|
|
278
311
|
interface WebSearchRequestOptions extends RequestCancellationOptions {
|
|
279
312
|
readonly query: string;
|
|
313
|
+
/** Max results to return (server default 5, max 10). */
|
|
314
|
+
readonly max_results?: number | undefined;
|
|
315
|
+
/**
|
|
316
|
+
* @deprecated Not a field the Ollama web search API recognizes (`max_results` is).
|
|
317
|
+
* Kept for backward compatibility with earlier (non-functional) versions of this
|
|
318
|
+
* method; mapped to `max_results` when `max_results` itself isn't set.
|
|
319
|
+
*/
|
|
280
320
|
readonly count?: number | undefined;
|
|
281
321
|
}
|
|
282
322
|
interface WebSearchResult {
|
|
283
323
|
readonly title: string;
|
|
284
324
|
readonly url: string;
|
|
285
|
-
readonly
|
|
325
|
+
readonly content: string;
|
|
326
|
+
/**
|
|
327
|
+
* @deprecated Not a field the Ollama web search API returns (`content` is) — kept, and
|
|
328
|
+
* populated by the SDK as a mirror of `content`, for backward compatibility with
|
|
329
|
+
* earlier (non-functional, wrong-endpoint) versions of `webSearch`. Use `content`.
|
|
330
|
+
*/
|
|
331
|
+
readonly snippet?: string | undefined;
|
|
286
332
|
}
|
|
287
333
|
interface WebSearchResponse {
|
|
288
334
|
readonly results: readonly WebSearchResult[];
|
|
289
335
|
}
|
|
336
|
+
/** See {@link WebSearchRequestOptions} — same fixed Ollama Cloud endpoint and auth. */
|
|
290
337
|
interface WebFetchRequestOptions extends RequestCancellationOptions {
|
|
291
338
|
readonly url: string;
|
|
292
339
|
}
|
|
293
340
|
interface WebFetchResponse {
|
|
341
|
+
readonly title?: string | undefined;
|
|
294
342
|
readonly content: string;
|
|
343
|
+
readonly links?: readonly string[] | undefined;
|
|
295
344
|
}
|
|
296
345
|
|
|
297
346
|
/**
|
|
@@ -454,4 +503,4 @@ interface AppliedSkillResult {
|
|
|
454
503
|
*/
|
|
455
504
|
declare function applySkill(skill: Skill, options: ApplySkillOptions): AppliedSkillResult;
|
|
456
505
|
|
|
457
|
-
export {
|
|
506
|
+
export { type WebSearchResult as $, type AnyTool as A, type ModelDetails as B, type ChatResponse as C, type DeleteRequestOptions as D, type EmbedRequestOptions as E, type FormatOption as F, type GenerateResponse as G, type ParsedFrontmatter as H, type Role as I, type Skill as J, type SkillFrontmatter as K, type ListResponse as L, type Message as M, type SkillSummary as N, type ToolCallFunction as O, type ProgressResponse as P, type ToolExecutionContext as Q, type RequestCancellationOptions as R, type ShowRequestOptions as S, type ToolCall as T, type ToolExecutionFailure as U, type VersionResponse as V, type WebSearchRequestOptions as W, type ToolExecutionSuccess as X, type ToolFunctionDefinition as Y, type ToolProperty as Z, type ToolRegistryOptions as _, type ModelResponse as a, applySkill as a0, parseFrontmatter as a1, type ShowResponse as b, type PullRequestOptions as c, type PushRequestOptions as d, type CreateRequestOptions as e, type StatusResponse as f, type CopyRequestOptions as g, type PsResponse as h, type ChatRequestOptions as i, type GenerateRequestOptions as j, type EmbedResponse as k, type EmbeddingsRequestOptions as l, type EmbeddingsResponse as m, type WebSearchResponse as n, type WebFetchRequestOptions as o, type WebFetchResponse as p, type ToolHandler as q, type Tool as r, ToolRegistry as s, type ToolExecutionResult as t, type ModelOptions as u, type ToolDefinition as v, type AppliedSkillResult as w, type ApplySkillOptions as x, type Logprob as y, type LogprobToken as z };
|
|
@@ -61,6 +61,21 @@ interface ToolDefinition {
|
|
|
61
61
|
readonly function: ToolFunctionDefinition;
|
|
62
62
|
}
|
|
63
63
|
type FormatOption = 'json' | Record<string, unknown>;
|
|
64
|
+
/** One alternative token considered at a generated position, and its log probability. */
|
|
65
|
+
interface LogprobToken {
|
|
66
|
+
readonly token: string;
|
|
67
|
+
readonly logprob: number;
|
|
68
|
+
readonly bytes?: readonly number[] | undefined;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Log probability info for one generated token, returned when `logprobs: true` is set on
|
|
72
|
+
* a `/api/chat` or `/api/generate` request. `top_logprobs` holds the `top_logprobs` most
|
|
73
|
+
* likely alternative tokens considered at this position (see `top_logprobs` on
|
|
74
|
+
* {@link ChatRequestOptions}/{@link GenerateRequestOptions}).
|
|
75
|
+
*/
|
|
76
|
+
interface Logprob extends LogprobToken {
|
|
77
|
+
readonly top_logprobs?: readonly LogprobToken[] | undefined;
|
|
78
|
+
}
|
|
64
79
|
interface ModelOptions {
|
|
65
80
|
readonly num_keep?: number | undefined;
|
|
66
81
|
readonly seed?: number | undefined;
|
|
@@ -104,6 +119,10 @@ interface ChatRequestOptions extends RequestCancellationOptions {
|
|
|
104
119
|
readonly stream?: boolean | undefined;
|
|
105
120
|
readonly keep_alive?: string | number | undefined;
|
|
106
121
|
readonly think?: boolean | 'low' | 'medium' | 'high' | 'max' | undefined;
|
|
122
|
+
/** Whether to return log probabilities of the output tokens. See {@link ChatResponse.logprobs}. */
|
|
123
|
+
readonly logprobs?: boolean | undefined;
|
|
124
|
+
/** Number of most likely alternative tokens to return at each position. Requires `logprobs: true`. */
|
|
125
|
+
readonly top_logprobs?: number | undefined;
|
|
107
126
|
}
|
|
108
127
|
interface ChatResponse {
|
|
109
128
|
readonly model: string;
|
|
@@ -117,6 +136,8 @@ interface ChatResponse {
|
|
|
117
136
|
readonly prompt_eval_duration?: number | undefined;
|
|
118
137
|
readonly eval_count?: number | undefined;
|
|
119
138
|
readonly eval_duration?: number | undefined;
|
|
139
|
+
/** Present when the request set `logprobs: true`. */
|
|
140
|
+
readonly logprobs?: readonly Logprob[] | undefined;
|
|
120
141
|
}
|
|
121
142
|
interface GenerateRequestOptions extends RequestCancellationOptions {
|
|
122
143
|
readonly model: string;
|
|
@@ -137,6 +158,10 @@ interface GenerateRequestOptions extends RequestCancellationOptions {
|
|
|
137
158
|
readonly options?: ModelOptions | undefined;
|
|
138
159
|
readonly keep_alive?: string | number | undefined;
|
|
139
160
|
readonly think?: boolean | 'low' | 'medium' | 'high' | 'max' | undefined;
|
|
161
|
+
/** Whether to return log probabilities of the output tokens. See {@link GenerateResponse.logprobs}. */
|
|
162
|
+
readonly logprobs?: boolean | undefined;
|
|
163
|
+
/** Number of most likely alternative tokens to return at each position. Requires `logprobs: true`. */
|
|
164
|
+
readonly top_logprobs?: number | undefined;
|
|
140
165
|
}
|
|
141
166
|
interface GenerateResponse {
|
|
142
167
|
readonly model: string;
|
|
@@ -152,6 +177,8 @@ interface GenerateResponse {
|
|
|
152
177
|
readonly eval_count?: number | undefined;
|
|
153
178
|
readonly eval_duration?: number | undefined;
|
|
154
179
|
readonly thinking?: string | undefined;
|
|
180
|
+
/** Present when the request set `logprobs: true`. */
|
|
181
|
+
readonly logprobs?: readonly Logprob[] | undefined;
|
|
155
182
|
}
|
|
156
183
|
interface EmbedRequestOptions extends RequestCancellationOptions {
|
|
157
184
|
readonly model: string;
|
|
@@ -275,23 +302,45 @@ interface VersionResponse {
|
|
|
275
302
|
interface PsResponse {
|
|
276
303
|
readonly models: readonly ModelResponse[];
|
|
277
304
|
}
|
|
305
|
+
/**
|
|
306
|
+
* `webSearch`/`webFetch` call Ollama's hosted web tools at `https://ollama.com` — a
|
|
307
|
+
* fixed cloud service, unrelated to any locally-configured `baseUrl`/`endpoints` — and
|
|
308
|
+
* require an Ollama account API key (`apiKey`/`OLLAMA_API_KEY`). See
|
|
309
|
+
* {@link OllamaClient.webSearch}.
|
|
310
|
+
*/
|
|
278
311
|
interface WebSearchRequestOptions extends RequestCancellationOptions {
|
|
279
312
|
readonly query: string;
|
|
313
|
+
/** Max results to return (server default 5, max 10). */
|
|
314
|
+
readonly max_results?: number | undefined;
|
|
315
|
+
/**
|
|
316
|
+
* @deprecated Not a field the Ollama web search API recognizes (`max_results` is).
|
|
317
|
+
* Kept for backward compatibility with earlier (non-functional) versions of this
|
|
318
|
+
* method; mapped to `max_results` when `max_results` itself isn't set.
|
|
319
|
+
*/
|
|
280
320
|
readonly count?: number | undefined;
|
|
281
321
|
}
|
|
282
322
|
interface WebSearchResult {
|
|
283
323
|
readonly title: string;
|
|
284
324
|
readonly url: string;
|
|
285
|
-
readonly
|
|
325
|
+
readonly content: string;
|
|
326
|
+
/**
|
|
327
|
+
* @deprecated Not a field the Ollama web search API returns (`content` is) — kept, and
|
|
328
|
+
* populated by the SDK as a mirror of `content`, for backward compatibility with
|
|
329
|
+
* earlier (non-functional, wrong-endpoint) versions of `webSearch`. Use `content`.
|
|
330
|
+
*/
|
|
331
|
+
readonly snippet?: string | undefined;
|
|
286
332
|
}
|
|
287
333
|
interface WebSearchResponse {
|
|
288
334
|
readonly results: readonly WebSearchResult[];
|
|
289
335
|
}
|
|
336
|
+
/** See {@link WebSearchRequestOptions} — same fixed Ollama Cloud endpoint and auth. */
|
|
290
337
|
interface WebFetchRequestOptions extends RequestCancellationOptions {
|
|
291
338
|
readonly url: string;
|
|
292
339
|
}
|
|
293
340
|
interface WebFetchResponse {
|
|
341
|
+
readonly title?: string | undefined;
|
|
294
342
|
readonly content: string;
|
|
343
|
+
readonly links?: readonly string[] | undefined;
|
|
295
344
|
}
|
|
296
345
|
|
|
297
346
|
/**
|
|
@@ -454,4 +503,4 @@ interface AppliedSkillResult {
|
|
|
454
503
|
*/
|
|
455
504
|
declare function applySkill(skill: Skill, options: ApplySkillOptions): AppliedSkillResult;
|
|
456
505
|
|
|
457
|
-
export {
|
|
506
|
+
export { type WebSearchResult as $, type AnyTool as A, type ModelDetails as B, type ChatResponse as C, type DeleteRequestOptions as D, type EmbedRequestOptions as E, type FormatOption as F, type GenerateResponse as G, type ParsedFrontmatter as H, type Role as I, type Skill as J, type SkillFrontmatter as K, type ListResponse as L, type Message as M, type SkillSummary as N, type ToolCallFunction as O, type ProgressResponse as P, type ToolExecutionContext as Q, type RequestCancellationOptions as R, type ShowRequestOptions as S, type ToolCall as T, type ToolExecutionFailure as U, type VersionResponse as V, type WebSearchRequestOptions as W, type ToolExecutionSuccess as X, type ToolFunctionDefinition as Y, type ToolProperty as Z, type ToolRegistryOptions as _, type ModelResponse as a, applySkill as a0, parseFrontmatter as a1, type ShowResponse as b, type PullRequestOptions as c, type PushRequestOptions as d, type CreateRequestOptions as e, type StatusResponse as f, type CopyRequestOptions as g, type PsResponse as h, type ChatRequestOptions as i, type GenerateRequestOptions as j, type EmbedResponse as k, type EmbeddingsRequestOptions as l, type EmbeddingsResponse as m, type WebSearchResponse as n, type WebFetchRequestOptions as o, type WebFetchResponse as p, type ToolHandler as q, type Tool as r, ToolRegistry as s, type ToolExecutionResult as t, type ModelOptions as u, type ToolDefinition as v, type AppliedSkillResult as w, type ApplySkillOptions as x, type Logprob as y, type LogprobToken as z };
|