Commit 15d83ba
authored
* fix(adapters): forward prompt_cache_key through openai-chat adapter (#217)
The Responses parser writes prompt_cache_key to options.promptCacheKey,
but the openai-chat adapter's buildRequest() never copied it into the
outbound /chat/completions body. OpenAI's Chat Completions API accepts
prompt_cache_key as an optional string for prompt-cache affinity grouping.
Copy parsed.options.promptCacheKey to body.prompt_cache_key when set,
omit when unset. The openai-responses passthrough adapter already
preserves it via _rawBody forwarding.
Add two tests: one asserting the field is forwarded when present,
one asserting it is absent when not provided.
* fix(adapters): gate prompt_cache_key behind provider opt-in flag
The previous unconditional copy forwarded prompt_cache_key to every
openai-chat backend. Strict providers (Groq, Cerebras, etc.) reject
unknown body fields, so this could break those routed requests.
Add an opt-in promptCacheKey boolean flag to OcxProviderConfig and
ProviderRegistryEntry, wired through router scalar backfill. The
adapter now only forwards body.prompt_cache_key when the provider
explicitly opts in. Default off, so no built-in provider is affected.
The built-in OpenAI provider uses openai-responses (passthrough),
which already preserves prompt_cache_key via _rawBody forwarding.
This flag is for user-configured openai-chat providers that document
prompt_cache_key support.
Tests updated to cover opt-in, opt-out, and unset cases.
1 parent 90d1ef4 commit 15d83ba
5 files changed
Lines changed: 42 additions & 0 deletions
File tree
- src
- adapters
- providers
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
502 | 502 | | |
503 | 503 | | |
504 | 504 | | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
505 | 510 | | |
506 | 511 | | |
507 | 512 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
| 69 | + | |
68 | 70 | | |
69 | 71 | | |
70 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
| 185 | + | |
185 | 186 | | |
186 | 187 | | |
187 | 188 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
692 | 692 | | |
693 | 693 | | |
694 | 694 | | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
695 | 701 | | |
696 | 702 | | |
697 | 703 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
132 | 160 | | |
0 commit comments