Robust AgentsModel instantiations and added Activity unit tests#108
Merged
Robust AgentsModel instantiations and added Activity unit tests#108
Conversation
axelsrz
requested changes
Sep 3, 2025
libraries/microsoft-agents-activity/microsoft_agents/activity/activity.py
Outdated
Show resolved
Hide resolved
axelsrz
previously approved these changes
Sep 4, 2025
libraries/microsoft-agents-activity/microsoft_agents/activity/activity.py
Outdated
Show resolved
Hide resolved
…into users/robrandao/activity-unit-tests
axelsrz
approved these changes
Sep 4, 2025
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
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.
This pull request introduces several improvements to the construction and handling of activity models in the Microsoft Agents Activity library. The most significant changes include the addition of utility functions for robust model field selection, refactoring of entity imports for better modularity, and enhanced handling of optional fields to avoid setting values to
Noneunnecessarily. There are also updates to card models and entity definitions to standardize field types.Model Construction and Field Selection Improvements
pick_model_dict,pick_model, and helper classes likeSkipNonein_model_utils.pyto allow for dynamic and conditional inclusion of fields in model initialization internally, improving code readability and reducing errors from unset orNonevalues.Activitymethods (create_reply,create_trace,create_trace_activity,get_conversation_reference) to use the new helpers for safer field assignment, ensuring unset values are properly handled and reducingNoneassignments. [1] [2] [3] [4]Entity and Import Refactoring
entitysubpackage and updating all relevant import statements for improved modularity and maintainability. [1] [2] [3] [4] [5]add_ai_to_activityfunction fromai_entity.pyand reimplemented it inactivity.pyto better encapsulate its usage with activities. [1] [2]Model and Entity Field Type Updates
textfield type fromNonEmptyStringtostrinAnimationCard,AudioCard, andBasicCardmodels for consistency and flexibility. [1] [2] [3]typefield in theEntitymodel fromNonEmptyStringtostrfor broader compatibility.Utility and Helper Method Enhancements
pick_propertiesclass method toAgentsModelto allow selective copying of fields from one model instance to another, preserving unset values and supporting partial updates.Bug Fixes and Minor Improvements
get_mentionsmethod inActivityto handle cases whereentitiesisNone, preventing potential errors.__is_activityto use a more precise string comparison for activity types.These changes collectively improve the robustness, maintainability, and clarity of the activity model construction and entity handling in the codebase.