From c5f6d0e06370abcce7dbf3a3fbdb5beafa157f9a Mon Sep 17 00:00:00 2001 From: h1xy <48129611+h1xy@users.noreply.github.com> Date: Mon, 8 Apr 2024 02:12:47 +0800 Subject: [PATCH] Fix: CompletionRatio is not working for openrouter.ai https://openrouter.ai/docs#models Model name of openrouter is prefix with company name, e.g. "model": "anthropic/claude-3-opus:beta", therefore, CompletionRatio will not working for it which is only work for prefix with claude-xxx --- common/model-ratio.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/model-ratio.go b/common/model-ratio.go index f618af8..2ff1aa4 100644 --- a/common/model-ratio.go +++ b/common/model-ratio.go @@ -206,11 +206,11 @@ func GetCompletionRatio(name string) float64 { } return 2 } - if strings.HasPrefix(name, "claude-instant-1") { + if strings.Contains(name, "claude-instant-1") { return 3 - } else if strings.HasPrefix(name, "claude-2") { + } else if strings.Contains(name, "claude-2") { return 3 - } else if strings.HasPrefix(name, "claude-3") { + } else if strings.Contains(name, "claude-3") { return 5 } if strings.HasPrefix(name, "mistral-") {