-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest_client.py
More file actions
48 lines (41 loc) · 1.29 KB
/
test_client.py
File metadata and controls
48 lines (41 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import asyncio
from fastmcp import Client
client = Client("http://127.0.0.1:8888/mcp/")
available_tools = [
{
"name": "search_web",
"description": "Search the web for information",
"inputSchema": {
"type": "object",
"properties": {"query": {"type": "string", "description": "Search query"}},
"required": ["query"],
},
}
]
message_history = [
{"role": "user", "content": "Can you search for Python tutorials?"},
{
"role": "assistant",
"content": "I'll search for Python tutorials for you.",
"tool_calls": [
{
"id": "call_1",
"type": "function",
"function": {
"name": "search_web",
"arguments": '{"query": "Python tutorials"}',
},
}
],
},
]
async def test_evaluate_tool_call():
async with client:
result = await client.call_tool(
"evaluate_tool_call",
{"available_tools": available_tools, "message_history": message_history, "model_size": "7B"},
)
print("Evaluation Result: ", result)
print(f"Score: {result.data.score}")
print(f"Reason: {result.data.reason}")
asyncio.run(test_evaluate_tool_call())