mirror of
https://github.com/ollama/ollama-python.git
synced 2026-07-21 17:15:23 -04:00
Embeddings don't seem to work. #71
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @luigi052005 on GitHub (Apr 24, 2024).
I attempted to utilize the embedding model following the example provided on https://ollama.com/blog/embedding-models, yet each time, it returns: "Llamas are vegetarians and possess highly efficient digestive systems."
main.txt

@luigi052005 commented on GitHub (Apr 25, 2024):
Am i doing something wrong here?
@chandansp27 commented on GitHub (Apr 26, 2024):
Hi,
The issue is from the n_results parameter set to 1, Chroma retrieves docs using the query, but the constraint with RAG is that the retrieved document might not always be the most relevant one to the query. When n_results is set to 1, only the 'Llamas are vegetarians.... ' was retrieved which caused the incorrect answer.
Upon increasing the n_resuts to 2, this is the top docs retrieved:
{'ids': '4', '5',
'distances': 177.4359130859375, 255.44308471679688,
'metadatas': None, None,
'embeddings': None,
'documents': [['Llamas are vegetarians and have very efficient digestive systems',
'Llamas live to be about 20 years old, though some only live for 15 years and others live to be 30 years old']],
'uris': None,
'data': None}
and this is the response:
"Based on the data provided, we can determine that llamas are vegetarians and have efficient digestive systems. This means that they are able to extract nutrients from their diet effectively and efficiently, which can contribute to their longevity.
The average lifespan of a llama is around 15-20 years in captivity, with some individuals living up to 30 years or more. This is relatively long for an animal of its size, as many larger animals tend to have shorter lifespans due to their increased metabolic demands and higher risk of health problems."
There are many techniques to improve retrieval accuracy like changing the parameters like n_results to a higher number, hybrid retrievers like BM25, re-ranking the retrieved docs using the prompt, and many more.
@luigi052005 commented on GitHub (Apr 26, 2024):
Thanks for the detailed explanation.