Skip to content

Build and run agents you can see, understand and trust.

fix(tracing): report the MiniMax provider name on chat spans (#3023)

Ziyang Guoe4c59dcaaa52
diff --git a/src/agentscope/middleware/_tracing/_attributes.py b/src/agentscope/middleware/_tracing/_attributes.py
index 26992cfcb..f9d06a2e1 100644
--- a/src/agentscope/middleware/_tracing/_attributes.py
+++ b/src/agentscope/middleware/_tracing/_attributes.py
@@ -189,6 +189,9 @@ class ProviderNameValues:
MOONSHOT = "moonshot"
"""The moonshot provider name."""
+ MINIMAX = "minimax"
+ """The MiniMax provider name."""
+
VOLCENGINE = "volcengine"
"""The Volcengine provider name."""
diff --git a/src/agentscope/middleware/_tracing/_extractor.py b/src/agentscope/middleware/_tracing/_extractor.py
index a46b5b8e2..96ad84c61 100644
--- a/src/agentscope/middleware/_tracing/_extractor.py
+++ b/src/agentscope/middleware/_tracing/_extractor.py
@@ -31,6 +31,7 @@ _CLASS_NAME_MAP = {
"deepseek": ProviderNameValues.DEEPSEEK,
"xai": ProviderNameValues.XAI,
"moonshot": ProviderNameValues.MOONSHOT,
+ "minimax": ProviderNameValues.MINIMAX,
"volcengine": ProviderNameValues.VOLCENGINE,
}
diff --git a/tests/tracing_test.py b/tests/tracing_test.py
index 89301a35d..5d51a3ca4 100644
--- a/tests/tracing_test.py
+++ b/tests/tracing_test.py
@@ -16,7 +16,11 @@ from opentelemetry.sdk.trace.export.in_memory_span_exporter import (
from utils import MockModel
from agentscope.agent import Agent, InjectionConfig
-from agentscope.credential import OpenAICredential, VolcengineCredential
+from agentscope.credential import (
+ MiniMaxCredential,
+ OpenAICredential,
+ VolcengineCredential,
+)
from agentscope.event import (
ConfirmResult,
ExternalExecutionResultEvent,
@@ -40,6 +44,7 @@ from agentscope.model import (
ChatResponse,
ChatUsage,
FinishedReason,
+ MiniMaxChatModel,
OpenAIChatModel,
VolcengineChatModel,
)
@@ -162,6 +167,17 @@ class TracingExtractorTest(TestCase):
self.assertEqual(_get_provider_name(model), "volcengine")
+ def test_minimax_provider_name_from_model_class(self) -> None:
+ """MiniMax models should use the MiniMax provider name, not
+ ``unknown`` — MiniMax subclasses the Anthropic model, so its class
+ name is the only thing that identifies it."""
+ model = MiniMaxChatModel(
+ credential=MiniMaxCredential(api_key="test"),
+ model="abab6.5s-chat",
+ )
+
+ self.assertEqual(_get_provider_name(model), "minimax")
+
def test_volcengine_provider_name_from_openai_base_url(self) -> None:
"""Ark's OpenAI-compatible endpoint should map to Volcengine."""
model = OpenAIChatModel(