| 36 | |
| 37 | |
| 38 | class 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> |
| 59 | final_answer('This is the final answer.') |
| 60 | </code>""", |
| 61 | token_usage=TokenUsage(input_tokens=10, output_tokens=20), |
| 62 | ) |
| 63 | |
| 64 | |
| 65 | class MonitoringTester(unittest.TestCase): |
no outgoing calls
searching dependent graphs…