Replies: 3 comments
-
🤖 Hi @Abe410, It's good to see you again and I hope you're doing well. I understand you're having an issue with inconsistent source/metadata retrieval from Pinecone when changing the 'k' parameter in the search_kwargs of the retriever. Based on the information you've provided and the context from the LangChain repository, it seems like the 'k' parameter directly affects the number of metadata retrieved from the Pinecone query. When you set 'k' as 2, you get consistent sources in your final answer, which are retrieved from the metadata that you uploaded. However, when you set 'k' as 4, you do not get any sources at all and it's just a blank 'Source' field in the response. This behavior might be due to how the 'k' parameter is used in the Pinecone retriever in LangChain. The 'k' parameter is used to specify the number of documents to fetch. This is done by passing Here is the relevant code: result = self.index.query(
vector=dense_vec,
sparse_vector=sparse_vec,
top_k=self.top_k,
include_metadata=True,
namespace=self.namespace,
) This means that the 'k' parameter in the There was a similar issue in the LangChain repository titled RetrievalQAWithSourcesChain sometimes does not return sources under sources key. The suggested solution was to try using a custom few shot prompt that includes a "table question" with sources. This suggestion was made because the issue seems to occur when the user requests the answer in a table format. Additionally, if you have access to GPT-4, you might want to try using that, as GPT-3.5.-turbo might be focusing too much on the table format and forgetting the additional formatting instructions in the context. I hope this helps! If you have any other questions or need further clarification, feel free to ask. Best, 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.
-
Hi @Abe410, I encountered the exact same problem as yours. Have you been able to fix it by any chance? |
Beta Was this translation helpful? Give feedback.
-
Hi @Abe410 and @JacopoMereu I have encountered same issues. Any guidance with fixing the issue will be helpful. Thank you. |
Beta Was this translation helpful? Give feedback.
-
Hi,
I have a chatbot with the following libraries:
I upload the data to the Pinecone index as following:
Now if I retrieve an answer by creating a Retrieval with QA sources chain as follows:
If I set the kwarg 'k' as 2, I get consistent sources in my final answer, which are retrieved from the metadata that I uploaded. But if I set 'k' as 4, I do not get any sources at all and it's just a blank 'Source' field in the response.
What can be the reason?
Beta Was this translation helpful? Give feedback.
All reactions