Skip to content

Commit

Permalink
fix clear_history option and test
Browse files Browse the repository at this point in the history
  • Loading branch information
mbertrand committed Dec 19, 2024
1 parent 9c6202e commit a7cb6ad
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ai_agents/consumers.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def process_message(message_json, agent) -> str:
model = serializer.validated_data.pop("model", None)

if clear_history:
agent.agent.clear_chat_history()
agent.clear_chat_history()
if model:
agent.agent.agent_worker._llm.model = model # noqa: SLF001
if temperature:
Expand Down
3 changes: 3 additions & 0 deletions ai_agents/consumers_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ async def test_clear_history(mocker, clear_history, recommendation_consumer):
mock_clear = mocker.patch(
"ai_agents.consumers.RecommendationAgent.clear_chat_history"
)
mocker.patch(
"ai_agents.agents.RecommendationAgent.get_completion",
)
await recommendation_consumer.connect()
await recommendation_consumer.receive(
json.dumps({"clear_history": clear_history, "message": "hello"})
Expand Down

0 comments on commit a7cb6ad

Please sign in to comment.