-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Aegis structure message #6289
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
Aegis structure message #6289
Conversation
…icrosoft#6260) <!-- Thank you for your contribution! Please review https://microsoft.github.io/autogen/docs/Contribute before opening a pull request. --> <!-- Please add a reviewer to the assignee section when you create a PR. If you don't have the access to it, we will shortly find a reviewer and assign them to your PR. --> ## Why are these changes needed? `IncludeEnum` was removed in ChromaDB when it was updated to `1.0.0`. This caused issues when using `ChromaDBVectorMemory`. This PR fixes those issues ## Related issue number Closes microsoft#6241 ## Checks - [x] I've included any doc changes needed for <https://microsoft.github.io/autogen/>. See <https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to build and test documentation locally. - [x] I've added tests (if relevant) corresponding to the changes introduced in this PR. - [x] I've made sure all auto checks have passed. --------- Co-authored-by: Victor Dibia <[email protected]>
Closes microsoft#6265 Convert the `Message` and `Resource` dataclasses to Pydantic models in the `llamaindex-agent` cookbook. * Replace `dataclass` with `BaseModel` for `Message` and `Resource` classes. * Update imports to use `BaseModel` from `pydantic` Co-authored-by: Victor Dibia <[email protected]>
<!-- Thank you for your contribution! Please review https://microsoft.github.io/autogen/docs/Contribute before opening a pull request. --> <!-- Please add a reviewer to the assignee section when you create a PR. If you don't have the access to it, we will shortly find a reviewer and assign them to your PR. --> ## Why are these changes needed? <!-- Please give a short summary of the change and the problem this solves. --> ## Related issue number <!-- For example: "Closes microsoft#1234" --> ## Checks - [x] I've included any doc changes needed for <https://microsoft.github.io/autogen/>. See <https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to build and test documentation locally. - [x] I've added tests (if relevant) corresponding to the changes introduced in this PR. - [x] I've made sure all auto checks have passed. Signed-off-by: zhanluxianshen <[email protected]> Co-authored-by: Victor Dibia <[email protected]>
<!-- Thank you for your contribution! Please review https://microsoft.github.io/autogen/docs/Contribute before opening a pull request. --> <!-- Please add a reviewer to the assignee section when you create a PR. If you don't have the access to it, we will shortly find a reviewer and assign them to your PR. --> An app can pass untyped dicts to set configuration options of various Task-Centric Memory classes. But tools like pyright can complain about the loose typing. This PR exposes 4 TypedDict classes that apps can optionally use. <!-- Please give a short summary of the change and the problem this solves. --> ## Related issue number <!-- For example: "Closes microsoft#1234" --> ## Checks - [x] I've included any doc changes needed for <https://microsoft.github.io/autogen/>. See <https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to build and test documentation locally. - [x] I've added tests (if relevant) corresponding to the changes introduced in this PR. - [ ] I've made sure all auto checks have passed.
adding email agent ## Why are these changes needed? This PR introduces an AI-powered email assistant that can generate images, attach files, draft reports, and send emails to multiple recipients or specific users based on their queries. This feature is highly beneficial for customer management and email marketing, enhancing automation and improving efficiency. ## Related issue number Open microsoft#6228 ## Checks - [x] I've included any doc changes needed for <https://microsoft.github.io/autogen/>. See <https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to build and test documentation locally. - [x] I've added tests (if relevant) corresponding to the changes introduced in this PR. - [x] I've made sure all auto checks have passed.
python/packages/autogen-agentchat/src/autogen_agentchat/messages.py
Outdated
Show resolved
Hide resolved
python/packages/autogen-agentchat/src/autogen_agentchat/messages.py
Outdated
Show resolved
Hide resolved
python/packages/autogen-core/src/autogen_core/utils/_json_to_pydantic.py
Outdated
Show resolved
Hide resolved
…ixing typing strings
…nt and load_component
The StructuredMessageFactory code is largely hidden from the User and is taken care of automatically in the background. So this code below works out of the box with the user not being aware of how the StructuredMessageComponent is being serialized and deserialized in the background. Notice how in the code below we can run the dump_component/load_component and it seems to work fine for me: from pydantic import BaseModel, ValidationError
from typing import Literal
from autogen_agentchat.agents import AssistantAgent
from autogen_agentchat.base import TaskResult
from autogen_agentchat.conditions import TextMentionTermination
from autogen_agentchat.teams import RoundRobinGroupChat
from autogen_agentchat.ui import Console
from autogen_ext.models.openai import OpenAIChatCompletionClient
# Create an OpenAI model client.
model_client = OpenAIChatCompletionClient(
model="gpt-4o-2024-08-06",
)
class Critique(BaseModel):
score: int
review: str
approved: Literal["APPROVE", "REJECT"]
# Create the primary agent.
primary_agent = AssistantAgent(
"primary",
model_client=model_client,
system_message="You are a helpful AI assistant.",
)
format_string = "Score: {score}/10\nReview: {review},\n Approved: {approved}"
# Create the critic agent.
critic_agent = AssistantAgent(
"critic",
model_client=model_client,
system_message="Provide constructive feedback with a score, review and approved or not in json fromat. Respond with approved:"APPROVED" when your feedbacks are addressed.",
output_content_type=Critique,
format_string=format_string,
)
# Define a termination condition that stops the task if the critic approves.
text_termination = TextMentionTermination("APPROVE")
# Create a team with the primary and critic agents.
team = RoundRobinGroupChat([primary_agent, critic_agent], termination_condition=text_termination, max_turns=10)
config = team.dump_component()
loaded_team = RoundRobinGroupChat.load_component(config)
async def main() -> None:
await Console(loaded_team.run_stream(task="tell me a poem")) |
python/packages/autogen-agentchat/src/autogen_agentchat/agents/_assistant_agent.py
Outdated
Show resolved
Hide resolved
python/packages/autogen-agentchat/src/autogen_agentchat/teams/_group_chat/_base_group_chat.py
Show resolved
Hide resolved
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.
Looks great! I think we still need to fix various CI errors.
You may need to change your local uv
version to 0.5.18.
uv self update 0.5.18
And then run uv sync --all-extras
to fix the uv.lock
file or revert it to the main version.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6289 +/- ##
==========================================
+ Coverage 77.24% 77.48% +0.23%
==========================================
Files 200 202 +2
Lines 14473 14717 +244
==========================================
+ Hits 11180 11403 +223
- Misses 3293 3314 +21
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Why are these changes needed?
Related issue number
Checks
Added support for structured message component using the Json to Pydantic utility functions. Note: also adding the ability to use a format string for structured messages.