uAgents
uAgents copied to clipboard
In send_and_receive, if two models have the same fields the result will be indistinguishable
trafficstars
Prerequisites
- [x] I checked the documentation and found no answer to my problem
- [x] I checked the existing issues and made sure there are no similar bug reports
Category
Bug (unexpected behavior)
Expected Behavior
class Response_A(Model):
text: str
class Response_B(Model):
text: str
...
response_model, status = await ctx.send_and_receive(
destination=agent_address,
message=Request(),
response_type={Response_A, Response_B},
)
Given the aforementioned code, I expect response_model to be the correct model that the responding agent was sending.
Observed Behavior
response_model is indeed the wrong model and that is because we only parse the body of the message and associate the result with whatever model "fits" the given body.
Changing this requires adding the digest into the equation or passing some other metadata along the internal dispatcher module.
To Reproduce
- Set up two agents (A, B)
- Set up three messages (Request, Response_A, Response_B)
- Make both response models have the same structure
- execute
await ctx.send_and_receive()and compare the result
Version
v0.22.1
Environment Details (Optional)
Failure Logs (Optional)
Additional Information (Optional)