Fix OpenRouter calls by mapping openai sdk messages to and from anthropic sdk messages

This commit is contained in:
Saoud Rizwan
2024-08-03 18:06:33 -04:00
parent fa1068d92d
commit d7ee0c0161
5 changed files with 210 additions and 64 deletions

View File

@@ -31,4 +31,22 @@ export class AnthropicHandler implements ApiHandler {
}
)
}
createUserReadableRequest(
userContent: Array<
| Anthropic.TextBlockParam
| Anthropic.ImageBlockParam
| Anthropic.ToolUseBlockParam
| Anthropic.ToolResultBlockParam
>
): any {
return {
model: "claude-3-5-sonnet-20240620",
max_tokens: 8192,
system: "(see SYSTEM_PROMPT in src/ClaudeDev.ts)",
messages: [{ conversation_history: "..." }, { role: "user", content: userContent }],
tools: "(see tools in src/ClaudeDev.ts)",
tool_choice: { type: "auto" },
}
}
}