Skip to content

Commit

Permalink
Update app.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ParisNeo authored Nov 30, 2023
1 parent ad7177a commit b741485
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions lollms/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
from lollms.helpers import trace_exception
from lollms.terminal import MainMenu
from lollms.utilities import PromptReshaper
from safe_store import TextVectorizer, VectorizationMethod, VisualizationMethod
from typing import Callable
from ascii_colors import ASCIIColors
from pathlib import Path

import subprocess
import importlib
Expand Down Expand Up @@ -38,8 +40,9 @@ def __init__(

self.mounted_extensions = []
self.notification_callback = notification_callback
self.binding=None
self.model:LLMBinding=None
self.binding = None
self.model:LLMBinding = None
self.long_term_memory = None

try:
if config.auto_update:
Expand Down Expand Up @@ -106,7 +109,23 @@ def __init__(
self.mount_personalities()
self.mount_extensions()


def build_long_term_skills_memory(self):
db_path:Path = self.lollms_paths.personal_databases_path/self.config.db_path.split(".")[0]
db_path.mkdir(exist_ok=True, parents=True)
self.long_term_memory = TextVectorizer(
vectorization_method=VectorizationMethod.TFIDF_VECTORIZER,
model=self.model,
database_path=db_path/"skills_memory.json",
save_db=True,
data_visualization_method=VisualizationMethod.PCA,
)
return self.long_term_memory

def learn_from_discussion(self, discussion):
learned_skill = self.model.generate(f"{discussion}\n\n!@>What should we learn from this discussion?!@>Summerizer: Here is a summary of the most important informations extracted from the discussion:\n",)
return learned_skill


def remove_text_from_string(self, string, text_to_find):
"""
Removes everything from the first occurrence of the specified text in the string (case-insensitive).
Expand Down

0 comments on commit b741485

Please sign in to comment.