@jambonz/llm 0.6.0 → 0.6.1

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.js CHANGED
@@ -523,7 +523,8 @@ var OpenAIAdapter = class {
523
523
  stream(req) {
524
524
  return streamFromOpenAI(this.ensureClient(), req, {
525
525
  knownModels: this.knownModels(),
526
- vendorMetadataExtractor: OPENAI_METADATA_EXTRACTOR
526
+ vendorMetadataExtractor: OPENAI_METADATA_EXTRACTOR,
527
+ includeCacheKey: this.forwardCacheKey()
527
528
  });
528
529
  }
529
530
  appendAssistantToolCall(history, toolCalls) {
@@ -544,6 +545,20 @@ var OpenAIAdapter = class {
544
545
  knownModels() {
545
546
  return openAIManifest.knownModels;
546
547
  }
548
+ /**
549
+ * Whether to forward `req.cacheKey` as OpenAI's `prompt_cache_key` request
550
+ * param. Default true — verified accepted by OpenAI, Azure OpenAI,
551
+ * Vertex-OpenAI, and Baseten. OpenAI-compatible vendors whose param
552
+ * handling is strict or unverified (DeepSeek, Moonshot, Zai, xAI — and
553
+ * Groq via its own stream override) override to false: a strict backend
554
+ * rejects the whole request on an unknown body param, which is far worse
555
+ * than forgoing a cache-routing hint. Flip a vendor to true only after
556
+ * verifying its endpoint (including any proxy in front of it, e.g.
557
+ * Bedrock Mantle) tolerates the param.
558
+ */
559
+ forwardCacheKey() {
560
+ return true;
561
+ }
547
562
  async testCredential() {
548
563
  await this.ensureClient().models.list();
549
564
  }
@@ -656,6 +671,11 @@ var DeepSeekAdapter = class extends OpenAIAdapter {
656
671
  knownModels() {
657
672
  return deepseekManifest.knownModels;
658
673
  }
674
+ // DeepSeek caches automatically server-side; prompt_cache_key is
675
+ // unverified against its param handling — do not forward.
676
+ forwardCacheKey() {
677
+ return false;
678
+ }
659
679
  };
660
680
  var deepseekFactory = {
661
681
  vendor: deepseekManifest.vendor,
@@ -879,6 +899,12 @@ var MoonshotAdapter = class extends OpenAIAdapter {
879
899
  knownModels() {
880
900
  return moonshotManifest.knownModels;
881
901
  }
902
+ // Moonshot's param handling is strict (e.g. it rejects unknown template
903
+ // kwargs) and prompt_cache_key is unverified against both the native
904
+ // endpoint and Bedrock Mantle deployments — do not forward.
905
+ forwardCacheKey() {
906
+ return false;
907
+ }
882
908
  };
883
909
  var moonshotFactory = {
884
910
  vendor: moonshotManifest.vendor,
@@ -952,6 +978,11 @@ var ZaiAdapter = class extends OpenAIAdapter {
952
978
  knownModels() {
953
979
  return zaiManifest.knownModels;
954
980
  }
981
+ // prompt_cache_key is unverified against Zai's OpenAI-compat endpoint —
982
+ // do not forward.
983
+ forwardCacheKey() {
984
+ return false;
985
+ }
955
986
  };
956
987
  var zaiFactory = {
957
988
  vendor: zaiManifest.vendor,
@@ -1047,6 +1078,11 @@ var XaiAdapter = class extends OpenAIAdapter {
1047
1078
  knownModels() {
1048
1079
  return xaiManifest.knownModels;
1049
1080
  }
1081
+ // xAI caches automatically server-side; prompt_cache_key is unverified
1082
+ // against its param handling — do not forward.
1083
+ forwardCacheKey() {
1084
+ return false;
1085
+ }
1050
1086
  };
1051
1087
  var xaiFactory = {
1052
1088
  vendor: xaiManifest.vendor,
@@ -3357,7 +3393,10 @@ var HuggingfaceAdapter = class extends OpenAIAdapter {
3357
3393
  stream(req) {
3358
3394
  return streamFromOpenAI(this.ensureClient(), req, {
3359
3395
  knownModels: huggingfaceManifest.knownModels,
3360
- vendorMetadataExtractor: HUGGINGFACE_METADATA_EXTRACTOR
3396
+ vendorMetadataExtractor: HUGGINGFACE_METADATA_EXTRACTOR,
3397
+ // The HF router fronts many third-party inference providers;
3398
+ // prompt_cache_key is unverified against them — do not forward.
3399
+ includeCacheKey: false
3361
3400
  });
3362
3401
  }
3363
3402
  };