maybe fixes missing anthropic version header in some cases
This commit is contained in:
parent
4dfd57fcb4
commit
81a3ae1746
|
@ -70,6 +70,7 @@ export const addKey: ProxyReqMutator = (manager) => {
|
||||||
switch (assignedKey.service) {
|
switch (assignedKey.service) {
|
||||||
case "anthropic":
|
case "anthropic":
|
||||||
manager.setHeader("X-API-Key", assignedKey.key);
|
manager.setHeader("X-API-Key", assignedKey.key);
|
||||||
|
manager.setHeader("anthropic-version", "2023-06-01");
|
||||||
break;
|
break;
|
||||||
case "openai":
|
case "openai":
|
||||||
const key: OpenAIKey = assignedKey as OpenAIKey;
|
const key: OpenAIKey = assignedKey as OpenAIKey;
|
||||||
|
|
|
@ -110,8 +110,6 @@ export const transformOpenAIToAnthropicChat: APIFormatTransformer<
|
||||||
throw result.error;
|
throw result.error;
|
||||||
}
|
}
|
||||||
|
|
||||||
req.headers["anthropic-version"] = "2023-06-01";
|
|
||||||
|
|
||||||
const { messages, ...rest } = result.data;
|
const { messages, ...rest } = result.data;
|
||||||
const { messages: newMessages, system } =
|
const { messages: newMessages, system } =
|
||||||
openAIMessagesToClaudeChatPrompt(messages);
|
openAIMessagesToClaudeChatPrompt(messages);
|
||||||
|
@ -146,8 +144,6 @@ export const transformOpenAIToAnthropicText: APIFormatTransformer<
|
||||||
throw result.error;
|
throw result.error;
|
||||||
}
|
}
|
||||||
|
|
||||||
req.headers["anthropic-version"] = "2023-06-01";
|
|
||||||
|
|
||||||
const { messages, ...rest } = result.data;
|
const { messages, ...rest } = result.data;
|
||||||
const prompt = openAIMessagesToClaudeTextPrompt(messages);
|
const prompt = openAIMessagesToClaudeTextPrompt(messages);
|
||||||
|
|
||||||
|
@ -192,8 +188,6 @@ export const transformAnthropicTextToAnthropicChat: APIFormatTransformer<
|
||||||
throw result.error;
|
throw result.error;
|
||||||
}
|
}
|
||||||
|
|
||||||
req.headers["anthropic-version"] = "2023-06-01";
|
|
||||||
|
|
||||||
const { model, max_tokens_to_sample, prompt, ...rest } = result.data;
|
const { model, max_tokens_to_sample, prompt, ...rest } = result.data;
|
||||||
validateAnthropicTextPrompt(prompt);
|
validateAnthropicTextPrompt(prompt);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue