mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-10 18:43:41 +08:00
Compare commits
2 Commits
v0.6.6-alp
...
v0.6.6-alp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e64e7707a0 | ||
|
|
ea210b6ed7 |
@@ -5,3 +5,10 @@ var ModelList = []string{
|
|||||||
"command-light", "command-light-nightly",
|
"command-light", "command-light-nightly",
|
||||||
"command-r", "command-r-plus",
|
"command-r", "command-r-plus",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
num := len(ModelList)
|
||||||
|
for i := 0; i < num; i++ {
|
||||||
|
ModelList = append(ModelList, ModelList[i]+"-internet")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -17,6 +17,10 @@ import (
|
|||||||
"github.com/songquanpeng/one-api/relay/model"
|
"github.com/songquanpeng/one-api/relay/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
WebSearchConnector = Connector{ID: "web-search"}
|
||||||
|
)
|
||||||
|
|
||||||
func stopReasonCohere2OpenAI(reason *string) string {
|
func stopReasonCohere2OpenAI(reason *string) string {
|
||||||
if reason == nil {
|
if reason == nil {
|
||||||
return ""
|
return ""
|
||||||
@@ -45,6 +49,10 @@ func ConvertRequest(textRequest model.GeneralOpenAIRequest) *Request {
|
|||||||
if cohereRequest.Model == "" {
|
if cohereRequest.Model == "" {
|
||||||
cohereRequest.Model = "command-r"
|
cohereRequest.Model = "command-r"
|
||||||
}
|
}
|
||||||
|
if strings.HasSuffix(cohereRequest.Model, "-internet") {
|
||||||
|
cohereRequest.Model = strings.TrimSuffix(cohereRequest.Model, "-internet")
|
||||||
|
cohereRequest.Connectors = append(cohereRequest.Connectors, WebSearchConnector)
|
||||||
|
}
|
||||||
for _, message := range textRequest.Messages {
|
for _, message := range textRequest.Messages {
|
||||||
if message.Role == "user" {
|
if message.Role == "user" {
|
||||||
cohereRequest.Message = message.Content.(string)
|
cohereRequest.Message = message.Content.(string)
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
package ollama
|
package ollama
|
||||||
|
|
||||||
var ModelList = []string{
|
var ModelList = []string{
|
||||||
|
"codellama:7b-instruct",
|
||||||
|
"llama2:7b",
|
||||||
|
"llama2:latest",
|
||||||
|
"llama3:latest",
|
||||||
|
"phi3:latest",
|
||||||
"qwen:0.5b-chat",
|
"qwen:0.5b-chat",
|
||||||
|
"qwen:7b",
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -228,6 +228,9 @@ func GetModelRatio(name string) float64 {
|
|||||||
if strings.HasPrefix(name, "qwen-") && strings.HasSuffix(name, "-internet") {
|
if strings.HasPrefix(name, "qwen-") && strings.HasSuffix(name, "-internet") {
|
||||||
name = strings.TrimSuffix(name, "-internet")
|
name = strings.TrimSuffix(name, "-internet")
|
||||||
}
|
}
|
||||||
|
if strings.HasPrefix(name, "command-") && strings.HasSuffix(name, "-internet") {
|
||||||
|
name = strings.TrimSuffix(name, "-internet")
|
||||||
|
}
|
||||||
ratio, ok := ModelRatio[name]
|
ratio, ok := ModelRatio[name]
|
||||||
if !ok {
|
if !ok {
|
||||||
ratio, ok = DefaultModelRatio[name]
|
ratio, ok = DefaultModelRatio[name]
|
||||||
|
|||||||
Reference in New Issue
Block a user