Automatically add Anthropic "\n\nHuman:" preamble when necessary (khanon/oai-reverse-proxy!23)
This commit is contained in:
@@ -153,19 +153,10 @@ function openaiToAnthropic(body: any, req: Request) {
|
||||
// Remove duplicates
|
||||
stops = [...new Set(stops)];
|
||||
|
||||
// TEMP: More shitty anthropic API hacks
|
||||
// If you receive a 400 Bad Request error from Anthropic complaining about
|
||||
// "prompt must start with a '\n\nHuman: ' turn", enable this setting.
|
||||
// I will try to fix this when I can identify why it only happens sometimes.
|
||||
let preamble = "";
|
||||
if (process.env.CLAUDE_ADD_HUMAN_PREAMBLE) {
|
||||
preamble = "\n\nHuman: Hello Claude.";
|
||||
}
|
||||
|
||||
return {
|
||||
...rest,
|
||||
model,
|
||||
prompt: preamble + prompt,
|
||||
prompt: prompt,
|
||||
max_tokens_to_sample: rest.max_tokens,
|
||||
stop_sequences: stops,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user