ollama-ai-provider-v2 1.5.5 → 1.6.0-beta.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/README.md CHANGED
@@ -82,11 +82,19 @@ const { text, toolCalls } = await generateText({
82
82
  Unique feature for models that support chain-of-thought reasoning:
83
83
 
84
84
  ```typescript
85
+ // For most models - simple boolean
85
86
  const { text } = await generateText({
86
87
  model: ollama('deepseek-r1:7b'),
87
88
  providerOptions: { ollama: { think: true } },
88
89
  prompt: 'Solve this complex math problem step by step: 2x + 5 = 17',
89
90
  });
91
+
92
+ // For GPT-OSS models - use thinking levels for trace length control
93
+ const { text } = await generateText({
94
+ model: ollama('gpt-oss:7b'),
95
+ providerOptions: { ollama: { think: 'high' } }, // 'low', 'medium', or 'high'
96
+ prompt: 'Analyze this complex scenario in detail',
97
+ });
90
98
  ```
91
99
 
92
100
  ### Advanced Ollama Options
@@ -174,7 +182,7 @@ Works with any model in your Ollama installation, including:
174
182
 
175
183
  - **Chat Models**: `llama3.2`, `mistral`, `phi4-mini`, `qwen2.5`, `codellama`, `gemma3`
176
184
  - **Vision Models**: `llava`, `llama3.2-vision`, `minicpm-v`
177
- - **Reasoning Models**: `deepseek-r1:7b`, `deepseek-r1:1.5b`, `deepseek-r1:8b`
185
+ - **Reasoning Models**: `deepseek-r1:7b`, `deepseek-r1:1.5b`, `deepseek-r1:8b`, `gpt-oss:7b`
178
186
  - **Code Models**: `codellama:code`, `codellama:python`, `deepseek-coder-v2`
179
187
  - **Embedding Models**: `nomic-embed-text`, `all-minilm`, `mxbai-embed-large`
180
188
 
package/dist/index.d.mts CHANGED
@@ -4,7 +4,11 @@ import { z } from 'zod/v4';
4
4
 
5
5
  type OllamaChatModelId = "athene-v2" | "athene-v2:72b" | "aya-expanse" | "aya-expanse:8b" | "aya-expanse:32b" | "codegemma" | "codegemma:2b" | "codegemma:7b" | "codellama" | "codellama:7b" | "codellama:13b" | "codellama:34b" | "codellama:70b" | "codellama:code" | "codellama:python" | "command-r" | "command-r:35b" | "command-r-plus" | "command-r-plus:104b" | "command-r7b" | "command-r7b:7b" | "deepseek-r1" | "deepseek-r1:1.5b" | "deepseek-r1:7b" | "deepseek-r1:8b" | "deepseek-r1:14b" | "deepseek-r1:32b" | "deepseek-r1:70b" | "deepseek-r1:671b" | "deepseek-coder-v2" | "deepseek-coder-v2:16b" | "deepseek-coder-v2:236b" | "deepseek-v3" | "deepseek-v3:671b" | "devstral" | "devstral:24b" | "dolphin3" | "dolphin3:8b" | "exaone3.5" | "exaone3.5:2.4b" | "exaone3.5:7.8b" | "exaone3.5:32b" | "falcon2" | "falcon2:11b" | "falcon3" | "falcon3:1b" | "falcon3:3b" | "falcon3:7b" | "falcon3:10b" | "firefunction-v2" | "firefunction-v2:70b" | "gemma" | "gemma:2b" | "gemma:7b" | "gemma2" | "gemma2:2b" | "gemma2:9b" | "gemma2:27b" | "gemma3" | "gemma3:1b" | "gemma3:4b" | "gemma3:12b" | "gemma3:27b" | "granite3-dense" | "granite3-dense:2b" | "granite3-dense:8b" | "granite3-guardian" | "granite3-guardian:2b" | "granite3-guardian:8b" | "granite3-moe" | "granite3-moe:1b" | "granite3-moe:3b" | "granite3.1-dense" | "granite3.1-dense:2b" | "granite3.1-dense:8b" | "granite3.1-moe" | "granite3.1-moe:1b" | "granite3.1-moe:3b" | "llama2" | "llama2:7b" | "llama2:13b" | "llama2:70b" | "llama3" | "llama3:8b" | "llama3:70b" | "llama3-chatqa" | "llama3-chatqa:8b" | "llama3-chatqa:70b" | "llama3-gradient" | "llama3-gradient:8b" | "llama3-gradient:70b" | "llama3.1" | "llama3.1:8b" | "llama3.1:70b" | "llama3.1:405b" | "llama3.2" | "llama3.2:1b" | "llama3.2:3b" | "llama3.2-vision" | "llama3.2-vision:11b" | "llama3.2-vision:90b" | "llama3.3" | "llama3.3:70b" | "llama4" | "llama4:16x17b" | "llama4:128x17b" | "llama-guard3" | "llama-guard3:1b" | "llama-guard3:8b" | "llava" | "llava:7b" | "llava:13b" | "llava:34b" | "llava-llama3" | "llava-llama3:8b" | "llava-phi3" | "llava-phi3:3.8b" | "marco-o1" | "marco-o1:7b" | "mistral" | "mistral:7b" | "mistral-large" | "mistral-large:123b" | "mistral-nemo" | "mistral-nemo:12b" | "mistral-small" | "mistral-small:22b" | "mixtral" | "mixtral:8x7b" | "mixtral:8x22b" | "moondream" | "moondream:1.8b" | "openhermes" | "openhermes:v2.5" | "nemotron" | "nemotron:70b" | "nemotron-mini" | "nemotron-mini:4b" | "olmo" | "olmo:7b" | "olmo:13b" | "opencoder" | "opencoder:1.5b" | "opencoder:8b" | "phi3" | "phi3:3.8b" | "phi3:14b" | "phi3.5" | "phi3.5:3.8b" | "phi4" | "phi4:14b" | "qwen" | "qwen:7b" | "qwen:14b" | "qwen:32b" | "qwen:72b" | "qwen:110b" | "qwen2" | "qwen2:0.5b" | "qwen2:1.5b" | "qwen2:7b" | "qwen2:72b" | "qwen2.5" | "qwen2.5:0.5b" | "qwen2.5:1.5b" | "qwen2.5:3b" | "qwen2.5:7b" | "qwen2.5:14b" | "qwen2.5:32b" | "qwen2.5:72b" | "qwen2.5-coder" | "qwen2.5-coder:0.5b" | "qwen2.5-coder:1.5b" | "qwen2.5-coder:3b" | "qwen2.5-coder:7b" | "qwen2.5-coder:14b" | "qwen2.5-coder:32b" | "qwen3" | "qwen3:0.6b" | "qwen3:1.7b" | "qwen3:4b" | "qwen3:8b" | "qwen3:14b" | "qwen3:30b" | "qwen3:32b" | "qwen3:235b" | "qwq" | "qwq:32b" | "sailor2" | "sailor2:1b" | "sailor2:8b" | "sailor2:20b" | "shieldgemma" | "shieldgemma:2b" | "shieldgemma:9b" | "shieldgemma:27b" | "smallthinker" | "smallthinker:3b" | "smollm" | "smollm:135m" | "smollm:360m" | "smollm:1.7b" | "tinyllama" | "tinyllama:1.1b" | "tulu3" | "tulu3:8b" | "tulu3:70b" | (string & {});
6
6
  declare const ollamaProviderOptions: z.ZodObject<{
7
- think: z.ZodOptional<z.ZodBoolean>;
7
+ think: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodEnum<{
8
+ low: "low";
9
+ medium: "medium";
10
+ high: "high";
11
+ }>]>>;
8
12
  options: z.ZodOptional<z.ZodObject<{
9
13
  num_ctx: z.ZodOptional<z.ZodNumber>;
10
14
  repeat_last_n: z.ZodOptional<z.ZodNumber>;
@@ -27,9 +31,12 @@ interface OllamaCompletionSettings {
27
31
  * the model's thinking from the model's output. When disabled, the model will not think
28
32
  * and directly output the content.
29
33
  *
30
- * Only supported by certain models like DeepSeek R1 and Qwen 3.
34
+ * For GPT-OSS models: accepts "low", "medium", or "high" to tune trace length.
35
+ * For other models: accepts boolean true/false.
36
+ *
37
+ * Only supported by certain models like DeepSeek R1, Qwen 3, and GPT-OSS.
31
38
  */
32
- think?: boolean;
39
+ think?: boolean | "low" | "medium" | "high";
33
40
  /**
34
41
  * Echo back the prompt in addition to the completion.
35
42
  */
@@ -146,7 +153,11 @@ declare const ollamaEmbeddingProviderOptions: z.ZodObject<{
146
153
  type OllamaEmbeddingProviderOptions = z.infer<typeof ollamaEmbeddingProviderOptions>;
147
154
 
148
155
  declare const ollamaCompletionProviderOptions: z.ZodObject<{
149
- think: z.ZodOptional<z.ZodBoolean>;
156
+ think: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodEnum<{
157
+ low: "low";
158
+ medium: "medium";
159
+ high: "high";
160
+ }>]>>;
150
161
  user: z.ZodOptional<z.ZodString>;
151
162
  suffix: z.ZodOptional<z.ZodString>;
152
163
  echo: z.ZodOptional<z.ZodBoolean>;
package/dist/index.d.ts CHANGED
@@ -4,7 +4,11 @@ import { z } from 'zod/v4';
4
4
 
5
5
  type OllamaChatModelId = "athene-v2" | "athene-v2:72b" | "aya-expanse" | "aya-expanse:8b" | "aya-expanse:32b" | "codegemma" | "codegemma:2b" | "codegemma:7b" | "codellama" | "codellama:7b" | "codellama:13b" | "codellama:34b" | "codellama:70b" | "codellama:code" | "codellama:python" | "command-r" | "command-r:35b" | "command-r-plus" | "command-r-plus:104b" | "command-r7b" | "command-r7b:7b" | "deepseek-r1" | "deepseek-r1:1.5b" | "deepseek-r1:7b" | "deepseek-r1:8b" | "deepseek-r1:14b" | "deepseek-r1:32b" | "deepseek-r1:70b" | "deepseek-r1:671b" | "deepseek-coder-v2" | "deepseek-coder-v2:16b" | "deepseek-coder-v2:236b" | "deepseek-v3" | "deepseek-v3:671b" | "devstral" | "devstral:24b" | "dolphin3" | "dolphin3:8b" | "exaone3.5" | "exaone3.5:2.4b" | "exaone3.5:7.8b" | "exaone3.5:32b" | "falcon2" | "falcon2:11b" | "falcon3" | "falcon3:1b" | "falcon3:3b" | "falcon3:7b" | "falcon3:10b" | "firefunction-v2" | "firefunction-v2:70b" | "gemma" | "gemma:2b" | "gemma:7b" | "gemma2" | "gemma2:2b" | "gemma2:9b" | "gemma2:27b" | "gemma3" | "gemma3:1b" | "gemma3:4b" | "gemma3:12b" | "gemma3:27b" | "granite3-dense" | "granite3-dense:2b" | "granite3-dense:8b" | "granite3-guardian" | "granite3-guardian:2b" | "granite3-guardian:8b" | "granite3-moe" | "granite3-moe:1b" | "granite3-moe:3b" | "granite3.1-dense" | "granite3.1-dense:2b" | "granite3.1-dense:8b" | "granite3.1-moe" | "granite3.1-moe:1b" | "granite3.1-moe:3b" | "llama2" | "llama2:7b" | "llama2:13b" | "llama2:70b" | "llama3" | "llama3:8b" | "llama3:70b" | "llama3-chatqa" | "llama3-chatqa:8b" | "llama3-chatqa:70b" | "llama3-gradient" | "llama3-gradient:8b" | "llama3-gradient:70b" | "llama3.1" | "llama3.1:8b" | "llama3.1:70b" | "llama3.1:405b" | "llama3.2" | "llama3.2:1b" | "llama3.2:3b" | "llama3.2-vision" | "llama3.2-vision:11b" | "llama3.2-vision:90b" | "llama3.3" | "llama3.3:70b" | "llama4" | "llama4:16x17b" | "llama4:128x17b" | "llama-guard3" | "llama-guard3:1b" | "llama-guard3:8b" | "llava" | "llava:7b" | "llava:13b" | "llava:34b" | "llava-llama3" | "llava-llama3:8b" | "llava-phi3" | "llava-phi3:3.8b" | "marco-o1" | "marco-o1:7b" | "mistral" | "mistral:7b" | "mistral-large" | "mistral-large:123b" | "mistral-nemo" | "mistral-nemo:12b" | "mistral-small" | "mistral-small:22b" | "mixtral" | "mixtral:8x7b" | "mixtral:8x22b" | "moondream" | "moondream:1.8b" | "openhermes" | "openhermes:v2.5" | "nemotron" | "nemotron:70b" | "nemotron-mini" | "nemotron-mini:4b" | "olmo" | "olmo:7b" | "olmo:13b" | "opencoder" | "opencoder:1.5b" | "opencoder:8b" | "phi3" | "phi3:3.8b" | "phi3:14b" | "phi3.5" | "phi3.5:3.8b" | "phi4" | "phi4:14b" | "qwen" | "qwen:7b" | "qwen:14b" | "qwen:32b" | "qwen:72b" | "qwen:110b" | "qwen2" | "qwen2:0.5b" | "qwen2:1.5b" | "qwen2:7b" | "qwen2:72b" | "qwen2.5" | "qwen2.5:0.5b" | "qwen2.5:1.5b" | "qwen2.5:3b" | "qwen2.5:7b" | "qwen2.5:14b" | "qwen2.5:32b" | "qwen2.5:72b" | "qwen2.5-coder" | "qwen2.5-coder:0.5b" | "qwen2.5-coder:1.5b" | "qwen2.5-coder:3b" | "qwen2.5-coder:7b" | "qwen2.5-coder:14b" | "qwen2.5-coder:32b" | "qwen3" | "qwen3:0.6b" | "qwen3:1.7b" | "qwen3:4b" | "qwen3:8b" | "qwen3:14b" | "qwen3:30b" | "qwen3:32b" | "qwen3:235b" | "qwq" | "qwq:32b" | "sailor2" | "sailor2:1b" | "sailor2:8b" | "sailor2:20b" | "shieldgemma" | "shieldgemma:2b" | "shieldgemma:9b" | "shieldgemma:27b" | "smallthinker" | "smallthinker:3b" | "smollm" | "smollm:135m" | "smollm:360m" | "smollm:1.7b" | "tinyllama" | "tinyllama:1.1b" | "tulu3" | "tulu3:8b" | "tulu3:70b" | (string & {});
6
6
  declare const ollamaProviderOptions: z.ZodObject<{
7
- think: z.ZodOptional<z.ZodBoolean>;
7
+ think: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodEnum<{
8
+ low: "low";
9
+ medium: "medium";
10
+ high: "high";
11
+ }>]>>;
8
12
  options: z.ZodOptional<z.ZodObject<{
9
13
  num_ctx: z.ZodOptional<z.ZodNumber>;
10
14
  repeat_last_n: z.ZodOptional<z.ZodNumber>;
@@ -27,9 +31,12 @@ interface OllamaCompletionSettings {
27
31
  * the model's thinking from the model's output. When disabled, the model will not think
28
32
  * and directly output the content.
29
33
  *
30
- * Only supported by certain models like DeepSeek R1 and Qwen 3.
34
+ * For GPT-OSS models: accepts "low", "medium", or "high" to tune trace length.
35
+ * For other models: accepts boolean true/false.
36
+ *
37
+ * Only supported by certain models like DeepSeek R1, Qwen 3, and GPT-OSS.
31
38
  */
32
- think?: boolean;
39
+ think?: boolean | "low" | "medium" | "high";
33
40
  /**
34
41
  * Echo back the prompt in addition to the completion.
35
42
  */
@@ -146,7 +153,11 @@ declare const ollamaEmbeddingProviderOptions: z.ZodObject<{
146
153
  type OllamaEmbeddingProviderOptions = z.infer<typeof ollamaEmbeddingProviderOptions>;
147
154
 
148
155
  declare const ollamaCompletionProviderOptions: z.ZodObject<{
149
- think: z.ZodOptional<z.ZodBoolean>;
156
+ think: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodEnum<{
157
+ low: "low";
158
+ medium: "medium";
159
+ high: "high";
160
+ }>]>>;
150
161
  user: z.ZodOptional<z.ZodString>;
151
162
  suffix: z.ZodOptional<z.ZodString>;
152
163
  echo: z.ZodOptional<z.ZodBoolean>;
package/dist/index.js CHANGED
@@ -31,7 +31,7 @@ var import_provider_utils8 = require("@ai-sdk/provider-utils");
31
31
 
32
32
  // src/completion/ollama-completion-language-model.ts
33
33
  var import_provider_utils2 = require("@ai-sdk/provider-utils");
34
- var import_v42 = require("zod/v4");
34
+ var import_v43 = require("zod/v4");
35
35
 
36
36
  // src/completion/ollama-error.ts
37
37
  var import_v4 = require("zod/v4");
@@ -156,12 +156,63 @@ function getResponseMetadata({
156
156
  };
157
157
  }
158
158
 
159
+ // src/ollama-chat-settings.ts
160
+ var import_v42 = require("zod/v4");
161
+ var ollamaProviderOptions = import_v42.z.object({
162
+ /**
163
+ * Enable or disable the model's thinking process. When enabled, the output will separate
164
+ * the model's thinking from the model's output. When disabled, the model will not think
165
+ * and directly output the content.
166
+ *
167
+ * For GPT-OSS models: accepts "low", "medium", or "high" to tune trace length.
168
+ * For other models: accepts boolean true/false.
169
+ *
170
+ * Only supported by certain models like DeepSeek R1, Qwen 3, and GPT-OSS.
171
+ */
172
+ think: import_v42.z.union([
173
+ import_v42.z.boolean(),
174
+ import_v42.z.enum(["low", "medium", "high"])
175
+ ]).optional(),
176
+ options: import_v42.z.object({
177
+ num_ctx: import_v42.z.number().optional(),
178
+ repeat_last_n: import_v42.z.number().optional(),
179
+ repeat_penalty: import_v42.z.number().optional(),
180
+ temperature: import_v42.z.number().optional(),
181
+ seed: import_v42.z.number().optional(),
182
+ stop: import_v42.z.array(import_v42.z.string()).optional(),
183
+ num_predict: import_v42.z.number().optional(),
184
+ top_k: import_v42.z.number().optional(),
185
+ top_p: import_v42.z.number().optional(),
186
+ min_p: import_v42.z.number().optional()
187
+ }).optional()
188
+ });
189
+ function validateThinkParameter(modelId, think) {
190
+ if (think === void 0) {
191
+ return void 0;
192
+ }
193
+ const isGptOss = modelId.toLowerCase().includes("gpt-oss");
194
+ if (isGptOss) {
195
+ if (typeof think === "boolean") {
196
+ return think ? "medium" : void 0;
197
+ }
198
+ return think;
199
+ } else {
200
+ if (typeof think === "string") {
201
+ return think !== void 0;
202
+ }
203
+ return think;
204
+ }
205
+ }
206
+
159
207
  // src/completion/ollama-completion-language-model.ts
160
- var ollamaCompletionProviderOptions = import_v42.z.object({
161
- think: import_v42.z.boolean().optional(),
162
- user: import_v42.z.string().optional(),
163
- suffix: import_v42.z.string().optional(),
164
- echo: import_v42.z.boolean().optional()
208
+ var ollamaCompletionProviderOptions = import_v43.z.object({
209
+ think: import_v43.z.union([
210
+ import_v43.z.boolean(),
211
+ import_v43.z.enum(["low", "medium", "high"])
212
+ ]).optional(),
213
+ user: import_v43.z.string().optional(),
214
+ suffix: import_v43.z.string().optional(),
215
+ echo: import_v43.z.boolean().optional()
165
216
  });
166
217
  var OllamaCompletionLanguageModel = class {
167
218
  constructor(modelId, settings, config) {
@@ -219,13 +270,14 @@ var OllamaCompletionLanguageModel = class {
219
270
  }
220
271
  const { prompt: completionPrompt, stopSequences } = convertToOllamaCompletionPrompt({ prompt });
221
272
  const stop = [...stopSequences != null ? stopSequences : [], ...userStopSequences != null ? userStopSequences : []];
273
+ const validatedThink = validateThinkParameter(this.modelId, ollamaOptions.think);
222
274
  return {
223
275
  args: {
224
276
  // model id:
225
277
  model: this.modelId,
226
278
  // Ollama-supported settings:
227
279
  user: ollamaOptions.user,
228
- think: ollamaOptions.think,
280
+ think: validatedThink,
229
281
  // standardized settings:
230
282
  max_tokens: maxOutputTokens,
231
283
  temperature,
@@ -365,28 +417,28 @@ var OllamaCompletionLanguageModel = class {
365
417
  };
366
418
  }
367
419
  };
368
- var baseOllamaResponseSchema = import_v42.z.object({
369
- model: import_v42.z.string(),
370
- created_at: import_v42.z.string(),
371
- response: import_v42.z.string(),
372
- done: import_v42.z.boolean(),
373
- context: import_v42.z.array(import_v42.z.number()),
374
- eval_count: import_v42.z.number().optional(),
375
- eval_duration: import_v42.z.number().optional(),
376
- load_duration: import_v42.z.number().optional(),
377
- total_duration: import_v42.z.number().optional(),
378
- prompt_eval_count: import_v42.z.number().optional(),
379
- prompt_eval_duration: import_v42.z.number().optional()
420
+ var baseOllamaResponseSchema = import_v43.z.object({
421
+ model: import_v43.z.string(),
422
+ created_at: import_v43.z.string(),
423
+ response: import_v43.z.string(),
424
+ done: import_v43.z.boolean(),
425
+ context: import_v43.z.array(import_v43.z.number()),
426
+ eval_count: import_v43.z.number().optional(),
427
+ eval_duration: import_v43.z.number().optional(),
428
+ load_duration: import_v43.z.number().optional(),
429
+ total_duration: import_v43.z.number().optional(),
430
+ prompt_eval_count: import_v43.z.number().optional(),
431
+ prompt_eval_duration: import_v43.z.number().optional()
380
432
  });
381
433
 
382
434
  // src/embedding/ollama-embedding-model.ts
383
435
  var import_provider2 = require("@ai-sdk/provider");
384
436
  var import_provider_utils3 = require("@ai-sdk/provider-utils");
385
- var import_v43 = require("zod/v4");
386
- var ollamaEmbeddingProviderOptions = import_v43.z.object({
387
- dimensions: import_v43.z.number().optional(),
388
- truncate: import_v43.z.boolean().optional(),
389
- keepAlive: import_v43.z.string().optional()
437
+ var import_v44 = require("zod/v4");
438
+ var ollamaEmbeddingProviderOptions = import_v44.z.object({
439
+ dimensions: import_v44.z.number().optional(),
440
+ truncate: import_v44.z.boolean().optional(),
441
+ keepAlive: import_v44.z.string().optional()
390
442
  });
391
443
  var OllamaEmbeddingModel = class {
392
444
  constructor(modelId, settings, config) {
@@ -468,12 +520,12 @@ var OllamaEmbeddingModel = class {
468
520
  };
469
521
  }
470
522
  };
471
- var ollamaTextEmbeddingResponseSchema = import_v43.z.object({
472
- model: import_v43.z.string(),
473
- embeddings: import_v43.z.array(import_v43.z.array(import_v43.z.number())),
474
- total_duration: import_v43.z.number(),
475
- load_duration: import_v43.z.number(),
476
- prompt_eval_count: import_v43.z.number()
523
+ var ollamaTextEmbeddingResponseSchema = import_v44.z.object({
524
+ model: import_v44.z.string(),
525
+ embeddings: import_v44.z.array(import_v44.z.array(import_v44.z.number())),
526
+ total_duration: import_v44.z.number(),
527
+ load_duration: import_v44.z.number(),
528
+ prompt_eval_count: import_v44.z.number()
477
529
  });
478
530
 
479
531
  // src/responses/ollama-responses-language-model.ts
@@ -805,31 +857,6 @@ function prepareResponsesTools({
805
857
  }
806
858
  }
807
859
 
808
- // src/ollama-chat-settings.ts
809
- var import_v44 = require("zod/v4");
810
- var ollamaProviderOptions = import_v44.z.object({
811
- /**
812
- * Enable or disable the model's thinking process. When enabled, the output will separate
813
- * the model's thinking from the model's output. When disabled, the model will not think
814
- * and directly output the content.
815
- *
816
- * Only supported by certain models like DeepSeek R1 and Qwen 3.
817
- */
818
- think: import_v44.z.boolean().optional(),
819
- options: import_v44.z.object({
820
- num_ctx: import_v44.z.number().optional(),
821
- repeat_last_n: import_v44.z.number().optional(),
822
- repeat_penalty: import_v44.z.number().optional(),
823
- temperature: import_v44.z.number().optional(),
824
- seed: import_v44.z.number().optional(),
825
- stop: import_v44.z.array(import_v44.z.string()).optional(),
826
- num_predict: import_v44.z.number().optional(),
827
- top_k: import_v44.z.number().optional(),
828
- top_p: import_v44.z.number().optional(),
829
- min_p: import_v44.z.number().optional()
830
- }).optional()
831
- });
832
-
833
860
  // src/responses/ollama-responses-request-builder.ts
834
861
  var OllamaRequestBuilder = class {
835
862
  async buildRequest({
@@ -922,7 +949,8 @@ var OllamaRequestBuilder = class {
922
949
  responseFormat,
923
950
  ollamaOptions
924
951
  }) {
925
- var _a, _b;
952
+ var _a;
953
+ const validatedThink = validateThinkParameter(modelId, ollamaOptions == null ? void 0 : ollamaOptions.think);
926
954
  return {
927
955
  model: modelId,
928
956
  messages: convertToOllamaChatMessages({
@@ -935,8 +963,8 @@ var OllamaRequestBuilder = class {
935
963
  ...(responseFormat == null ? void 0 : responseFormat.type) === "json" && {
936
964
  format: responseFormat.schema != null ? responseFormat.schema : "json"
937
965
  },
938
- think: (_a = ollamaOptions == null ? void 0 : ollamaOptions.think) != null ? _a : false,
939
- options: (_b = ollamaOptions == null ? void 0 : ollamaOptions.options) != null ? _b : void 0
966
+ think: validatedThink,
967
+ options: (_a = ollamaOptions == null ? void 0 : ollamaOptions.options) != null ? _a : void 0
940
968
  };
941
969
  }
942
970
  };