Skip to content

**Improved **#97

Merged
csmangum merged 2 commits intomainfrom
dev
May 4, 2025
Merged

**Improved **#97
csmangum merged 2 commits intomainfrom
dev

Conversation

@csmangum
Copy link
Contributor

@csmangum csmangum commented May 4, 2025

Summary

This Pull Request refactors the object_to_text function within utils.py to enhance the readability and formatting of "position" and "inventory" keys. By making these changes, we aim to improve the clarity of text outputs, aiding in better user understanding and interaction.

Changes

  • object_to_text Function:
    • Enhanced formatting for the "position" key to provide clearer representation of room and coordinates.
    • Improved the "inventory" key display by introducing individual item descriptions with "has" statements.
  • match.py:
    • Removed redundant threshold adjustments for the Long-Term Memory (LTM) tier to streamline processing.
  • Testing Adjustments:
    • Updated test_load_from_json.py and test_embedding_utils.py test cases to align with the new formatting changes. This includes modifications to sample files and validation check improvements.
    • Refocused schema tests to highlight relevant samples for better accuracy.

Testing

  • All existing unit tests have been updated to reflect the new output format.
  • Manually verified changes to ensure that position and inventory text outputs are correctly formatted and easy to read.

Impact

  • This refactor improves user experience by increasing the legibility and coherence of text outputs related to position and inventory, supporting better interaction with the system.
  • The removal of redundant code simplifies maintenance and reduces potential sources of error.

By refining these functions, we enhance the utility and functionality of the system, providing clearer information to users and developers.


This PR description was enhanced by AI to improve clarity.

… inventory

This commit updates the `object_to_text` function in `utils.py` to handle special cases for "position" and "inventory" keys. The position now formats room and coordinates more clearly, while the inventory displays individual items with "has" statements. Additionally, the `match.py` file removes redundant threshold adjustments for the LTM tier. Test cases in `test_load_from_json.py` and `test_embedding_utils.py` are updated to reflect changes in sample files and improve validation checks. The schema tests are also adjusted to focus on relevant samples.
@csmangum csmangum requested a review from Copilot May 4, 2025 01:07
@github-actions github-actions bot changed the title Enhance object_to_text function for better formatting of position and… **Improved ** May 4, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the formatting of the object_to_text function by providing special handling for "position" and "inventory" keys and cleans up redundant code in match.py. It also updates several tests to reflect these changes and align agent identifiers across the test suite.

  • Enhanced object formatting for position and inventory in utils.py.
  • Removed redundant threshold adjustments for the LTM tier in match.py.
  • Updated tests and agent IDs in test_load_from_json.py, test_schema.py, and test_match_strategy.py.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
validation/search/attribute/attribute_test_suite.py Updated expected memory IDs with in-line comments for clarity.
tests/test_schema.py Removed outdated sample references; tests now focus on attribute validation.
tests/test_load_from_json.py Removed simple agent tests and updated agent IDs to reflect new sample usage.
tests/search/test_match_strategy.py Updated lambda signatures for memory store retrieval to include agent_id for clarity.
tests/embeddings/test_embedding_utils.py Updated assertions to check for individual "has" statements and coordinate formatting.
memory/search/strategies/match.py Removed redundant LTM threshold adjustment.
memory/embeddings/utils.py Refactored object_to_text to provide enhanced and clearer formatting.
Comments suppressed due to low confidence (2)

tests/test_load_from_json.py:147

  • [nitpick] The change from 'demo_agent' to 'test-agent-attribute-search' appears intentional; please verify that all test assertions and their associated memory samples are updated consistently across the test suite.
valid_data = load_and_validate(str(ATTRIBUTE_VALIDATION_SAMPLE))

tests/search/test_match_strategy.py:53

  • [nitpick] Ensure that the updated lambda signatures (with agent_id and memory_id) are fully consistent with how the get() methods are invoked elsewhere in the codebase to avoid parameter misalignment.
self.mock_stm_store.get.side_effect = lambda agent_id, memory_id: {

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@csmangum csmangum merged commit f6246b1 into main May 4, 2025
2 checks passed
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

Successfully merging this pull request may close these issues.

1 participant