refactor: remove vendor-specific references from code and docs
Replace minimax-specific names in comments, tests, and README examples with generic placeholders. The XML tool call handling is provider-agnostic. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
0e8d31c0f6
commit
07bb13c062
6 changed files with 20 additions and 20 deletions
|
|
@ -630,14 +630,14 @@ HEARTBEAT_OK 応答 ユーザーが直接結果を受け取る
|
|||
"agents": {
|
||||
"defaults": {
|
||||
"provider": "vllm",
|
||||
"model": "MiniMax-M1-80k",
|
||||
"model": "your-model-name",
|
||||
"model_fallbacks": ["openai/gpt-4o", "anthropic/claude-sonnet-4-5-20250929"]
|
||||
}
|
||||
},
|
||||
"providers": {
|
||||
"vllm": {
|
||||
"api_key": "minimax-key",
|
||||
"api_base": "https://api.minimax.io/v1"
|
||||
"api_key": "your-vllm-key",
|
||||
"api_base": "https://api.example.com/v1"
|
||||
},
|
||||
"openai": {
|
||||
"auth_method": "oauth"
|
||||
|
|
|
|||
|
|
@ -698,14 +698,14 @@ This keeps the runtime lightweight while making new OpenAI-compatible backends m
|
|||
"agents": {
|
||||
"defaults": {
|
||||
"provider": "vllm",
|
||||
"model": "MiniMax-M1-80k",
|
||||
"model": "your-model-name",
|
||||
"model_fallbacks": ["openai/gpt-4o", "anthropic/claude-sonnet-4-5-20250929"]
|
||||
}
|
||||
},
|
||||
"providers": {
|
||||
"vllm": {
|
||||
"api_key": "minimax-key",
|
||||
"api_base": "https://api.minimax.io/v1"
|
||||
"api_key": "your-vllm-key",
|
||||
"api_base": "https://api.example.com/v1"
|
||||
},
|
||||
"openai": {
|
||||
"auth_method": "oauth"
|
||||
|
|
|
|||
|
|
@ -983,11 +983,11 @@ func TestFindMatchingBrace(t *testing.T) {
|
|||
// --- XML tool call extract/strip tests ---
|
||||
|
||||
func TestExtractXMLToolCalls_Single(t *testing.T) {
|
||||
text := `<minimax:toolcall>
|
||||
text := `<vendor:toolcall>
|
||||
<invoke name="exec">
|
||||
<parameter name="command">echo hello</parameter>
|
||||
</invoke>
|
||||
</minimax:toolcall>`
|
||||
</vendor:toolcall>`
|
||||
|
||||
calls := extractXMLToolCalls(text)
|
||||
if len(calls) != 1 {
|
||||
|
|
@ -1005,7 +1005,7 @@ func TestExtractXMLToolCalls_Single(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestExtractXMLToolCalls_Multiple(t *testing.T) {
|
||||
text := `<minimax:toolcall>
|
||||
text := `<vendor:toolcall>
|
||||
<invoke name="web_search">
|
||||
<parameter name="query">golang testing</parameter>
|
||||
</invoke>
|
||||
|
|
@ -1013,7 +1013,7 @@ func TestExtractXMLToolCalls_Multiple(t *testing.T) {
|
|||
<parameter name="command">go test ./...</parameter>
|
||||
<parameter name="timeout">30</parameter>
|
||||
</invoke>
|
||||
</minimax:toolcall>`
|
||||
</vendor:toolcall>`
|
||||
|
||||
calls := extractXMLToolCalls(text)
|
||||
if len(calls) != 2 {
|
||||
|
|
@ -1039,11 +1039,11 @@ func TestExtractXMLToolCalls_NoXML(t *testing.T) {
|
|||
|
||||
func TestStripXMLToolCalls(t *testing.T) {
|
||||
text := `Let me run that.
|
||||
<minimax:toolcall>
|
||||
<vendor:toolcall>
|
||||
<invoke name="exec">
|
||||
<parameter name="command">echo hello</parameter>
|
||||
</invoke>
|
||||
</minimax:toolcall>
|
||||
</vendor:toolcall>
|
||||
Done.`
|
||||
|
||||
got := stripXMLToolCalls(text)
|
||||
|
|
|
|||
|
|
@ -327,8 +327,8 @@ func TestCreateProviderByName_OpenAI_OAuth(t *testing.T) {
|
|||
|
||||
func TestCreateProviderByName_VLLM(t *testing.T) {
|
||||
cfg := config.DefaultConfig()
|
||||
cfg.Providers.VLLM.APIKey = "minimax-key"
|
||||
cfg.Providers.VLLM.APIBase = "https://api.minimax.io/v1"
|
||||
cfg.Providers.VLLM.APIKey = "test-vllm-key"
|
||||
cfg.Providers.VLLM.APIBase = "https://api.example.com/v1"
|
||||
|
||||
provider, err := CreateProviderByName(cfg, "vllm")
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ func (p *HTTPProvider) Chat(ctx context.Context, messages []Message, tools []Too
|
|||
return nil, err
|
||||
}
|
||||
// If provider returned no structured tool_calls but Content has XML
|
||||
// tool call blocks (e.g. minimax), parse them as a fallback.
|
||||
// tool call blocks (e.g. <ns:toolcall>), parse them as a fallback.
|
||||
if len(resp.ToolCalls) == 0 {
|
||||
if xmlCalls := extractXMLToolCalls(resp.Content); len(xmlCalls) > 0 {
|
||||
resp.ToolCalls = xmlCalls
|
||||
|
|
|
|||
|
|
@ -57,17 +57,17 @@ func extractToolCallsFromText(text string) []ToolCall {
|
|||
return result
|
||||
}
|
||||
|
||||
// extractXMLToolCalls parses XML tool call blocks (e.g. <minimax:toolcall>)
|
||||
// extractXMLToolCalls parses XML tool call blocks (e.g. <ns:toolcall>)
|
||||
// into structured ToolCall objects. Used as a fallback when the provider returns
|
||||
// tool calls as XML in Content but not in the structured tool_calls field.
|
||||
//
|
||||
// Expected format:
|
||||
//
|
||||
// <vendor:toolcall>
|
||||
// <ns:toolcall>
|
||||
// <invoke name="tool_name">
|
||||
// <parameter name="param">value</parameter>
|
||||
// </invoke>
|
||||
// </vendor:toolcall>
|
||||
// </ns:toolcall>
|
||||
func extractXMLToolCalls(text string) []ToolCall {
|
||||
var result []ToolCall
|
||||
remaining := text
|
||||
|
|
@ -173,7 +173,7 @@ func extractXMLToolCalls(text string) []ToolCall {
|
|||
return result
|
||||
}
|
||||
|
||||
// stripXMLToolCalls removes XML tool call blocks (e.g. <minimax:toolcall>...</minimax:toolcall>)
|
||||
// stripXMLToolCalls removes XML tool call blocks (e.g. <ns:toolcall>...</ns:toolcall>)
|
||||
// from response text. Some providers embed raw XML tool calls in Content alongside
|
||||
// structured tool_calls; this prevents them from leaking to users.
|
||||
func stripXMLToolCalls(text string) string {
|
||||
|
|
@ -187,7 +187,7 @@ func stripXMLToolCalls(text string) string {
|
|||
if tagStart == -1 {
|
||||
return text
|
||||
}
|
||||
// Extract namespace (e.g. "minimax" from "<minimax:toolcall>")
|
||||
// Extract namespace (e.g. "ns" from "<ns:toolcall>")
|
||||
ns := text[tagStart+1 : idx]
|
||||
closeTag := "</" + ns + ":toolcall>"
|
||||
closeIdx := strings.Index(text, closeTag)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue