@ljoukov/llm 7.0.4 → 7.0.6

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/dist/index.cjs CHANGED
@@ -7248,25 +7248,16 @@ function toGeminiThinkingLevel(thinkingLevel) {
7248
7248
  return import_genai2.ThinkingLevel.HIGH;
7249
7249
  }
7250
7250
  }
7251
- function toGemini25ProThinkingBudget(thinkingLevel) {
7252
- switch (thinkingLevel) {
7253
- case "low":
7254
- return 256;
7255
- case "medium":
7256
- return 4096;
7257
- case "high":
7258
- return 32768;
7259
- }
7260
- }
7261
7251
  function resolveGeminiThinkingConfig(modelId, thinkingLevel) {
7262
7252
  if (isGeminiImageModelId(modelId) || modelId === "gemini-flash-lite-latest") {
7263
7253
  return void 0;
7264
7254
  }
7265
7255
  if (thinkingLevel) {
7266
- if (modelId === "gemini-2.5-pro") {
7256
+ const thinkingBudget = resolveGeminiThinkingBudget(modelId, thinkingLevel);
7257
+ if (thinkingBudget !== void 0) {
7267
7258
  return {
7268
7259
  includeThoughts: true,
7269
- thinkingBudget: toGemini25ProThinkingBudget(thinkingLevel)
7260
+ thinkingBudget
7270
7261
  };
7271
7262
  }
7272
7263
  return {
@@ -7288,6 +7279,39 @@ function resolveGeminiThinkingConfig(modelId, thinkingLevel) {
7288
7279
  return { includeThoughts: true };
7289
7280
  }
7290
7281
  }
7282
+ function resolveGeminiThinkingBudget(modelId, thinkingLevel) {
7283
+ if (modelId === "gemini-2.5-pro") {
7284
+ switch (thinkingLevel) {
7285
+ case "low":
7286
+ return 256;
7287
+ case "medium":
7288
+ return 4096;
7289
+ case "high":
7290
+ return 32768;
7291
+ }
7292
+ }
7293
+ if (modelId === "gemini-flash-latest") {
7294
+ switch (thinkingLevel) {
7295
+ case "low":
7296
+ return 256;
7297
+ case "medium":
7298
+ return 8192;
7299
+ case "high":
7300
+ return 24576;
7301
+ }
7302
+ }
7303
+ if (modelId === "gemini-3-flash-preview") {
7304
+ switch (thinkingLevel) {
7305
+ case "low":
7306
+ return 256;
7307
+ case "medium":
7308
+ return 8192;
7309
+ case "high":
7310
+ return 16384;
7311
+ }
7312
+ }
7313
+ return void 0;
7314
+ }
7291
7315
  function decodeInlineDataBuffer(base64) {
7292
7316
  try {
7293
7317
  return import_node_buffer4.Buffer.from(base64, "base64");
@@ -8172,7 +8196,7 @@ function buildJsonSchemaConfig(request) {
8172
8196
  name: schemaName,
8173
8197
  target: isOpenAiVariant ? "openAi" : "jsonSchema7"
8174
8198
  });
8175
- const responseJsonSchema = isOpenAiVariant ? resolveOpenAiSchemaRoot(baseJsonSchema) : isGeminiVariant ? addGeminiPropertyOrdering(baseJsonSchema) : resolveOpenAiSchemaRoot(baseJsonSchema);
8199
+ const responseJsonSchema = isOpenAiVariant ? resolveOpenAiSchemaRoot(baseJsonSchema) : isGeminiVariant ? addGeminiPropertyOrdering(resolveOpenAiSchemaRoot(baseJsonSchema)) : resolveOpenAiSchemaRoot(baseJsonSchema);
8176
8200
  if (isOpenAiVariant && !isJsonSchemaObject(responseJsonSchema)) {
8177
8201
  throw new Error("OpenAI structured outputs require a JSON object schema at the root.");
8178
8202
  }