-
Notifications
You must be signed in to change notification settings - Fork 23
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
Transform to add an agent's name into the message content #4
Conversation
Thanks. Could you include the code snippet in "how it works" in docstr and a test? |
assert isinstance(position, str) and position is not None | ||
assert position in ["start", "end"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we just combine these checks.
assert isinstance(position, str) and position is not None | |
assert position in ["start", "end"] | |
assert isinstance(position, str) and position in ["start", "end"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll just check that None
is handled correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, None
handled okay in both cases, thanks - will change
assert isinstance(format_string, str) and format_string is not None | ||
assert "{name}" in format_string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert isinstance(format_string, str) and format_string is not None | |
assert "{name}" in format_string | |
assert isinstance(format_string, str) and "{name}" in format_string |
@marklysze , ive also noticed, gpt-4o-mini doesnt support |
This was noted in another issue, do you have a code sample? I couldn't replicate an issue with name included. |
Thanks @sonichi, I've added the code snipped to the class docstring. For the tests, the test_transforms.py has a number of tests for including the name related to position and filtering. Was there some you thought were missing? Reference |
A note: use of this transform is included in website doc changes in PR #2 |
Co-authored-by: Kosta Petan <Kosta.Petan@microsoft.com>
* fix dotnet distributed tracing * regenerate protos for python
The recent addition of non-OpenAI client classes has expanded the utility of AutoGen to a lot of different models through other cloud providers as well as the ability to run it with local LLMs.
However, the
name
field on each message is removed as only OpenAI can accept and utilise that field.This means that functionality, like the GroupChat's select speaker, isn't as effective as the LLM may not be able to determine which 'agent' belongs to each message.
This PR introduces a transform that can add an agent's name to the start or end of message's text content. As this is a transform, it isn't permanent and doesn't change the original message.
How it works:
Documentation to be done.
Dependency
For the GroupChat select speaker to be able to utilise this, PR microsoft#2719 needs to be merged first.
Why are these changes needed?
To provide the necessary name context for non-OpenAI inference.
Related issue number
Checks
(3334)