AllAboutAI-YT / easy-local-rag

SuperEasy 100% Local RAG with Ollama + Email RAG
MIT License
645 stars 166 forks source link

Error : localrag.py #10

Open derricktan23 opened 4 months ago

derricktan23 commented 4 months ago

Im getting an error after running the following command "python localrag.py"

error logs: Traceback (most recent call last): File "/home/ubu1/easy-local-rag/localrag.py", line 130, in response = ollama.embeddings(model='mxbai-embed-large', prompt=content) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ubu1/miniconda3/envs/ragtest1/lib/python3.12/site-packages/ollama/_client.py", line 198, in embeddings return self._request( ^^^^^^^^^^^^^^ File "/home/ubu1/miniconda3/envs/ragtest1/lib/python3.12/site-packages/ollama/_client.py", line 73, in _request raise ResponseError(e.response.text, e.response.status_code) from None ollama._types.ResponseError: failed to generate embedding

derricktan23 commented 4 months ago

I followed the following setup steps

  1. git clone https://github.com/AllAboutAI-YT/easy-local-rag.git
  2. cd easy-local-rag
  3. pip install -r requirements.txt
  4. Install Ollama (https://ollama.com/download)
  5. ollama pull llama3 (etc)
  6. ollama pull mxbai-embed-large
  7. ollama pull mistral
  8. python upload.py
AllAboutAI-YT commented 4 months ago

hello! strange, and you have uploaded context to be embedding in vault.txt?

extremeakim commented 3 months ago

PS D:\VM\AI\easy-local-rag> python .\localrag.py Parsing command-line arguments... Initializing Ollama API client... Loading vault content... Generating embeddings for the vault content...

US President Joe Biden has praised American forces who he said "helped Israel take down nearly all" the drones and missiles launched by Iran on Sunday .In a statement, he said the US had moved aircraft and warships to the region before the unprecedented attack."I condemn these attacks in the strongest possible terms," he added.Israel said Iran launched hundreds of drones and missiles in its direction, the first time it has attacked Israel directly from its own territory .It said the "vast majority" were intercepted, but there were a small number of hits including at an IDF base in southern Israel.At least one person, reported to be a young girl, was injured.Iran earlier warned that Israel would be "punished" for a strike on its consulate in Syria on 1 April, which killed seven Iranian officers including a top commander .Israel has not confirmed or denied whether it was responsible.

Traceback (most recent call last): File "D:\VM\AI\easy-local-rag\localrag.py", line 137, in response = ollama.embeddings(model='mxbai-embed-large', prompt=content) File "C:\Users\Akim\AppData\Local\Programs\Python\Python39\lib\site-packages\ollama_client.py", line 198, in embeddings return self._request( File "C:\Users\Akim\AppData\Local\Programs\Python\Python39\lib\site-packages\ollama_client.py", line 73, in _request raise ResponseError(e.response.text, e.response.status_code) from None ollama._types.ResponseError: failed to generate embedding PS D:\VM\AI\easy-local-rag>

same problem here, yes i have context in the vault file. works fine if the vault file is empty... but its empty lol

vitorcalvi commented 3 months ago

same here... works when the vault is empty Will figure out to fix it, paste it here

python3 localrag.py Parsing command-line arguments... Initializing Ollama API client... Loading vault content... Generating embeddings for the vault content... Converting embeddings to tensor... Embeddings for each line in the vault: tensor([]) Starting conversation loop... Ask a query about your documents (or type 'quit' to exit):

vitorcalvi commented 3 months ago

PS D:\VM\AI\easy-local-rag> python .\localrag.py Parsing command-line arguments... Initializing Ollama API client... Loading vault content... Generating embeddings for the vault content...

US President Joe Biden has praised American forces who he said "helped Israel take down nearly all" the drones and missiles launched by Iran on Sunday .In a statement, he said the US had moved aircraft and warships to the region before the unprecedented attack."I condemn these attacks in the strongest possible terms," he added.Israel said Iran launched hundreds of drones and missiles in its direction, the first time it has attacked Israel directly from its own territory .It said the "vast majority" were intercepted, but there were a small number of hits including at an IDF base in southern Israel.At least one person, reported to be a young girl, was injured.Iran earlier warned that Israel would be "punished" for a strike on its consulate in Syria on 1 April, which killed seven Iranian officers including a top commander .Israel has not confirmed or denied whether it was responsible.

Traceback (most recent call last): File "D:\VM\AI\easy-local-rag\localrag.py", line 137, in response = ollama.embeddings(model='mxbai-embed-large', prompt=content) File "C:\Users\Akim\AppData\Local\Programs\Python\Python39\lib\site-packages\ollama_client.py", line 198, in embeddings return self._request( File "C:\Users\Akim\AppData\Local\Programs\Python\Python39\lib\site-packages\ollama_client.py", line 73, in _request raise ResponseError(e.response.text, e.response.status_code) from None ollama._types.ResponseError: failed to generate embedding PS D:\VM\AI\easy-local-rag>

same problem here, yes i have context in the vault file. works fine if the vault file is empty... but its empty lol

The problem is the input data. If you upload, ex: well structured json file, its works like charm. For instance (JSON): https://gist.github.com/tanveery/4ac939d2ad27954da4c8db13e10ef7bd