MCPcopy Create free account
hub / github.com/antirez/llama.cpp-deepseek-v4-flash / test_tool_call

Function test_tool_call

scripts/server-test-model.py:134–180  ·  view source on GitHub ↗
(url, stream)

Source from the content-addressed store, hash-verified

132
133
134def test_tool_call(url, stream):
135 logger.info(f"\n=== Testing Tool Call (Stream={stream}) ===\n")
136 messages = [
137 {
138 "role": "user",
139 "content": "What is the weather in London? Please use the get_weather tool.",
140 }
141 ]
142 tools = [
143 {
144 "type": "function",
145 "function": {
146 "name": "get_weather",
147 "description": "Get the current weather in a given location",
148 "parameters": {
149 "type": "object",
150 "properties": {
151 "location": {
152 "type": "string",
153 "description": "The city and state, e.g. San Francisco, CA",
154 },
155 "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]},
156 },
157 "required": ["location"],
158 },
159 },
160 }
161 ]
162
163 result = run_query(url, messages, tools=tools, tool_choice="auto", stream=stream)
164
165 if result:
166 tcs = result.get("tool_calls")
167 if tcs and len(tcs) > 0:
168 logger.info("PASS: Tool calls detected.")
169 for tc in tcs:
170 func = tc.get("function", {})
171 logger.info(f" Tool: {func.get('name')}, Args: {func.get('arguments')}\n")
172 else:
173 logger.info(f"FAIL: No tool calls. Content: {result['content']}\n")
174
175 if result.get("reasoning_content"):
176 logger.info(
177 f"INFO: Reasoning content detected during tool call ({len(result['reasoning_content'])} chars).\n"
178 )
179 else:
180 logger.info("FAIL: Query failed.\n")
181
182
183def main():

Callers 1

mainFunction · 0.85

Calls 2

run_queryFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected