Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
shihanwan committed Sep 27, 2024
1 parent 2217b14 commit 6c6bc11
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion memonto/core/forget.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ def _forget(
except ValueError as e:
logger.warning(e)
except Exception as e:
logger.error(e)
logger.error(e)
2 changes: 1 addition & 1 deletion memonto/core/remember.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from memonto.stores.triple.base_store import TripleStoreModel


def load_memory(
def _remember(
namespaces: dict[str, Namespace],
triple_store: TripleStoreModel,
id: str,
Expand Down
2 changes: 1 addition & 1 deletion memonto/core/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def generate_text(g: Graph) -> str:
return text_g


def render_memory(g: Graph, format: str, path: str) -> str:
def _render(g: Graph, format: str, path: str) -> str:
if format == "turtle":
return g.serialize(format="turtle")
elif format == "json":
Expand Down
14 changes: 9 additions & 5 deletions memonto/memonto.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
from memonto.core.forget import _forget
from memonto.core.query import _retrieve
from memonto.core.recall import _recall
from memonto.core.remember import load_memory
from memonto.core.render import render_memory
from memonto.core.remember import _remember
from memonto.core.render import _render
from memonto.core.retain import _retain
from memonto.llms.base_llm import LLMModel
from memonto.stores.triple.base_store import TripleStoreModel
Expand Down Expand Up @@ -198,13 +198,17 @@ def remember(self) -> None:
:return: None.
"""
self.ontology, self.data = load_memory(
self.ontology, self.data = _remember(
namespaces=self.namespaces,
triple_store=self.triple_store,
id=self.id,
)

def _render(self, format: str = "turtle", path: str = None,) -> Union[str, dict]:
def _render(
self,
format: str = "turtle",
path: str = None,
) -> Union[str, dict]:
"""
Return a text representation of the entire currently stored memory.
Expand All @@ -220,4 +224,4 @@ def _render(self, format: str = "turtle", path: str = None,) -> Union[str, dict]
- "text" format returns a string in text format.
- "image" format returns a string with the path to the png image.
"""
return render_memory(g=self.data, format=format, path=path)
return _render(g=self.data, format=format, path=path)
4 changes: 2 additions & 2 deletions tests/core/test_remember.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest
from unittest.mock import MagicMock

from memonto.core.remember import load_memory
from memonto.core.remember import _remember


@pytest.fixture
Expand All @@ -16,7 +16,7 @@ def mock_store():


def test_load_memory(mock_store, id):
load_memory(
_remember(
triple_store=mock_store,
id=id,
debug=False,
Expand Down

0 comments on commit 6c6bc11

Please sign in to comment.