Skip to content

Commit 4f90787

Browse files
authored
Remove the message copilot_cache_control field from a context where there is no understanding of it (#554)
* Remove copilot_cache_control field from message body when calling endpoints directly. It's a CAPI field and some LLMs will issue an error on this field because it isn't a recognized field. * remove unneeded conditional expressions
1 parent 176ebe7 commit 4f90787

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/platform/endpoint/test/node/openaiCompatibleEndpoint.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,14 @@ export class OpenAICompatibleTestEndpoint extends ChatEndpoint {
164164
delete body.tools;
165165
}
166166

167+
if (body?.messages) {
168+
body.messages.forEach((message: any) => {
169+
if (message.copilot_cache_control) {
170+
delete message.copilot_cache_control;
171+
}
172+
});
173+
}
174+
167175
if (body) {
168176
if (this.modelConfig.overrides.snippy === null) {
169177
delete body.snippy;

0 commit comments

Comments
 (0)