-
-
Notifications
You must be signed in to change notification settings - Fork 160
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
Add k to pinecone's "ask" functionality #297
Add k to pinecone's "ask" functionality #297
Conversation
@@ -141,7 +141,7 @@ def similarity_search_by_vector(embedding:, k: 4, namespace: "", filter: nil) | |||
# @param filter [String] The filter to use | |||
# @yield [String] Stream responses back one String at a time | |||
# @return [String] The answer to the question | |||
def ask(question:, namespace: "", filter: nil, &block) | |||
def ask(question:, namespace: "", filter: nil, k: 4, &block) | |||
search_results = similarity_search(query: question, namespace: namespace, filter: filter) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you meant to also pass the k:
param to the similarity_search(..., k: k)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤦 yes - absolutely did mean to do that. long day sorry.
@asmorris I wouldn't be opposed to adding the same param to all other vector search DBs if you feel like coding it up! |
I can absolutely do that! Great idea |
We were running into an issue when asking a question of OpenAI using pinecone, where there were occasions where the context provided by the
ask
method was over the 4096 tokens, and so was exceeding the default OpenAI context window for question asking. This change would allow a user to add in an additional parameterk
to the ask method, which could be subsequently passed tosimilarity_search
to allow the user to have the amount of relevant results they wish, instead of defaulting to the 4 that is withsimilarity_search
currently.