MCPcopy Create free account
hub / github.com/MiniMax-AI/Mini-Agent / demo_anthropic_provider

Function demo_anthropic_provider

examples/05_provider_selection.py:15–47  ·  view source on GitHub ↗

Demo using LLMClient with Anthropic provider.

()

Source from the content-addressed store, hash-verified

13
14
15async def demo_anthropic_provider():
16 """Demo using LLMClient with Anthropic provider."""
17 print("\n" + "=" * 60)
18 print("DEMO: LLMClient with Anthropic Provider")
19 print("=" * 60)
20
21 # Load config
22 config_path = Path("mini_agent/config/config.yaml")
23 with open(config_path, encoding="utf-8") as f:
24 config = yaml.safe_load(f)
25
26 # Initialize client with Anthropic provider
27 client = LLMClient(
28 api_key=config["api_key"],
29 provider=LLMProvider.ANTHROPIC, # Specify Anthropic provider
30 model=config.get("model", "MiniMax-M2.5"),
31 )
32
33 print(f"Provider: {client.provider}")
34 print(f"API Base: {client.api_base}")
35
36 # Simple question
37 messages = [Message(role="user", content="Say 'Hello from Anthropic!'")]
38 print(f"\n👤 User: {messages[0].content}")
39
40 try:
41 response = await client.generate(messages)
42 if response.thinking:
43 print(f"💭 Thinking: {response.thinking}")
44 print(f"💬 Model: {response.content}")
45 print("✅ Anthropic provider demo completed")
46 except Exception as e:
47 print(f"❌ Error: {e}")
48
49
50async def demo_openai_provider():

Callers 1

mainFunction · 0.85

Calls 4

generateMethod · 0.95
LLMClientClass · 0.90
MessageClass · 0.90
getMethod · 0.80

Tested by

no test coverage detected