Skip to content

In send_and_receive, if two models have the same fields the result will be indistinguishable #673

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
2 tasks done
Archento opened this issue Apr 1, 2025 · 0 comments
Open
2 tasks done
Assignees

Comments

@Archento
Copy link
Member

Archento commented Apr 1, 2025

Prerequisites

  • I checked the documentation and found no answer to my problem
  • 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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants