From 124d97c26da720f5f5012e6bdc07eb84302771e5 Mon Sep 17 00:00:00 2001 From: sabaimran <65192171+sabaimran@users.noreply.github.com> Date: Fri, 28 Jul 2023 03:51:20 +0000 Subject: [PATCH] =?UTF-8?q?Replace=20Falcon=20=F0=9F=A6=85=20model=20with?= =?UTF-8?q?=20Llama=20V2=20=F0=9F=A6=99=20for=20offline=20chat=20(#352)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Working example with LlamaV2 running locally on my machine - Download from huggingface - Plug in to GPT4All - Update prompts to fit the llama format * Add appropriate prompts for extracting questions based on a query based on llama format * Rename Falcon to Llama and make some improvements to the extract_questions flow * Do further tuning to extract question prompts and unit tests * Disable extracting questions dynamically from Llama, as results are still unreliable --- pyproject.toml | 2 +- src/khoj/interface/web/config.html | 2 +- .../conversation/gpt4all/chat_model.py | 111 +++++++++++------ .../conversation/gpt4all/model_metadata.py | 3 + .../processor/conversation/gpt4all/utils.py | 33 +++++ src/khoj/processor/conversation/prompts.py | 98 +++++++-------- src/khoj/processor/conversation/utils.py | 7 +- src/khoj/routers/api.py | 6 +- src/khoj/routers/helpers.py | 4 +- src/khoj/utils/config.py | 7 +- tests/test_gpt4all_chat_actors.py | 116 +++++++++++------- 11 files changed, 248 insertions(+), 141 deletions(-) create mode 100644 src/khoj/processor/conversation/gpt4all/model_metadata.py create mode 100644 src/khoj/processor/conversation/gpt4all/utils.py diff --git a/pyproject.toml b/pyproject.toml index 3b22b31e..4be3299b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -58,7 +58,7 @@ dependencies = [ "pypdf >= 3.9.0", "requests >= 2.26.0", "bs4 >= 0.0.1", - "gpt4all==1.0.5", + "gpt4all >= 1.0.7", ] dynamic = ["version"] diff --git a/src/khoj/interface/web/config.html b/src/khoj/interface/web/config.html index eead2ade..bd994232 100644 --- a/src/khoj/interface/web/config.html +++ b/src/khoj/interface/web/config.html @@ -229,7 +229,7 @@
-

Setup offline chat (Falcon 7B)

+

Setup offline chat (Llama V2)