@stackfactor/agent-utils 1.0.15 → 1.0.16

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
@@ -299,7 +299,7 @@ The `config` object accepted by LangChain methods supports the following keys:
299
299
  | `kimiAPIKey` | `string` | Kimi (Moonshot) API key |
300
300
  | `glmAPIKey` | `string` | GLM (Zhipu) API key |
301
301
  | `temperature` | `number` | Sampling temperature |
302
- | `maxTokens` | `number` | Maximum output tokens (default: `8192` for Claude, `200000` for other providers) |
302
+ | `maxTokens` | `number` | Maximum output tokens (default: `16384` for Claude, `200000` for other providers). For Claude, values above `21333` automatically enable LangChain streaming to bypass the Anthropic SDK's 10-minute non-streaming guard. |
303
303
  | `agentic` | `boolean` | Enable agentic mode in `runPromptWithModel` |
304
304
  | `recursionLimit` | `number` | Max agent steps (default: `25`) |
305
305
 
@@ -1 +1 @@
1
- {"version":3,"file":"langChain.d.ts","sourceRoot":"","sources":["../../src/langChain.ts"],"names":[],"mappings":";wBAsVQ,MAAM,aACD,MAAM,gBACH,MAAM,SACb,GAAG,EAAE,kBACI,GAAG,UACX,GAAG,KACV,GAAG;sBAyBG,GAAG,UACF,MAAM,UACN,GAAG,eACC,QAAQ,GAAG,IAAI,KAC1B,OAAO,CAAC,GAAG,CAAC;wCAmfF,MAAM,UACT,GAAG,UACH,GAAG,oBACO,GAAG,KACpB,GAAG;oCAxYO,MAAM,UACT,GAAG,UACH,GAAG,oBACO,GAAG,eACT,MAAM,eACN,MAAM,wBACG,OAAO,WACpB,GAAG,cACA,MAAM,UACV,GAAG,EAAE,KACX,OAAO,CAAC,GAAG,CAAC;sDA6rBF,MAAM,UACT,GAAG,UACH,MAAM,YACL,GAAG,KACX,OAAO,CAAC,GAAG,CAAC;0CA7vB8B,GAAG,KAAG,MAAM;;AAwzBzD,wBAOE"}
1
+ {"version":3,"file":"langChain.d.ts","sourceRoot":"","sources":["../../src/langChain.ts"],"names":[],"mappings":";wBA0VQ,MAAM,aACD,MAAM,gBACH,MAAM,SACb,GAAG,EAAE,kBACI,GAAG,UACX,GAAG,KACV,GAAG;sBAyBG,GAAG,UACF,MAAM,UACN,GAAG,eACC,QAAQ,GAAG,IAAI,KAC1B,OAAO,CAAC,GAAG,CAAC;wCAmfF,MAAM,UACT,GAAG,UACH,GAAG,oBACO,GAAG,KACpB,GAAG;oCAxYO,MAAM,UACT,GAAG,UACH,GAAG,oBACO,GAAG,eACT,MAAM,eACN,MAAM,wBACG,OAAO,WACpB,GAAG,cACA,MAAM,UACV,GAAG,EAAE,KACX,OAAO,CAAC,GAAG,CAAC;sDA6rBF,MAAM,UACT,GAAG,UACH,MAAM,YACL,GAAG,KACX,OAAO,CAAC,GAAG,CAAC;0CA7vB8B,GAAG,KAAG,MAAM;;AAwzBzD,wBAOE"}
@@ -246,12 +246,16 @@ const getLLMModel = (modelName, config, schema = null) => {
246
246
  // Claude models (Anthropic)
247
247
  if (modelName.startsWith("claude-")) {
248
248
  // Anthropic's SDK rejects non-streamed requests when max_tokens is large
249
- // enough that the operation could exceed 10 minutes. Cap the default well
250
- // below that threshold; callers can override via config.maxTokens.
249
+ // enough that the operation could exceed 10 minutes (threshold: 21333).
250
+ // Auto-enable LangChain streaming above that cutoff so `.invoke()` routes
251
+ // through the streaming endpoint internally — callers see no interface
252
+ // change, but the guard is bypassed.
253
+ const maxTokens = config.maxTokens || 16384;
251
254
  return new anthropic_1.ChatAnthropic({
252
255
  apiKey: config.anthropicAPIKey,
253
- maxTokens: config.maxTokens || 16384,
256
+ maxTokens,
254
257
  modelName: modelName,
258
+ streaming: maxTokens > 16384,
255
259
  ...modelSettings,
256
260
  });
257
261
  }
@@ -1 +1 @@
1
- {"version":3,"file":"langChain.d.ts","sourceRoot":"","sources":["../../src/langChain.ts"],"names":[],"mappings":";wBAsVQ,MAAM,aACD,MAAM,gBACH,MAAM,SACb,GAAG,EAAE,kBACI,GAAG,UACX,GAAG,KACV,GAAG;sBAyBG,GAAG,UACF,MAAM,UACN,GAAG,eACC,QAAQ,GAAG,IAAI,KAC1B,OAAO,CAAC,GAAG,CAAC;wCAmfF,MAAM,UACT,GAAG,UACH,GAAG,oBACO,GAAG,KACpB,GAAG;oCAxYO,MAAM,UACT,GAAG,UACH,GAAG,oBACO,GAAG,eACT,MAAM,eACN,MAAM,wBACG,OAAO,WACpB,GAAG,cACA,MAAM,UACV,GAAG,EAAE,KACX,OAAO,CAAC,GAAG,CAAC;sDA6rBF,MAAM,UACT,GAAG,UACH,MAAM,YACL,GAAG,KACX,OAAO,CAAC,GAAG,CAAC;0CA7vB8B,GAAG,KAAG,MAAM;;AAwzBzD,wBAOE"}
1
+ {"version":3,"file":"langChain.d.ts","sourceRoot":"","sources":["../../src/langChain.ts"],"names":[],"mappings":";wBA0VQ,MAAM,aACD,MAAM,gBACH,MAAM,SACb,GAAG,EAAE,kBACI,GAAG,UACX,GAAG,KACV,GAAG;sBAyBG,GAAG,UACF,MAAM,UACN,GAAG,eACC,QAAQ,GAAG,IAAI,KAC1B,OAAO,CAAC,GAAG,CAAC;wCAmfF,MAAM,UACT,GAAG,UACH,GAAG,oBACO,GAAG,KACpB,GAAG;oCAxYO,MAAM,UACT,GAAG,UACH,GAAG,oBACO,GAAG,eACT,MAAM,eACN,MAAM,wBACG,OAAO,WACpB,GAAG,cACA,MAAM,UACV,GAAG,EAAE,KACX,OAAO,CAAC,GAAG,CAAC;sDA6rBF,MAAM,UACT,GAAG,UACH,MAAM,YACL,GAAG,KACX,OAAO,CAAC,GAAG,CAAC;0CA7vB8B,GAAG,KAAG,MAAM;;AAwzBzD,wBAOE"}
@@ -241,12 +241,16 @@ const getLLMModel = (modelName, config, schema = null) => {
241
241
  // Claude models (Anthropic)
242
242
  if (modelName.startsWith("claude-")) {
243
243
  // Anthropic's SDK rejects non-streamed requests when max_tokens is large
244
- // enough that the operation could exceed 10 minutes. Cap the default well
245
- // below that threshold; callers can override via config.maxTokens.
244
+ // enough that the operation could exceed 10 minutes (threshold: 21333).
245
+ // Auto-enable LangChain streaming above that cutoff so `.invoke()` routes
246
+ // through the streaming endpoint internally — callers see no interface
247
+ // change, but the guard is bypassed.
248
+ const maxTokens = config.maxTokens || 16384;
246
249
  return new ChatAnthropic({
247
250
  apiKey: config.anthropicAPIKey,
248
- maxTokens: config.maxTokens || 16384,
251
+ maxTokens,
249
252
  modelName: modelName,
253
+ streaming: maxTokens > 16384,
250
254
  ...modelSettings,
251
255
  });
252
256
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "restricted"
5
5
  },
6
- "version": "1.0.15",
6
+ "version": "1.0.16",
7
7
  "description": "",
8
8
  "main": "dist/cjs/index.js",
9
9
  "module": "dist/esm/index.js",