Skip to content
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

Small rename to long term memory #6914

Merged
merged 3 commits into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/py-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- name: Build Environment
run: make build
- name: Run Tests
run: poetry run pytest --forked -n auto --cov=openhands --cov-report=xml -svv ./tests/unit --ignore=tests/unit/test_memory.py
run: poetry run pytest --forked -n auto --cov=openhands --cov-report=xml -svv ./tests/unit --ignore=tests/unit/test_long_term_memory.py
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
env:
Expand Down
2 changes: 1 addition & 1 deletion openhands/memory/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from openhands.memory.condenser import Condenser
from openhands.memory.memory import LongTermMemory
from openhands.memory.long_term_memory import LongTermMemory

__all__ = ['LongTermMemory', 'Condenser']
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from openhands.core.config import AgentConfig, LLMConfig
from openhands.events.event import Event, EventSource
from openhands.events.stream import EventStream
from openhands.memory.memory import LongTermMemory
from openhands.memory.long_term_memory import LongTermMemory
from openhands.storage.files import FileStore


Expand Down Expand Up @@ -154,7 +154,7 @@ def test_load_events_into_index_with_invalid_json(
"""Test loading events with malformed event data."""
# Simulate an event that causes event_to_memory to raise a JSONDecodeError
with patch(
'openhands.memory.memory.event_to_memory',
'openhands.memory.long_term_memory.event_to_memory',
side_effect=json.JSONDecodeError('Expecting value', '', 0),
):
event = _create_action_event('invalid_action')
Expand Down Expand Up @@ -190,7 +190,8 @@ def test_search_returns_correct_results(long_term_memory: LongTermMemory):
MagicMock(get_text=MagicMock(return_value='result2')),
]
with patch(
'openhands.memory.memory.VectorIndexRetriever', return_value=mock_retriever
'openhands.memory.long_term_memory.VectorIndexRetriever',
return_value=mock_retriever,
):
results = long_term_memory.search(query='test query', k=2)
assert results == ['result1', 'result2']
Expand All @@ -201,7 +202,8 @@ def test_search_with_no_results(long_term_memory: LongTermMemory):
mock_retriever = MagicMock()
mock_retriever.retrieve.return_value = []
with patch(
'openhands.memory.memory.VectorIndexRetriever', return_value=mock_retriever
'openhands.memory.long_term_memory.VectorIndexRetriever',
return_value=mock_retriever,
):
results = long_term_memory.search(query='no results', k=5)
assert results == []
Expand Down
Loading