Replies: 2 comments
-
🤖 Hello, Based on the context provided, it seems you want to variably control the number of returned resource documents based on their relevance to a given query. This is indeed possible by modifying the Unfortunately, the exact code for the The If the index.query( vectors, { limit: 10 } ) In this case, you can replace Please note that this is a general approach and the exact implementation may vary based on the actual code of the For more information, you can refer to the examples/src/retrievers/pinecone_self_query.ts file in the LangChainJS repository. Additionally, there was a similar feature request in the past: Feature request: Customizable document retrieval parameters (k and score threshold) for Index-related chains with VectorStore integration. The feature was implemented in a pull request by a user named mayt. You can refer to the pull request here for more details. I hope this helps! If you have any more questions or need further clarification, feel free to ask. Sources
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. |
Beta Was this translation helpful? Give feedback.
-
Hey @onalv I haven't tested this so I'm not 100% sure, but you should try passing an instance of |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using pinecone as vector database for a Q&A app (for documents). I want to control how many resource documents are returned but I want it to be variable, so that if there're no relevant vectors, just return 0 source documents, but if there are more return 2 or 3 or 4, maybe using like a filter for the probability of how related is it to the question or just a config value? (e.g. probability of text being related to the question >= 0.5). Currently I can pass a number to
asRetriever
but this doesn't comply with what I need.Do I need to use a different config or different way of doing it?
Beta Was this translation helpful? Give feedback.
All reactions