Skip to content

Commit

Permalink
add flag for auto update
Browse files Browse the repository at this point in the history
  • Loading branch information
shihanwan committed Oct 15, 2024
1 parent 27c1dfd commit a61b176
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
26 changes: 14 additions & 12 deletions memonto/core/retain.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,28 +202,30 @@ def _retain(
message: str,
id: str,
auto_expand: bool,
auto_update: bool,
ephemeral: bool,
) -> None:
str_ontology = ontology.serialize(format="turtle")

updated_memory = ""

if auto_expand:
ontology = expand_ontology(
ontology=ontology,
llm=llm,
message=message,
)

# TODO: this should work with ephemeral as well but needs to be adjusted slightly
updated_memory = update_memory(
data=data,
llm=llm,
vector_store=vector_store,
triple_store=triple_store,
str_ontology=str_ontology,
message=message,
id=id,
ephemeral=ephemeral,
)
if auto_update:
updated_memory = update_memory(
data=data,
llm=llm,
vector_store=vector_store,
triple_store=triple_store,
str_ontology=str_ontology,
message=message,
id=id,
ephemeral=ephemeral,
)

save_memory(
ontology=ontology,
Expand Down
2 changes: 2 additions & 0 deletions memonto/memonto.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class Memonto(BaseModel):
triple_store: Optional[TripleStoreModel] = None
vector_store: Optional[VectorStoreModel] = None
auto_expand: Optional[bool] = False
auto_update: Optional[bool] = False
ephemeral: Optional[bool] = False
debug: Optional[bool] = False
model_config = ConfigDict(arbitrary_types_allowed=True)
Expand Down Expand Up @@ -63,6 +64,7 @@ def retain(self, message: str) -> None:
message=message,
id=self.id,
auto_expand=self.auto_expand,
auto_update=self.auto_update,
ephemeral=self.ephemeral,
)

Expand Down

0 comments on commit a61b176

Please sign in to comment.