Skip to content

Commit

Permalink
Added changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
cszsol committed Sep 27, 2024
1 parent 8bf1924 commit e004922
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added
- Update readme
- Extra multi agent unit tests

### Removed
- Github action to create the docs.
Expand Down
35 changes: 18 additions & 17 deletions tests/multi_agents/test_supervisor_multi_agent.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
from unittest.mock import MagicMock, AsyncMock
from unittest.mock import AsyncMock, MagicMock

import pytest
from langchain_core.language_models import GenericFakeChatModel
from langchain_core.messages import HumanMessage, SystemMessage

import pytest

from neuroagent.multi_agents.supervisor_multi_agent import AgentState

from src.neuroagent.multi_agents import SupervisorMultiAgent


Expand All @@ -14,11 +13,9 @@ def test_create_main_agent():
bind_function_result = MagicMock()
bind_function_result.__ror__.return_value = {}
mock_llm.bind_functions.return_value = bind_function_result
data = {
"llm": mock_llm,
"agents": [("agent1",)]
}
data = {"llm": mock_llm, "agents": [("agent1",)]}
from src.neuroagent.multi_agents import SupervisorMultiAgent

result = SupervisorMultiAgent.create_main_agent(data)
assert "main_agent" in result
assert "summarizer" in result
Expand All @@ -32,17 +29,16 @@ async def test_agent_node():
)

async def mock_ainvoke(_):
return {
"messages": [
mock_message
]
}
return {"messages": [mock_message]}

agent_state = MagicMock()
agent = MagicMock()
agent.ainvoke = mock_ainvoke
from src.neuroagent.multi_agents import SupervisorMultiAgent
agent_node_test = await SupervisorMultiAgent.agent_node(agent_state, agent, "test_agent")

agent_node_test = await SupervisorMultiAgent.agent_node(
agent_state, agent, "test_agent"
)

assert isinstance(agent_node_test, dict)
assert "messages" in agent_node_test
Expand All @@ -61,9 +57,14 @@ def bind_tools(self, functions: list):
def bind_functions(self, **kwargs):
return self


fake_state = AgentState(messages=[HumanMessage(content="What is the airspeed velocity of an unladen swallow?"),
SystemMessage(content="11 m/s")])
fake_state = AgentState(
messages=[
HumanMessage(
content="What is the airspeed velocity of an unladen swallow?"
),
SystemMessage(content="11 m/s"),
]
)

mock_llm = FakeChatModel(messages=iter([]))
agent = SupervisorMultiAgent(agents=[("agent1", [])], llm=mock_llm)
Expand Down

0 comments on commit e004922

Please sign in to comment.