Fix gemini message conversion

This commit is contained in:
Saoud Rizwan
2024-09-12 11:49:32 -04:00
parent fbb7620fa1
commit 3b004aed37
5 changed files with 121 additions and 49 deletions

View File

@@ -201,17 +201,22 @@ export const openRouterModels = {
// outputPrice: 0.06,
// },
// OpenRouter needs to fix mapping gemini 1.5 responses for tool calls properly, they return content with line breaks formatted wrong (too many escapes), and throw errors for being in the wrong order when they're not. They also cannot handle feedback given to a request with multiple tools. Giving feedback to one tool use requests works fine. ("Please ensure that function response turn comes immediately after a function call turn. And the number of function response parts should be equal to number of function call parts of the function call turn.")
// UPDATE: I keep getting "400: Please ensure that function call turn comes immediately after a user turn or after a function response turn.", which gets fixed as soon as i switch to openrouter/claude, so it's obviously an error on openrouters end transforming the message structure. This is likely the culprit behind the tool order error people have seen with gpt4o.
// "google/gemini-pro-1.5": {
// maxTokens: 8192,
// supportsImages: false, // "Function Calling is not supported with non-text input"
// contextWindow: 2_097_152,
// supportsImages: true, // "Function Calling is not supported with non-text input"
// supportsPromptCache: false,
// inputPrice: 2.5,
// outputPrice: 7.5,
// },
// "google/gemini-flash-1.5": {
// maxTokens: 8192,
// supportsImages: false, // "Function Calling is not supported with non-text input"
// inputPrice: 0.25,
// outputPrice: 0.75,
// contextWindow: 1_048_576,
// supportsImages: true, // "Function Calling is not supported with non-text input"
// supportsPromptCache: false,
// inputPrice: 0.0375,
// outputPrice: 0.15,
// },
// "google/gemini-pro": {
// maxTokens: 8192,