@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.
@@ -516,7 +516,8 @@ var OpenAIAdapter = class {
516
516
  stream(req) {
517
517
  return streamFromOpenAI(this.ensureClient(), req, {
518
518
  knownModels: this.knownModels(),
519
- vendorMetadataExtractor: OPENAI_METADATA_EXTRACTOR
519
+ vendorMetadataExtractor: OPENAI_METADATA_EXTRACTOR,
520
+ includeCacheKey: this.forwardCacheKey()
520
521
  });
521
522
  }
522
523
  appendAssistantToolCall(history, toolCalls) {
@@ -537,6 +538,20 @@ var OpenAIAdapter = class {
537
538
  knownModels() {
538
539
  return openAIManifest.knownModels;
539
540
  }
541
+ /**
542
+ * Whether to forward `req.cacheKey` as OpenAI's `prompt_cache_key` request
543
+ * param. Default true — verified accepted by OpenAI, Azure OpenAI,
544
+ * Vertex-OpenAI, and Baseten. OpenAI-compatible vendors whose param
545
+ * handling is strict or unverified (DeepSeek, Moonshot, Zai, xAI — and
546
+ * Groq via its own stream override) override to false: a strict backend
547
+ * rejects the whole request on an unknown body param, which is far worse
548
+ * than forgoing a cache-routing hint. Flip a vendor to true only after
549
+ * verifying its endpoint (including any proxy in front of it, e.g.
550
+ * Bedrock Mantle) tolerates the param.
551
+ */
552
+ forwardCacheKey() {
553
+ return true;
554
+ }
540
555
  async testCredential() {
541
556
  await this.ensureClient().models.list();
542
557
  }
@@ -649,6 +664,11 @@ var DeepSeekAdapter = class extends OpenAIAdapter {
649
664
  knownModels() {
650
665
  return deepseekManifest.knownModels;
651
666
  }
667
+ // DeepSeek caches automatically server-side; prompt_cache_key is
668
+ // unverified against its param handling — do not forward.
669
+ forwardCacheKey() {
670
+ return false;
671
+ }
652
672
  };
653
673
  var deepseekFactory = {
654
674
  vendor: deepseekManifest.vendor,
@@ -872,6 +892,12 @@ var MoonshotAdapter = class extends OpenAIAdapter {
872
892
  knownModels() {
873
893
  return moonshotManifest.knownModels;
874
894
  }
895
+ // Moonshot's param handling is strict (e.g. it rejects unknown template
896
+ // kwargs) and prompt_cache_key is unverified against both the native
897
+ // endpoint and Bedrock Mantle deployments — do not forward.
898
+ forwardCacheKey() {
899
+ return false;
900
+ }
875
901
  };
876
902
  var moonshotFactory = {
877
903
  vendor: moonshotManifest.vendor,
@@ -945,6 +971,11 @@ var ZaiAdapter = class extends OpenAIAdapter {
945
971
  knownModels() {
946
972
  return zaiManifest.knownModels;
947
973
  }
974
+ // prompt_cache_key is unverified against Zai's OpenAI-compat endpoint —
975
+ // do not forward.
976
+ forwardCacheKey() {
977
+ return false;
978
+ }
948
979
  };
949
980
  var zaiFactory = {
950
981
  vendor: zaiManifest.vendor,
@@ -1040,6 +1071,11 @@ var XaiAdapter = class extends OpenAIAdapter {
1040
1071
  knownModels() {
1041
1072
  return xaiManifest.knownModels;
1042
1073
  }
1074
+ // xAI caches automatically server-side; prompt_cache_key is unverified
1075
+ // against its param handling — do not forward.
1076
+ forwardCacheKey() {
1077
+ return false;
1078
+ }
1043
1079
  };
1044
1080
  var xaiFactory = {
1045
1081
  vendor: xaiManifest.vendor,
@@ -3350,7 +3386,10 @@ var HuggingfaceAdapter = class extends OpenAIAdapter {
3350
3386
  stream(req) {
3351
3387
  return streamFromOpenAI(this.ensureClient(), req, {
3352
3388
  knownModels: huggingfaceManifest.knownModels,
3353
- vendorMetadataExtractor: HUGGINGFACE_METADATA_EXTRACTOR
3389
+ vendorMetadataExtractor: HUGGINGFACE_METADATA_EXTRACTOR,
3390
+ // The HF router fronts many third-party inference providers;
3391
+ // prompt_cache_key is unverified against them — do not forward.
3392
+ includeCacheKey: false
3354
3393
  });
3355
3394
  }
3356
3395
  };