@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.cjs CHANGED
@@ -568,7 +568,8 @@ var OpenAIAdapter = class {
568
568
  stream(req) {
569
569
  return streamFromOpenAI(this.ensureClient(), req, {
570
570
  knownModels: this.knownModels(),
571
- vendorMetadataExtractor: OPENAI_METADATA_EXTRACTOR
571
+ vendorMetadataExtractor: OPENAI_METADATA_EXTRACTOR,
572
+ includeCacheKey: this.forwardCacheKey()
572
573
  });
573
574
  }
574
575
  appendAssistantToolCall(history, toolCalls) {
@@ -589,6 +590,20 @@ var OpenAIAdapter = class {
589
590
  knownModels() {
590
591
  return openAIManifest.knownModels;
591
592
  }
593
+ /**
594
+ * Whether to forward `req.cacheKey` as OpenAI's `prompt_cache_key` request
595
+ * param. Default true — verified accepted by OpenAI, Azure OpenAI,
596
+ * Vertex-OpenAI, and Baseten. OpenAI-compatible vendors whose param
597
+ * handling is strict or unverified (DeepSeek, Moonshot, Zai, xAI — and
598
+ * Groq via its own stream override) override to false: a strict backend
599
+ * rejects the whole request on an unknown body param, which is far worse
600
+ * than forgoing a cache-routing hint. Flip a vendor to true only after
601
+ * verifying its endpoint (including any proxy in front of it, e.g.
602
+ * Bedrock Mantle) tolerates the param.
603
+ */
604
+ forwardCacheKey() {
605
+ return true;
606
+ }
592
607
  async testCredential() {
593
608
  await this.ensureClient().models.list();
594
609
  }
@@ -701,6 +716,11 @@ var DeepSeekAdapter = class extends OpenAIAdapter {
701
716
  knownModels() {
702
717
  return deepseekManifest.knownModels;
703
718
  }
719
+ // DeepSeek caches automatically server-side; prompt_cache_key is
720
+ // unverified against its param handling — do not forward.
721
+ forwardCacheKey() {
722
+ return false;
723
+ }
704
724
  };
705
725
  var deepseekFactory = {
706
726
  vendor: deepseekManifest.vendor,
@@ -924,6 +944,12 @@ var MoonshotAdapter = class extends OpenAIAdapter {
924
944
  knownModels() {
925
945
  return moonshotManifest.knownModels;
926
946
  }
947
+ // Moonshot's param handling is strict (e.g. it rejects unknown template
948
+ // kwargs) and prompt_cache_key is unverified against both the native
949
+ // endpoint and Bedrock Mantle deployments — do not forward.
950
+ forwardCacheKey() {
951
+ return false;
952
+ }
927
953
  };
928
954
  var moonshotFactory = {
929
955
  vendor: moonshotManifest.vendor,
@@ -997,6 +1023,11 @@ var ZaiAdapter = class extends OpenAIAdapter {
997
1023
  knownModels() {
998
1024
  return zaiManifest.knownModels;
999
1025
  }
1026
+ // prompt_cache_key is unverified against Zai's OpenAI-compat endpoint —
1027
+ // do not forward.
1028
+ forwardCacheKey() {
1029
+ return false;
1030
+ }
1000
1031
  };
1001
1032
  var zaiFactory = {
1002
1033
  vendor: zaiManifest.vendor,
@@ -1092,6 +1123,11 @@ var XaiAdapter = class extends OpenAIAdapter {
1092
1123
  knownModels() {
1093
1124
  return xaiManifest.knownModels;
1094
1125
  }
1126
+ // xAI caches automatically server-side; prompt_cache_key is unverified
1127
+ // against its param handling — do not forward.
1128
+ forwardCacheKey() {
1129
+ return false;
1130
+ }
1095
1131
  };
1096
1132
  var xaiFactory = {
1097
1133
  vendor: xaiManifest.vendor,
@@ -3396,7 +3432,10 @@ var HuggingfaceAdapter = class extends OpenAIAdapter {
3396
3432
  stream(req) {
3397
3433
  return streamFromOpenAI(this.ensureClient(), req, {
3398
3434
  knownModels: huggingfaceManifest.knownModels,
3399
- vendorMetadataExtractor: HUGGINGFACE_METADATA_EXTRACTOR
3435
+ vendorMetadataExtractor: HUGGINGFACE_METADATA_EXTRACTOR,
3436
+ // The HF router fronts many third-party inference providers;
3437
+ // prompt_cache_key is unverified against them — do not forward.
3438
+ includeCacheKey: false
3400
3439
  });
3401
3440
  }
3402
3441
  };