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

Error : localrag.py #10

Open
derricktan23 opened this issue Apr 26, 2024 · 6 comments
Open

Error : localrag.py #10

derricktan23 opened this issue Apr 26, 2024 · 6 comments

Comments

@derricktan23
Copy link

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
Copy link
Author

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
Copy link
Owner

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

@extremeakim
Copy link

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
Copy link

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
Copy link

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

@Wazaki-Ou
Copy link

I had the same issue and I think it's because of the results saved in the vault.txt file.
All I did to fix it is remove the empty lines before and after the content inside the txt file and the error stopped showing.

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

5 participants