Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
259f586ff7 | ||
|
|
d885b81f23 | ||
|
|
fe6bffd080 | ||
|
|
250f212fa3 |
@@ -1003,6 +1003,8 @@ func vertexBaseURL(location string) string {
|
|||||||
loc := strings.TrimSpace(location)
|
loc := strings.TrimSpace(location)
|
||||||
if loc == "" {
|
if loc == "" {
|
||||||
loc = "us-central1"
|
loc = "us-central1"
|
||||||
|
} else if loc == "global" {
|
||||||
|
return "https://aiplatform.googleapis.com"
|
||||||
}
|
}
|
||||||
return fmt.Sprintf("https://%s-aiplatform.googleapis.com", loc)
|
return fmt.Sprintf("https://%s-aiplatform.googleapis.com", loc)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ func ConvertClaudeRequestToAntigravity(modelName string, inputRawJSON []byte, _
|
|||||||
if signatureResult.Exists() && signatureResult.String() != "" {
|
if signatureResult.Exists() && signatureResult.String() != "" {
|
||||||
arrayClientSignatures := strings.SplitN(signatureResult.String(), "#", 2)
|
arrayClientSignatures := strings.SplitN(signatureResult.String(), "#", 2)
|
||||||
if len(arrayClientSignatures) == 2 {
|
if len(arrayClientSignatures) == 2 {
|
||||||
if modelName == arrayClientSignatures[0] {
|
if cache.GetModelGroup(modelName) == arrayClientSignatures[0] {
|
||||||
clientSignature = arrayClientSignatures[1]
|
clientSignature = arrayClientSignatures[1]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,12 @@ import (
|
|||||||
func ConvertOpenAIResponsesRequestToCodex(modelName string, inputRawJSON []byte, _ bool) []byte {
|
func ConvertOpenAIResponsesRequestToCodex(modelName string, inputRawJSON []byte, _ bool) []byte {
|
||||||
rawJSON := bytes.Clone(inputRawJSON)
|
rawJSON := bytes.Clone(inputRawJSON)
|
||||||
|
|
||||||
|
inputResult := gjson.GetBytes(rawJSON, "input")
|
||||||
|
if inputResult.Type == gjson.String {
|
||||||
|
input, _ := sjson.Set(`[{"type":"message","role":"user","content":[{"type":"input_text","text":""}]}]`, "0.content.0.text", inputResult.String())
|
||||||
|
rawJSON, _ = sjson.SetRawBytes(rawJSON, "input", []byte(input))
|
||||||
|
}
|
||||||
|
|
||||||
rawJSON, _ = sjson.SetBytes(rawJSON, "stream", true)
|
rawJSON, _ = sjson.SetBytes(rawJSON, "stream", true)
|
||||||
rawJSON, _ = sjson.SetBytes(rawJSON, "store", false)
|
rawJSON, _ = sjson.SetBytes(rawJSON, "store", false)
|
||||||
rawJSON, _ = sjson.SetBytes(rawJSON, "parallel_tool_calls", true)
|
rawJSON, _ = sjson.SetBytes(rawJSON, "parallel_tool_calls", true)
|
||||||
|
|||||||
@@ -68,6 +68,9 @@ func ConvertOpenAIResponsesRequestToOpenAIChatCompletions(modelName string, inpu
|
|||||||
case "message", "":
|
case "message", "":
|
||||||
// Handle regular message conversion
|
// Handle regular message conversion
|
||||||
role := item.Get("role").String()
|
role := item.Get("role").String()
|
||||||
|
if role == "developer" {
|
||||||
|
role = "user"
|
||||||
|
}
|
||||||
message := `{"role":"","content":""}`
|
message := `{"role":"","content":""}`
|
||||||
message, _ = sjson.Set(message, "role", role)
|
message, _ = sjson.Set(message, "role", role)
|
||||||
|
|
||||||
@@ -167,7 +170,8 @@ func ConvertOpenAIResponsesRequestToOpenAIChatCompletions(modelName string, inpu
|
|||||||
// Only function tools need structural conversion because Chat Completions nests details under "function".
|
// Only function tools need structural conversion because Chat Completions nests details under "function".
|
||||||
toolType := tool.Get("type").String()
|
toolType := tool.Get("type").String()
|
||||||
if toolType != "" && toolType != "function" && tool.IsObject() {
|
if toolType != "" && toolType != "function" && tool.IsObject() {
|
||||||
chatCompletionsTools = append(chatCompletionsTools, tool.Value())
|
// Almost all providers lack built-in tools, so we just ignore them.
|
||||||
|
// chatCompletionsTools = append(chatCompletionsTools, tool.Value())
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user