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