Claude: new prompt converter + non-streaming tools

This commit is contained in:
Cohee
2024-10-04 03:41:25 +03:00
parent 559f1b81f7
commit c3c10a629e
3 changed files with 141 additions and 99 deletions

View File

@ -124,7 +124,6 @@ async function sendClaudeRequest(request, response) {
} else {
delete requestBody.system;
}
/*
if (Array.isArray(request.body.tools) && request.body.tools.length > 0) {
// Claude doesn't do prefills on function calls, and doesn't allow empty messages
if (convertedPrompt.messages.length && convertedPrompt.messages[convertedPrompt.messages.length - 1].role === 'assistant') {
@ -137,7 +136,6 @@ async function sendClaudeRequest(request, response) {
.map(tool => tool.function)
.map(fn => ({ name: fn.name, description: fn.description, input_schema: fn.parameters }));
}
*/
if (enableSystemPromptCache) {
additionalHeaders['anthropic-beta'] = 'prompt-caching-2024-07-31';
}