fix: beliefs now adhere to expected format

[
    -before user_said belief was a list of lists of strings, now it's a list of strings
]

[ref]: N25B-206
This commit is contained in:
Pim Hutting
2025-10-29 11:20:20 +01:00
parent f8dee6d878
commit baeef6142d
3 changed files with 6 additions and 6 deletions

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()