Feat: Implement belief collector #14

Merged
8464960 merged 6 commits from feat/belief-collector into dev 2025-10-29 14:38:52 +00:00
3 changed files with 6 additions and 6 deletions
Showing only changes of commit baeef6142d - Show all commits

View File

@@ -62,7 +62,7 @@ class ContinuousBeliefCollector(CyclicBehaviour):
Expected payload: Expected payload:
{ {
"type": "belief_extraction_text", "type": "belief_extraction_text",
"beliefs": {"user_said": [["hello","test"],["Can you help me?"],["stop talking to me"],["No"],["Pepper do a dance"]]} "beliefs": {"user_said": ["hello"","Can you help me?","stop talking to me","No","Pepper do a dance"]}
} }
@@ -82,9 +82,9 @@ class ContinuousBeliefCollector(CyclicBehaviour):
return return
logger.info("BeliefCollector: forwarding %d beliefs.", len(beliefs)) logger.info("BeliefCollector: forwarding %d beliefs.", len(beliefs))
for belief_name, belief_lists in beliefs.items(): for belief_name, belief_list in beliefs.items():
for args in belief_lists: for belief in belief_list:
logger.info(" - %s %s", belief_name, " ".join(map(str, args))) logger.info(" - %s %s", belief_name,str(belief))
await self._send_beliefs_to_bdi(beliefs, origin=origin) await self._send_beliefs_to_bdi(beliefs, origin=origin)

View File

@@ -12,7 +12,7 @@ class BeliefTextAgent(Agent):
# Send multiple beliefs in one JSON payload # Send multiple beliefs in one JSON payload
payload = { payload = {
"type": "belief_extraction_text", "type": "belief_extraction_text",
"beliefs": {"user_said": [["hello test"],["Can you help me?"],["stop talking to me"],["No"],["Pepper do a dance"]]} "beliefs": {"user_said": ["hello test","Can you help me?","stop talking to me","No","Pepper do a dance"]}
} }
msg = Message(to=to_jid) msg = Message(to=to_jid)

View File

@@ -155,7 +155,7 @@ async def test_belief_text_values_not_lists(continuous_collector, mocker):
async def test_belief_text_happy_path_logs_items_and_sends(continuous_collector, mocker): async def test_belief_text_happy_path_logs_items_and_sends(continuous_collector, mocker):
payload = { payload = {
"type": "belief_extraction_text", "type": "belief_extraction_text",
"beliefs": {"user_said": [["hello", "test"], ["No"]]} "beliefs": {"user_said": ["hello test", "No"]}
} }
# Your code calls self.send(..); patch it (or switch implementation to self.agent.send and patch that) # Your code calls self.send(..); patch it (or switch implementation to self.agent.send and patch that)
continuous_collector.send = AsyncMock() continuous_collector.send = AsyncMock()