-
Notifications
You must be signed in to change notification settings - Fork 779
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
How to retrieve fewer question-answer pairs from chromaDB #218
Comments
I also found this problem. It seems that irrelevant items can be retrieved. Is there any improvement method here? |
@philippschw Hmm, I tried looking for this, and I also struggle to see where in the code this is actually set. Maybe setting I know this does not answer the original question, but a PR to add support for setting To test if the latest changes resolve your issue, install Vanna from source:
and then you can set |
Chroma has an option for Since we don't specify the Ideally we should have some config params to set In the meantime, as an end user you can do this without forking the package by simply overriding the from vanna.openai.openai_chat import OpenAI_Chat
from vanna.chromadb.chromadb_vector import ChromaDB_VectorStore
class MyVanna(ChromaDB_VectorStore, OpenAI_Chat):
def __init__(self, config=None):
ChromaDB_VectorStore.__init__(self, config=config)
OpenAI_Chat.__init__(self, config=config)
def get_similar_question_sql(self, question: str, **kwargs) -> list:
return ChromaDB_VectorStore._extract_documents(
self.sql_collection.query(
query_texts=[question],
n_results=5, # Or whatever number you want
)
)
vn = MyVanna(config={'api_key': 'sk-...', 'model': 'gpt-3.5-turbo'}) |
@zainhoda I can make a PR to add support for this to set the |
@andreped you are the best contributor an open-source project could ever hope for 🚀 if you have time and inclination, feel free -- I'll batch all of your PRs into the next release |
@zainhoda I just saw this. Do we only want to set the If we want to set |
I made a PR, feel free to review directly there, @zainhoda :] |
I am running into token limits, is it possible to limit the number of question-answer pairs that are being retrieved when running the function get_similar_question_sql ?
I see chromadb has the argument: n_results=10. Just struggling to actually make use of it in the vanna.ai framework.
Thanks!
The text was updated successfully, but these errors were encountered: