Ngz91 / Eunomia

Analyze your code locally using a GPT LLM.
Apache License 2.0
32 stars 9 forks source link

Error when Eunomia start #3

Closed BlockchainExpert2023 closed 4 months ago

BlockchainExpert2023 commented 4 months ago
gitpod /workspace/Eunomia (master) $ python Eunomia.py start
Traceback (most recent call last):
  File "/workspace/Eunomia/Eunomia.py", line 200, in <module>
    eunomia.start()
  File "/workspace/Eunomia/Eunomia.py", line 72, in start
    llm = self._initialize_llm(self.llm, self.model_n_ctx, self.backend)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/Eunomia/Eunomia.py", line 154, in _initialize_llm
    return GPT4All(
           ^^^^^^^^
  File "/workspace/.pyenv_mirror/user/current/lib/python3.12/site-packages/pydantic/main.py", line 341, in __init__
    raise validation_error
pydantic.error_wrappers.ValidationError: 1 validation error for GPT4All
__root__
  Failed to retrieve model (type=value_error)

And my .env : PERSIST_DIRECTORY=db LLM = ggml-gpt4all-j-v1.3-groovy.bin BACKEND = gptj EMBEDDINGS_MODEL = all-MiniLM-L6-v2 MODEL_N_CTX = 1000 TARGET_SOURCE_CHUNKS = 6 IGNORE_FOLDERS = '["folder\\to\\ignore", "folder\\to\\ignore2"]'

And I have downloaded "ggml-gpt4all-j-v1.3-groovy.bin"

Thanks

BlockchainExpert2023 commented 4 months ago

Resolved ! Path in LLM :

PERSIST_DIRECTORY=db
LLM = ./ggml-gpt4all-j-v1.3-groovy.bin
BACKEND = gptj
EMBEDDINGS_MODEL = all-MiniLM-L6-v2
MODEL_N_CTX = 1000
TARGET_SOURCE_CHUNKS = 6
IGNORE_FOLDERS = '["folder\\\\to\\\\ignore", "folder\\\\to\\\\ignore2"]'
BlockchainExpert2023 commented 4 months ago

And I had to resolve an error in code :

class Eunomia:
    def __init__(self) -> None:
        self.cwd = self.get_cwd()
        #self.db = f"{self.cwd}\{os.environ.get('PERSIST_DIRECTORY')}".strip()
        self.db = f"{self.cwd}\\{os.environ.get('PERSIST_DIRECTORY')}".strip()
BlockchainExpert2023 commented 4 months ago

It reads documents in the Eunomia directory so it takes the Eunomia .py files by default. I have not found where we can define the input directory for the files we want it to read (and only these files). As I want to make some tests with c# then I had to change the extention to .cpp (I know it is not compatible with C# so that is normal).