aniketmaurya / discord-llm-bot

Fun project: LLM powered RAG Discord Bot that works seamlessly on CPU
30 stars 3 forks source link

DB error on startup #2

Open shootie22 opened 8 months ago

shootie22 commented 8 months ago

Hi, thank you for this project. While trying to set it up, I get this error: FileNotFoundError: Table test does not exist.Please first call db.create_table(test, data)

I installed all required modules, downloaded the LLM and everything seems to be in place, but I get this error. Full stack:

$ python ../../app.py
Traceback (most recent call last):
  File "C:\Users\radu\Documents\GitRepos\discord-llm-bot\src\app.py", line 19, in <module>
    class MyClient(discord.Client):
  File "C:\Users\radu\Documents\GitRepos\discord-llm-bot\src\app.py", line 20, in MyClient
    retriever = LightningRetriever()
                ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\radu\Documents\GitRepos\discord-llm-bot\src\discord_llm\retriever.py", line 19, in __init__
    self.table = get_table()
                 ^^^^^^^^^^^
  File "C:\Users\radu\Documents\GitRepos\discord-llm-bot\src\discord_llm\db.py", line 69, in get_table
    table = db.open_table(TABLE_NAME)
            ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\radu\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\lancedb\db.py", line 368, in open_table
    return LanceTable.open(self, name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\radu\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\lancedb\table.py", line 1235, in open
    raise FileNotFoundError(
FileNotFoundError: Table test does not exist.Please first call db.create_table(test, data)

Windows 10 Pro, running Python 3.11.7

Could you shine some light on this? cheers!

shootie22 commented 8 months ago

Looking further into it, it seems that the database doesn't get created. I looked through the code, and I found that the database/table generation is done in lancedb-embeddings.ipynb. Could there be a chance it is not getting triggered?

aniketmaurya commented 8 months ago

hi @shootie22, the db creation logic has to be added into the app.py script from notebook. I will create a PR to fix that or if in case you want to give it a shot please feel free to create a PR.

shootie22 commented 8 months ago

I tried adding the lines of code that seemed relevant to the db creation logic to app.py, but it didn't work. I googled around a bit and tried to understand how it's done properly, but I've never used the tools you used to make it. So I think it would make more sense if you did it.