MCPcopy
hub / github.com/huggingface/smolagents / FakeLLMModel

Class FakeLLMModel

tests/test_monitoring.py:38–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36
37
38class FakeLLMModel(Model):
39 def generate(self, prompt, tools_to_call_from=None, **kwargs):
40 if tools_to_call_from is not None:
41 return ChatMessage(
42 role=MessageRole.ASSISTANT,
43 content="I will call the final_answer tool.",
44 tool_calls=[
45 ChatMessageToolCall(
46 id="fake_id",
47 type="function",
48 function=ChatMessageToolCallFunction(
49 name="final_answer", arguments={"answer": "This is the final answer."}
50 ),
51 )
52 ],
53 token_usage=TokenUsage(input_tokens=10, output_tokens=20),
54 )
55 else:
56 return ChatMessage(
57 role=MessageRole.ASSISTANT,
58 content="""<code>
59final_answer('This is the final answer.')
60</code>""",
61 token_usage=TokenUsage(input_tokens=10, output_tokens=20),
62 )
63
64
65class MonitoringTester(unittest.TestCase):

Callers 2

test_code_agent_metricsFunction · 0.70

Calls

no outgoing calls

Tested by 2

test_code_agent_metricsFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…