-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Clean qualcoder branch fix #6924
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
tejas-dharani
wants to merge
262
commits into
microsoft:gagb/qualcoder
Choose a base branch
from
tejas-dharani:clean-qualcoder-fix
base: gagb/qualcoder
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Clean qualcoder branch fix #6924
tejas-dharani
wants to merge
262
commits into
microsoft:gagb/qualcoder
from
tejas-dharani:clean-qualcoder-fix
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: zhanluxianshen <[email protected]> Co-authored-by: Eric Zhu <[email protected]>
Signed-off-by: zhanluxianshen <[email protected]> Co-authored-by: Eric Zhu <[email protected]>
## Why are these changes needed? Following the [guide instructions](https://microsoft.github.io/autogen/stable//user-guide/autogenstudio-user-guide/installation.html#a-install-from-source-manually) the user will execute the commands in the wrong directory. ## Related issue number Closes microsoft#6165
…t#6162) Upgrade `mcp` package version to >=1.6.0 to avoid bugs causing hanging when using mcp_server_featch.
…osoft#6143) ## Why are these changes needed? Changed default working directory of code executors, from the current directory `"."` to Python's [`tempfile`](https://docs.python.org/3/library/tempfile.html#tempfile.TemporaryDirectory). These changes simplify file cleanup and prevent the model from accessing code files or other sensitive data that should not be accessible. These changes simplify file cleanup and prevent the model from accessing code files or other sensitive data that should not be accessible. Changes made: - The default `work_dir` parameter in code executors is changed to `None`; when invoking the `start()` method, if not `work_dir` was specified (`None`) a temporary directory is created. - The `start()` and `stop()` methods of code executors handle the creation and cleanup of the working directory, for the default temporary directory. - For maintaining backward compatibility: - A `DeprecationWarning` is emitted when the current dir, `"."`, is used as `work_dir` as it is in the current code executor implementation. The deprecation warning is tested in `test_deprecated_warning()`. - For existing implementation that do not call the `start()` method and do not specify a `work_dir`, the executors will continue using the current directory `"."` as the working directory, mantaining backward compatibility. - Updated test suites: - Added tests to confirm that by default code executors use a temporary directory as their working directory: `test_default_work_dir_is_temp()`; - Implemented test to ensure that a `DeprecationWarning` is raised when the current directory is used as the default directory: `test_deprecated_warning()`; - Added tests to ensure that errors arise when invalid paths (doesn't exist or user has not the right permissions) are provided: `test_error_wrong_path()`. Feel free to suggest any additions or improvements! ## Related issue number Close microsoft#6041 ## 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: Eric Zhu <[email protected]>
…6071) Resolves microsoft#5934 This PR adds ability for `AssistantAgent` to generate a `StructuredMessage[T]` where `T` is the content type in base model. How to use? ```python from typing import Literal from pydantic import BaseModel from autogen_agentchat.agents import AssistantAgent from autogen_ext.models.openai import OpenAIChatCompletionClient from autogen_agentchat.ui import Console # The response format for the agent as a Pydantic base model. class AgentResponse(BaseModel): thoughts: str response: Literal["happy", "sad", "neutral"] # Create an agent that uses the OpenAI GPT-4o model which supports structured output. model_client = OpenAIChatCompletionClient(model="gpt-4o") agent = AssistantAgent( "assistant", model_client=model_client, system_message="Categorize the input as happy, sad, or neutral following the JSON format.", # Setting the output format to AgentResponse to force the agent to produce a JSON string as response. output_content_type=AgentResponse, ) result = await Console(agent.run_stream(task="I am happy.")) # Check the last message in the result, validate its type, and print the thoughts and response. assert isinstance(result.messages[-1], StructuredMessage) assert isinstance(result.messages[-1].content, AgentResponse) print("Thought: ", result.messages[-1].content.thoughts) print("Response: ", result.messages[-1].content.response) await model_client.close() ``` ``` ---------- user ---------- I am happy. ---------- assistant ---------- { "thoughts": "The user explicitly states they are happy.", "response": "happy" } Thought: The user explicitly states they are happy. Response: happy ``` --------- Co-authored-by: Victor Dibia <[email protected]>
Resolves microsoft#5851 * Added GroupChatError event type and terminate a run when an error occurs in either a participant or the group chat manager * Raise a RuntimeError from the error message within the group chat run
…tent (microsoft#6168) ## Why are these changes needed? This PR fixes a `400 - invalid_request_error` that occurs when using Anthropic models and the **final message is from the assistant and ends with trailing whitespace**. Example error: ``` Error code: 400 - {'error': {'code': 'invalid_request_error', 'message': 'messages: final assistant content cannot end with trailing whitespace', ...}} ``` To unblock ongoing internal usage, this patch introduces an **ad-hoc fix** that strips trailing whitespace if the model is Anthropic and the last message is from the assistant. ## Related issue number Ad-hoc fix for issue discussed here: microsoft#6167 Follow-up structural proposal here: microsoft#6167 microsoft#6167 (comment)
The initializer for ACADynamicSessionsCodeExecutor creates a new GUID to use as the session ID for dynamic sessions. In some scenarios it is desirable to be able to re-create the agent group chat from saved state. In this case, the ACADynamicSessionsCodeExecutor needs to be associated with a previous instance (so that any execution state is still valid) This PR adds a new argument to the initializer to allow a session ID to be passed in (defaulting to the current behaviour of creating a GUID if absent). Closes microsoft#6119 --------- Co-authored-by: Eric Zhu <[email protected]>
… Mistral (microsoft#6158) This PR improves how model_family is resolved when selecting a transformer from the registry. Previously, model families were inferred using a simple prefix-based match like: ``` if model.startswith(family): ... ``` This works for cleanly prefixed models (e.g., `gpt-4o`, `claude-3`) but fails for models like `mistral-large-latest`, `codestral-latest`, etc., where prefix-based matching is ambiguous or misleading. To address this: • model_family can now be passed explicitly (e.g., via ModelInfo) • _find_model_family() is only used as a fallback when the value is "unknown" • Transformer lookup is now more robust and predictable • Example integration in to_oai_type() demonstrates this pattern using self._model_info["family"] This change is required for safe support of models like Mistral and other future models that do not follow standard naming conventions. Linked to discussion in [microsoft#6151](microsoft#6151) Related : microsoft#6011 --------- Co-authored-by: Eric Zhu <[email protected]>
Just simple change. ```python messages: List[LLMMessage] = [UserMessage(content="Call the pass tool with input 'task'", source="user")] ``` to ```python messages: List[LLMMessage] = [UserMessage(content="Call the pass tool with input 'task' and talk result", source="user")] ``` And, now. Anthropic model could pass that test case `test_model_client_with_function_calling`. -> Yup. Before, claude could not pass that test case. With this change, Claude (Anthropic) models are now able to pass the test case successfully. Before this fix, Claude failed to interpret the intent correctly. Now, it can infer both tool usage and follow-up generation. This change is backward-compatible with other models (e.g., GPT-4) and improves cross-model consistency for function-calling tests.
# Azure AI Search Tool Implementation This PR adds a new tool for Azure AI Search integration to autogen-ext, enabling agents to search and retrieve information from Azure AI Search indexes. ## Why Are These Changes Needed? AutoGen currently lacks native integration with Azure AI Search, which is a powerful enterprise search service that supports semantic, vector, and hybrid search capabilities. This integration enables agents to: 1. Retrieve relevant information from large document collections 2. Perform semantic search with AI-powered ranking 3. Execute vector similarity search using embeddings 4. Combine text and vector approaches for optimal results This tool complements existing retrieval capabilities and provides a seamless way to integrate with Azure's search infrastructure. ## Features - **Multiple Search Types**: Support for text, semantic, vector, and hybrid search - **Flexible Configuration**: Customizable search parameters and fields - **Robust Error Handling**: User-friendly error messages with actionable guidance - **Performance Optimizations**: Configurable caching and retry mechanisms - **Vector Search Support**: Built-in embedding generation with extensibility ## Usage Example ```python from autogen_ext.tools.azure import AzureAISearchTool from azure.core.credentials import AzureKeyCredential from autogen import AssistantAgent, UserProxyAgent # Create the search tool search_tool = AzureAISearchTool.load_component({ "provider": "autogen_ext.tools.azure.AzureAISearchTool", "config": { "name": "DocumentSearch", "description": "Search for information in the knowledge base", "endpoint": "https://your-service.search.windows.net", "index_name": "your-index", "credential": {"api_key": "your-api-key"}, "query_type": "semantic", "semantic_config_name": "default" } }) # Create an agent with the search tool assistant = AssistantAgent( "assistant", llm_config={"tools": [search_tool]} ) # Create a user proxy agent user_proxy = UserProxyAgent( "user_proxy", human_input_mode="TERMINATE", max_consecutive_auto_reply=10, code_execution_config={"work_dir": "coding"} ) # Start the conversation user_proxy.initiate_chat( assistant, message="What information do we have about quantum computing in our knowledge base?" ) ``` ## Testing - Added unit tests for all search types (text, semantic, vector, hybrid) - Added tests for error handling and cancellation - All tests pass locally ## Documentation - Added comprehensive docstrings with examples - Included warnings about placeholder embedding implementation - Added links to Azure AI Search documentation ## Related issue number Closes microsoft#5419 ## 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: Eric Zhu <[email protected]>
…crosoft#6135) Messages sent as part of `LLMCallEvent` for Anthropic were not fully serializable The example below shows TextBlock and ToolUseBlocks inside the content of messages - these throw downsteam errors in apps like AGS (or event sinks) that expect serializable dicts inside the LLMCallEvent. ``` [ {'role': 'user', 'content': 'What is the weather in New York?'}, {'role': 'assistant', 'content': [TextBlock(citations=None, text='I can help you find the weather in New York. Let me check that for you.', type='text'), ToolUseBlock(id='toolu_016W8g55GejYGBzRRrcsnt7M', input={'city': 'New York'}, name='get_weather', type='tool_use')]}, {'role': 'user', 'content': [{'type': 'tool_result', 'tool_use_id': 'toolu_016W8g55GejYGBzRRrcsnt7M', 'content': 'The weather in New York is 73 degrees and Sunny.'}]} ] ``` This PR attempts to first serialize content of anthropic messages before they are passed to `LLMCallEvent` ``` [ {'role': 'user', 'content': 'What is the weather in New York?'}, {'role': 'assistant', 'content': [{'citations': None, 'text': 'I can help you find the weather in New York. Let me check that for you.', 'type': 'text'}, {'id': 'toolu_016W8g55GejYGBzRRrcsnt7M', 'input': {'city': 'New York'}, 'name': 'get_weather', 'type': 'tool_use'}]}, {'role': 'user', 'content': [{'type': 'tool_result', 'tool_use_id': 'toolu_016W8g55GejYGBzRRrcsnt7M', 'content': 'The weather in New York is 73 degrees and Sunny.'}]} ] ```
Fix a bug that caused tool calls to be truncated in OllamaChatCompletionClient when streaming is on.
…entStudio (microsoft#6204) This PR defines the missing `LLMCallEventMessage` class to resolve an instantiation error that occurs when using custom messages (e.g., via AgentStudio). > **Discord Report** > சravanaன் — 오후 6:40 > _“i updated agentchat and agentcore and tried running the config from agentstudio and it is now not running the agent and is throwing error `TypeError: Can't instantiate abstract class LLMCallEventMessage with abstract methods to_model_message, to_model_text, to_text`”_ The issue stems from `LLMCallEventMessage` being an abstract class that lacks required methods from `BaseChatMessage`. This PR implements the missing methods. Since `LLMCallEventMessage` is intended for **logging/UI use only**, and not to be sent to LLMs, the `to_model_message()` method raises `NotImplementedError` by design. ## Related issue number Reported in Discord Closes microsoft#6206
Signed-off-by: zhanluxianshen <[email protected]> Co-authored-by: Eric Zhu <[email protected]>
Please refer to microsoft#6123 for full context. That issue outlines several design and behavioral problems with `SocietyOfMindAgent`. This DRAFT PR focuses on resolving the most critical and broken behaviors first. Here is the error list 🔍 SocietyOfMindAgent: Design Issues and Historical Comparison (v0.2 vs v0.4+) ### ✅ P1–P4 Regression Issue Table (Updated with Fixes in PR microsoft#6142) | ID | Description | Current v0.4+ Issue | Resolution in PR microsoft#6142 | Was it a problem in v0.2? | Notes | |-----|-------------|----------------------|--------------------------|----------------------------|-------| | **P1** | `inner_messages` leaks into outer team termination evaluation | `Response.inner_messages` is appended to the outer team's `_message_thread`, affecting termination conditions. Violates encapsulation. | ✅ `inner_messages` is excluded from `_message_thread`, avoiding contamination of outer termination logic. | ❌ No | Structural boundary is now enforced | | **P2** | Inner team does not execute when outer message history is empty | In chained executions, if no new outer message exists, no task is created and the inner team is skipped entirely | ✅ Detects absence of new outer message and reuses the previous task, passing it via a handoff message. This ensures the inner team always receives a valid task to execute | ❌ No | The issue was silent task omission, not summary failure. Summary succeeds as a downstream effect | | **P3** | Summary LLM prompt is built from external input only | Prompt is constructed using external message history, ignoring internal reasoning | ✅ Prompt construction now uses `final_response.inner_messages`, restoring internal reasoning as the source of summarization | ❌ No | Matches v0.2 internal monologue behavior | | **P4** | External input is included in summary prompt (possibly incorrectly) | Outer messages are used in the final LLM summarization prompt | ✅ Resolved via the same fix as P3; outer messages are no longer used for summary | ❌ No | Redundant with P3, now fully addressed | <!-- 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 resolve microsoft#6123 Blocked microsoft#6168 (Sometimes SoMA send last whitespace message) related microsoft#6187 <!-- For example: "Closes microsoft#1234" --> ## Checks - [ ] 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. - [ ] I've added tests (if relevant) corresponding to the changes introduced in this PR. - [ ] I've made sure all auto checks have passed. --------- Co-authored-by: Eric Zhu <[email protected]>
…crosoft#6190) Signed-off-by: zhanluxianshen <[email protected]> Co-authored-by: Eric Zhu <[email protected]>
Signed-off-by: zhanluxianshen <[email protected]> Co-authored-by: Victor Dibia <[email protected]>
This PR improves fallback safety when an invalid `model_family` is supplied to `get_transformer()`. Previously, if a user passed an arbitrary or incorrect `family` string in `model_info`, the lookup could fail without falling back to `ModelFamily.UNKNOWN`. Now, we explicitly check whether `model_family` is a valid value in `ModelFamily.ANY`. If not, we fallback to `_find_model_family()` as intended. ## Related issue number Related microsoft#6011#issuecomment-2779957730 ## Checks - [ ] 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: Eric Zhu <[email protected]>
Signed-off-by: zhanluxianshen <[email protected]> Co-authored-by: Eric Zhu <[email protected]>
This pull request introduces a new feature to the `DockerCommandLineCodeExecutor` class, which allows temporary files generated by code execution to be deleted after code execution. The most important changes include adding a new configuration option, updating the class to handle this option, and adding tests to verify the new functionality. ### New Feature: Temporary File Deletion * [`python/packages/autogen-ext/src/autogen_ext/code_executors/docker/_docker_code_executor.py`](diffhunk://#diff-8ef47c21141ed8b0a757b0e6f9d1491561fc31684756d22ed0253edbfcfcdf91R81): Added `delete_tmp_files` attribute to the `DockerCommandLineCodeExecutorConfig` class and updated the `DockerCommandLineCodeExecutor` class to handle this attribute. This includes initializing the attribute, adding it to the configuration methods, and implementing the file deletion logic in the `_execute_code_dont_check_setup` method. [[1]](diffhunk://#diff-8ef47c21141ed8b0a757b0e6f9d1491561fc31684756d22ed0253edbfcfcdf91R81) [[2]](diffhunk://#diff-8ef47c21141ed8b0a757b0e6f9d1491561fc31684756d22ed0253edbfcfcdf91R128) [[3]](diffhunk://#diff-8ef47c21141ed8b0a757b0e6f9d1491561fc31684756d22ed0253edbfcfcdf91R177) [[4]](diffhunk://#diff-8ef47c21141ed8b0a757b0e6f9d1491561fc31684756d22ed0253edbfcfcdf91R231) [[5]](diffhunk://#diff-8ef47c21141ed8b0a757b0e6f9d1491561fc31684756d22ed0253edbfcfcdf91R318) [[6]](diffhunk://#diff-8ef47c21141ed8b0a757b0e6f9d1491561fc31684756d22ed0253edbfcfcdf91R346-R352) [[7]](diffhunk://#diff-8ef47c21141ed8b0a757b0e6f9d1491561fc31684756d22ed0253edbfcfcdf91R527) [[8]](diffhunk://#diff-8ef47c21141ed8b0a757b0e6f9d1491561fc31684756d22ed0253edbfcfcdf91R547) ### Testing * [`python/packages/autogen-ext/tests/code_executors/test_docker_commandline_code_executor.py`](diffhunk://#diff-635dbdcdeca161e620283399d5cd43ca756ec0f88d4429f059ee4f6b346874e4R318-R363): Added a new test `test_delete_tmp_files` to verify the behavior of the `delete_tmp_files` attribute. This test checks that temporary files are correctly deleted or retained based on the configuration.<!-- Thank you for your contribution! Please review https://microsoft.github.io/autogen/docs/Contribute before opening a pull request. -->
<!-- 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]>
…n arry item. (microsoft#6209) Resolves microsoft#6152
Fixes the sha256_hash docstring to refer to SHA-256 and not MD5. ## Why are these changes needed? The docstring refers to (presumably) a previous implementation that was using MD5. ## Related issue number N/A ## 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. - [N/A] I've added tests (if relevant) corresponding to the changes introduced in this PR. - [N/A] I've made sure all auto checks have passed.
…e tool calls (microsoft#6799) Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: ekzhu <[email protected]> Co-authored-by: Eric Zhu <[email protected]>
Co-authored-by: Eric Zhu <[email protected]>
Co-authored-by: Eric Zhu <[email protected]>
Co-authored-by: Eric Zhu <[email protected]>
… in OpenAI messages (microsoft#6845) Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: ekzhu <[email protected]> Co-authored-by: Eric Zhu <[email protected]>
Co-authored-by: Eric Zhu <[email protected]>
…icrosoft#6684) Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: husseinmozannar <[email protected]> Co-authored-by: Eric Zhu <[email protected]> Co-authored-by: ekzhu <[email protected]>
… limitation (microsoft#6883) Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: ekzhu <[email protected]> Co-authored-by: Eric Zhu <[email protected]>
…notations (microsoft#6889) Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: ekzhu <[email protected]> Co-authored-by: Eric Zhu <[email protected]>
) Co-authored-by: Eric Zhu <[email protected]>
…esolving conflicts
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why are these changes needed?
Fixes #6051 Updated to resolve CI issues by creating a clean implementation. This replaces the original PR with a clean implementation.