Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileNotFoundError: [Errno 2] No such file or directory: 'vectorstore\\db_faiss' #4

Open
mehrdad2000 opened this issue Jan 7, 2024 · 1 comment

Comments

@mehrdad2000
Copy link

Hi
after run got this error:

chainlit run main.py -w
Traceback (most recent call last):
File "/usr/local/bin/chainlit", line 8, in
sys.exit(cli())
^^^^^
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1157, in call
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/chainlit/cli/init.py", line 152, in chainlit_run
run_chainlit(target)
File "/usr/local/lib/python3.11/site-packages/chainlit/cli/init.py", line 45, in run_chainlit
load_module(config.run.module_name)
File "/usr/local/lib/python3.11/site-packages/chainlit/config.py", line 244, in load_module
spec.loader.exec_module(module)
File "", line 940, in exec_module
File "", line 241, in _call_with_frames_removed
File "/opt/PrivateDocBot/main.py", line 11, in
init_vector_db()
File "/opt/PrivateDocBot/src/loader.py", line 50, in init_vector_db
files = [file for file in os.listdir(cfg.DB_FAISS_PATH) if file != 'readme.md']
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'vectorstore\db_faiss'

Any idea?
Thanks

@yanivsetton
Copy link

yanivsetton commented Jan 22, 2024

Hey @mehrdad2000 :)
you can replace the init_vector_db function in src/loader.py
to this function:

def init_vector_db():
    if not os.path.exists(cfg.DB_FAISS_PATH):
        os.makedirs(cfg.DB_FAISS_PATH)
        print(colored(f"{cfg.DB_FAISS_PATH} directory created.", 'blue'))

    files = [file for file in os.listdir(cfg.DB_FAISS_PATH) if file != 'readme.md']

    if not files:
        print(
            colored(f"{cfg.DB_FAISS_PATH} is empty. Build vector DB on first run", 'red')
        )
        resp = load_data()
        print(resp)
    else:
        print(
            colored(f"{cfg.DB_FAISS_PATH} is not empty. No need to build vector DB on first run", 'green')
        )

that's worked for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants