From 6676a5fb948f352203e0933be52d9807d3aa181c Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Mon, 18 Dec 2023 08:55:28 +0100 Subject: [PATCH 1/3] Update __init__.py --- api/__init__.py | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/api/__init__.py b/api/__init__.py index 1eaa1b86..be81f42b 100644 --- a/api/__init__.py +++ b/api/__init__.py @@ -1466,11 +1466,12 @@ class LoLLMsAPI(LollmsApplication): ASCIIColors.cyan(f"Query:{query}") else: query = current_message.content - - docs, sorted_similarities = self.personality.persona_data_vectorizer.recover_text(query, top_k=self.config.data_vectorization_nb_chunks) - for doc, infos in zip(docs, sorted_similarities): - documentation += f"document chunk:\n{doc}" - + try: + docs, sorted_similarities = self.personality.persona_data_vectorizer.recover_text(query, top_k=self.config.data_vectorization_nb_chunks) + for doc, infos in zip(docs, sorted_similarities): + documentation += f"document chunk:\n{doc}" + except: + self.warning("Couldn't add documentation to the context. Please verify the vector database") if len(self.personality.text_files) > 0 and self.personality.vectorizer: if documentation=="": @@ -1482,19 +1483,23 @@ class LoLLMsAPI(LollmsApplication): else: query = current_message.content - docs, sorted_similarities = self.personality.vectorizer.recover_text(query, top_k=self.config.data_vectorization_nb_chunks) - for doc, infos in zip(docs, sorted_similarities): - documentation += f"document chunk:\nchunk path: {infos[0]}\nchunk content:{doc}" - + try: + docs, sorted_similarities = self.personality.vectorizer.recover_text(query, top_k=self.config.data_vectorization_nb_chunks) + for doc, infos in zip(docs, sorted_similarities): + documentation += f"document chunk:\nchunk path: {infos[0]}\nchunk content:{doc}" + except: + self.warning("Couldn't add documentation to the context. Please verify the vector database") # Check if there is discussion history to add to the prompt if self.config.use_discussions_history and self.long_term_memory is not None: if history=="": history="!@>previous discussions:\n" - docs, sorted_similarities = self.long_term_memory.recover_text(current_message.content, top_k=self.config.data_vectorization_nb_chunks) - for i,(doc, infos) in enumerate(zip(docs, sorted_similarities)): - history += f"!@>previous discussion {i}:\n!@>discussion title:\n{infos[0]}\ndiscussion content:\n{doc}" - # Add information about the user + try: + docs, sorted_similarities = self.long_term_memory.recover_text(current_message.content, top_k=self.config.data_vectorization_nb_chunks) + for i,(doc, infos) in enumerate(zip(docs, sorted_similarities)): + history += f"!@>previous discussion {i}:\n!@>discussion title:\n{infos[0]}\ndiscussion content:\n{doc}" + except: + self.warning("Couldn't add long term memory information to the context. Please verify the vector database") # Add information about the user user_description="" if self.config.use_user_name_in_discussions: user_description="!@>User description:\n"+self.config.user_description From d5c3167121fcbc164db6fb491fe02896c22f2d3a Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Tue, 19 Dec 2023 00:00:14 +0100 Subject: [PATCH 2/3] upgraded --- docs/youtube/lollms_v8.0_install_gpu.md | 32 +++++++++++++++++++++++++ zoos/bindings_zoo | 2 +- zoos/personalities_zoo | 2 +- 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/docs/youtube/lollms_v8.0_install_gpu.md b/docs/youtube/lollms_v8.0_install_gpu.md index ef49fdbf..c17102e4 100644 --- a/docs/youtube/lollms_v8.0_install_gpu.md +++ b/docs/youtube/lollms_v8.0_install_gpu.md @@ -37,3 +37,35 @@ The first time you run the app, you will need to specify a folder where to put y Now lollms is installed, but there is no binding installed nor a model. To do this, go to settings tab, select binding s zoo and install a binding depending on your preferences. Here I am using a GPU and want local generation, so I will select Hugging face to use full sized models, GPTQ quantized models or AWQ quantized models. The installation may take some while, you can look at the install details in the console window. +Please reboot the app after installing a binding as some of the installed libraries may need a fresh reboot to function properly. + +Now that we have rebooted the tool, let's get back to the settings tab to install and select a model. + +Go to models zoo and select a model. The models depend on the binding you have selected. Here in hugging face binding, you can use unquantized models, GPTQ quantized models or AWQ quantized models. + +To install a model press the menu button and select install. Then select the file tto install and validate. + +Now wait for the model to be downloaded. + +Once downloaded just select the model and it will be loaded. + +Now let's go back to the Discussions view. + +We now can start interacting with the AI. + +To create a new discussion, press the + button from the side bar. + +Now let's type something. + + +VoilĂ  + +As you can see, the AI has written some text. The quality of the generated text depends heavily on the used model and its training. Here we used a small model with 7B parameters. + +Bigger models tend to be smarter but some small models like mistral models do yield very good qua + +Don't forget to like, share and subscribe. + +Thanks for watching + +See ya \ No newline at end of file diff --git a/zoos/bindings_zoo b/zoos/bindings_zoo index 0346a1ef..4b88763e 160000 --- a/zoos/bindings_zoo +++ b/zoos/bindings_zoo @@ -1 +1 @@ -Subproject commit 0346a1efc2bc16d4e700d603fedc3ecbfe9b58bd +Subproject commit 4b88763e3b8cc973dbd93e400f8483fe69c837ea diff --git a/zoos/personalities_zoo b/zoos/personalities_zoo index 97ec1416..f55b226c 160000 --- a/zoos/personalities_zoo +++ b/zoos/personalities_zoo @@ -1 +1 @@ -Subproject commit 97ec1416d0af1377a8cfc96d9f55cb3f31681293 +Subproject commit f55b226c2cceabbfc4216d181d836c7d197db7dc From d102e00a75176645b4645688a702b4c4d90c7414 Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Tue, 19 Dec 2023 00:49:43 +0100 Subject: [PATCH 3/3] upgraded --- docs/youtube/lollms_mistral.md | 25 +++++++++++++++++++++++++ zoos/personalities_zoo | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 docs/youtube/lollms_mistral.md diff --git a/docs/youtube/lollms_mistral.md b/docs/youtube/lollms_mistral.md new file mode 100644 index 00000000..87e3cbda --- /dev/null +++ b/docs/youtube/lollms_mistral.md @@ -0,0 +1,25 @@ +Hi there, + +Let me show you how you can use the new web RAG (Retreival Augmented Generation) proposed on lollms to allow your persona to use a path to a website to learn how to do some new stuff. + +Here I'll point it to my FaceAnalyzer library that you can find on my github page then ask it to make an application for detecting my facial landmarks in realtime and show them in green. + +The AI will use the content of my github readme in order to accomplish my request. You can also add multiple paths if you have a more complex request that requires more than one library. + +We will be using the new MistralAI medium model through MistralAI API. To use this binding you need to create a mistralAI account and get a key that you should put in settings. + +Let's start by going to the github of the FaceAnalyzer application then copy its path. Now in lollms, press the globe button and paste the path. + +Select Mistral AI binding and the Mistral Medium model from the models zoo. + +Now let's ask it to make the code. + +As you can see, the code seems correct, it does use the FaceAnalyzer library as it should. Let's execute it. + +As you can see, the application works. We didn't need to do multiple turn discussions, the model was good enough to accomplish the task just as I asked. + +Combining Lollms, its personas, and its Rag with the power of mistral AI allows you to be more productive. + +Thanks for watching +See ya + diff --git a/zoos/personalities_zoo b/zoos/personalities_zoo index f55b226c..c2f63fbd 160000 --- a/zoos/personalities_zoo +++ b/zoos/personalities_zoo @@ -1 +1 @@ -Subproject commit f55b226c2cceabbfc4216d181d836c7d197db7dc +Subproject commit c2f63fbd14749e9a3512216bb818e7e71db973b6