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

Function test_wrapper_anthropic_provider

tests/test_llm.py:14–57  ·  view source on GitHub ↗

Test LLM wrapper with Anthropic provider.

()

Source from the content-addressed store, hash-verified

12
13@pytest.mark.asyncio
14async def test_wrapper_anthropic_provider():
15 """Test LLM wrapper with Anthropic provider."""
16 print("\n=== Testing LLM Wrapper (Anthropic Provider) ===")
17
18 # Load config
19 config_path = Path("mini_agent/config/config.yaml")
20 with open(config_path, encoding="utf-8") as f:
21 config = yaml.safe_load(f)
22
23 # Create client with Anthropic provider
24 client = LLMClient(
25 api_key=config["api_key"],
26 provider=LLMProvider.ANTHROPIC,
27 api_base=config.get("api_base"),
28 model=config.get("model"),
29 )
30
31 assert client.provider == LLMProvider.ANTHROPIC
32
33 # Simple messages
34 messages = [
35 Message(role="system", content="You are a helpful assistant."),
36 Message(role="user", content="Say 'Hello, Mini Agent!' and nothing else."),
37 ]
38
39 try:
40 response = await client.generate(messages=messages)
41
42 print(f"Response: {response.content}")
43 print(f"Finish reason: {response.finish_reason}")
44
45 assert response.content, "Response content is empty"
46 assert "Hello" in response.content or "hello" in response.content, (
47 f"Response doesn't contain 'Hello': {response.content}"
48 )
49
50 print("✅ Anthropic provider test passed")
51 return True
52 except Exception as e:
53 print(f"❌ Anthropic provider test failed: {e}")
54 import traceback
55
56 traceback.print_exc()
57 return False
58
59
60@pytest.mark.asyncio

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