requests old version of Anthropic API due to breaking SSE changes

This commit is contained in:
nai-degen 2023-06-24 14:50:48 -05:00
parent 6a7f64b037
commit 6598b4df0d
1 changed files with 7 additions and 0 deletions

View File

@ -99,6 +99,13 @@ function openaiToAnthropic(body: any, req: Request) {
throw result.error;
}
// Anthropic has started versioning their API, indicated by an HTTP header
// `anthropic-version`. The new June 2023 version is not backwards compatible
// with our OpenAI-to-Anthropic transformations so we need to explicitly
// request the older version for now. 2023-01-01 will be removed in September.
// https://docs.anthropic.com/claude/reference/versioning
req.headers["anthropic-version"] = "2023-01-01";
const { messages, ...rest } = result.data;
const prompt =
result.data.messages