maybe fixes missing anthropic version header in some cases

This commit is contained in:
nai-degen 2024-09-19 00:50:17 -05:00
parent 4dfd57fcb4
commit 81a3ae1746
2 changed files with 1 additions and 6 deletions

View File

@ -70,6 +70,7 @@ export const addKey: ProxyReqMutator = (manager) => {
switch (assignedKey.service) {
case "anthropic":
manager.setHeader("X-API-Key", assignedKey.key);
manager.setHeader("anthropic-version", "2023-06-01");
break;
case "openai":
const key: OpenAIKey = assignedKey as OpenAIKey;

View File

@ -110,8 +110,6 @@ export const transformOpenAIToAnthropicChat: APIFormatTransformer<
throw result.error;
}
req.headers["anthropic-version"] = "2023-06-01";
const { messages, ...rest } = result.data;
const { messages: newMessages, system } =
openAIMessagesToClaudeChatPrompt(messages);
@ -146,8 +144,6 @@ export const transformOpenAIToAnthropicText: APIFormatTransformer<
throw result.error;
}
req.headers["anthropic-version"] = "2023-06-01";
const { messages, ...rest } = result.data;
const prompt = openAIMessagesToClaudeTextPrompt(messages);
@ -192,8 +188,6 @@ export const transformAnthropicTextToAnthropicChat: APIFormatTransformer<
throw result.error;
}
req.headers["anthropic-version"] = "2023-06-01";
const { model, max_tokens_to_sample, prompt, ...rest } = result.data;
validateAnthropicTextPrompt(prompt);