@ljoukov/llm 7.0.3 → 7.0.4

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
@@ -491,15 +491,14 @@ const { value } = await generateJson({
491
491
  console.log(value.ok, value.message);
492
492
  ```
493
493
 
494
- For Gemini calls that need a specific thinking budget, pass `thinkingBudget`. This overrides the model default and
495
- `thinkingLevel` for Gemini requests:
494
+ For calls that should use a smaller reasoning budget, pass the cross-model `thinkingLevel` option:
496
495
 
497
496
  ```ts
498
497
  const { value } = await generateJson({
499
498
  model: "gemini-flash-latest",
500
499
  input: "Return a JSON object with ok=true and message='hello'.",
501
500
  schema,
502
- thinkingBudget: 0,
501
+ thinkingLevel: "low",
503
502
  });
504
503
  ```
505
504
 
package/dist/index.cjs CHANGED
@@ -7258,14 +7258,10 @@ function toGemini25ProThinkingBudget(thinkingLevel) {
7258
7258
  return 32768;
7259
7259
  }
7260
7260
  }
7261
- function resolveGeminiThinkingConfig(modelId, thinkingLevel, thinkingBudget) {
7261
+ function resolveGeminiThinkingConfig(modelId, thinkingLevel) {
7262
7262
  if (isGeminiImageModelId(modelId) || modelId === "gemini-flash-lite-latest") {
7263
7263
  return void 0;
7264
7264
  }
7265
- if (thinkingBudget !== void 0) {
7266
- const normalizedBudget = Math.max(0, Math.floor(thinkingBudget));
7267
- return normalizedBudget === 0 ? { thinkingBudget: 0 } : { includeThoughts: true, thinkingBudget: normalizedBudget };
7268
- }
7269
7265
  if (thinkingLevel) {
7270
7266
  if (modelId === "gemini-2.5-pro") {
7271
7267
  return {
@@ -7641,7 +7637,6 @@ function startLlmCallLoggerFromContents(options) {
7641
7637
  ...options.request.imageAspectRatio ? { imageAspectRatio: options.request.imageAspectRatio } : {},
7642
7638
  ...options.request.imageSize ? { imageSize: options.request.imageSize } : {},
7643
7639
  ...options.request.thinkingLevel ? { thinkingLevel: options.request.thinkingLevel } : {},
7644
- ...options.request.thinkingBudget !== void 0 ? { thinkingBudget: options.request.thinkingBudget } : {},
7645
7640
  ...options.request.mediaResolution ? { mediaResolution: options.request.mediaResolution } : {},
7646
7641
  ...options.request.openAiTextFormat ? { openAiTextFormat: sanitiseLogValue(options.request.openAiTextFormat) } : {},
7647
7642
  ...getCurrentToolCallContext() ? { toolContext: getCurrentToolCallContext() } : {}
@@ -7943,11 +7938,7 @@ async function runTextCall(params) {
7943
7938
  })
7944
7939
  )
7945
7940
  );
7946
- const thinkingConfig = resolveGeminiThinkingConfig(
7947
- modelForProvider,
7948
- request.thinkingLevel,
7949
- request.thinkingBudget
7950
- );
7941
+ const thinkingConfig = resolveGeminiThinkingConfig(modelForProvider, request.thinkingLevel);
7951
7942
  const mediaResolution = toGeminiMediaResolution(request.mediaResolution);
7952
7943
  const config = {
7953
7944
  maxOutputTokens: 32e3,
@@ -8254,7 +8245,6 @@ function startJsonStream(request, operation) {
8254
8245
  responseMimeType: request.responseMimeType ?? "application/json",
8255
8246
  responseJsonSchema,
8256
8247
  thinkingLevel: request.thinkingLevel,
8257
- thinkingBudget: request.thinkingBudget,
8258
8248
  ...openAiTextFormatForAttempt ? { openAiTextFormat: openAiTextFormatForAttempt } : {},
8259
8249
  telemetry: false,
8260
8250
  signal
@@ -9659,11 +9649,7 @@ async function runToolLoop(request) {
9659
9649
  firstModelEventAtMs = Date.now();
9660
9650
  }
9661
9651
  };
9662
- const thinkingConfig = resolveGeminiThinkingConfig(
9663
- request.model,
9664
- request.thinkingLevel,
9665
- request.thinkingBudget
9666
- );
9652
+ const thinkingConfig = resolveGeminiThinkingConfig(request.model, request.thinkingLevel);
9667
9653
  const mediaResolution = toGeminiMediaResolution(request.mediaResolution);
9668
9654
  const config = {
9669
9655
  maxOutputTokens: 32e3,