fixes issue with preamble-required claude keys and anthropic chat

This commit is contained in:
nai-degen 2024-03-04 14:00:25 -06:00
parent 90a053d0e0
commit f6c124c1d3
1 changed files with 1 additions and 1 deletions

View File

@ -18,7 +18,7 @@ export const addAnthropicPreamble: HPMRequestCallback = (
let preamble = "";
let prompt = req.body.prompt;
assertAnthropicKey(req.key);
if (req.key.requiresPreamble) {
if (req.key.requiresPreamble && prompt) {
preamble = prompt.startsWith("\n\nHuman:") ? "" : "\n\nHuman:";
req.log.debug({ key: req.key.hash, preamble }, "Adding preamble to prompt");
}