(self)
| 53 | self.assertEqual(msgs[1]["role"], "assistant") |
| 54 | |
| 55 | def test_truncation(self): |
| 56 | config = Config(max_context_messages=5) |
| 57 | ctx = ConversationContext(config=config) |
| 58 | for i in range(10): |
| 59 | ctx.add_user_message(f"msg {i}") |
| 60 | msgs = ctx.get_api_messages() |
| 61 | self.assertLessEqual(len(msgs), 5) |
| 62 | # First message should be preserved |
| 63 | self.assertEqual(msgs[0]["content"], "msg 0") |
| 64 | |
| 65 | def test_system_prompt(self): |
| 66 | ctx = ConversationContext(config=Config()) |
nothing calls this directly
no test coverage detected