@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.
@@ -555,7 +555,8 @@ var OpenAIAdapter = class {
555
555
  stream(req) {
556
556
  return streamFromOpenAI(this.ensureClient(), req, {
557
557
  knownModels: this.knownModels(),
558
- vendorMetadataExtractor: OPENAI_METADATA_EXTRACTOR
558
+ vendorMetadataExtractor: OPENAI_METADATA_EXTRACTOR,
559
+ includeCacheKey: this.forwardCacheKey()
559
560
  });
560
561
  }
561
562
  appendAssistantToolCall(history, toolCalls) {
@@ -576,6 +577,20 @@ var OpenAIAdapter = class {
576
577
  knownModels() {
577
578
  return openAIManifest.knownModels;
578
579
  }
580
+ /**
581
+ * Whether to forward `req.cacheKey` as OpenAI's `prompt_cache_key` request
582
+ * param. Default true — verified accepted by OpenAI, Azure OpenAI,
583
+ * Vertex-OpenAI, and Baseten. OpenAI-compatible vendors whose param
584
+ * handling is strict or unverified (DeepSeek, Moonshot, Zai, xAI — and
585
+ * Groq via its own stream override) override to false: a strict backend
586
+ * rejects the whole request on an unknown body param, which is far worse
587
+ * than forgoing a cache-routing hint. Flip a vendor to true only after
588
+ * verifying its endpoint (including any proxy in front of it, e.g.
589
+ * Bedrock Mantle) tolerates the param.
590
+ */
591
+ forwardCacheKey() {
592
+ return true;
593
+ }
579
594
  async testCredential() {
580
595
  await this.ensureClient().models.list();
581
596
  }
@@ -688,6 +703,11 @@ var DeepSeekAdapter = class extends OpenAIAdapter {
688
703
  knownModels() {
689
704
  return deepseekManifest.knownModels;
690
705
  }
706
+ // DeepSeek caches automatically server-side; prompt_cache_key is
707
+ // unverified against its param handling — do not forward.
708
+ forwardCacheKey() {
709
+ return false;
710
+ }
691
711
  };
692
712
  var deepseekFactory = {
693
713
  vendor: deepseekManifest.vendor,
@@ -911,6 +931,12 @@ var MoonshotAdapter = class extends OpenAIAdapter {
911
931
  knownModels() {
912
932
  return moonshotManifest.knownModels;
913
933
  }
934
+ // Moonshot's param handling is strict (e.g. it rejects unknown template
935
+ // kwargs) and prompt_cache_key is unverified against both the native
936
+ // endpoint and Bedrock Mantle deployments — do not forward.
937
+ forwardCacheKey() {
938
+ return false;
939
+ }
914
940
  };
915
941
  var moonshotFactory = {
916
942
  vendor: moonshotManifest.vendor,
@@ -984,6 +1010,11 @@ var ZaiAdapter = class extends OpenAIAdapter {
984
1010
  knownModels() {
985
1011
  return zaiManifest.knownModels;
986
1012
  }
1013
+ // prompt_cache_key is unverified against Zai's OpenAI-compat endpoint —
1014
+ // do not forward.
1015
+ forwardCacheKey() {
1016
+ return false;
1017
+ }
987
1018
  };
988
1019
  var zaiFactory = {
989
1020
  vendor: zaiManifest.vendor,
@@ -1079,6 +1110,11 @@ var XaiAdapter = class extends OpenAIAdapter {
1079
1110
  knownModels() {
1080
1111
  return xaiManifest.knownModels;
1081
1112
  }
1113
+ // xAI caches automatically server-side; prompt_cache_key is unverified
1114
+ // against its param handling — do not forward.
1115
+ forwardCacheKey() {
1116
+ return false;
1117
+ }
1082
1118
  };
1083
1119
  var xaiFactory = {
1084
1120
  vendor: xaiManifest.vendor,
@@ -3383,7 +3419,10 @@ var HuggingfaceAdapter = class extends OpenAIAdapter {
3383
3419
  stream(req) {
3384
3420
  return streamFromOpenAI(this.ensureClient(), req, {
3385
3421
  knownModels: huggingfaceManifest.knownModels,
3386
- vendorMetadataExtractor: HUGGINGFACE_METADATA_EXTRACTOR
3422
+ vendorMetadataExtractor: HUGGINGFACE_METADATA_EXTRACTOR,
3423
+ // The HF router fronts many third-party inference providers;
3424
+ // prompt_cache_key is unverified against them — do not forward.
3425
+ includeCacheKey: false
3387
3426
  });
3388
3427
  }
3389
3428
  };