-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
RetrievalQA & RetrievalQAWithSourcesChain chains cannot be serialized/saved or loaded #3983
Comments
Facing the same issue |
Facing similar issue for retrivalQA, with elasticsearch as source. Any idea how to resolve this? |
Same issue with pinecone as a source |
ditto. I can get both a conversational chain and sources back from the pinecone with bit not the retrieval counterpart. sources are being sent from the db to the agnet and sent to the llm but not showing up in the final answers (maybe a separate problem) |
Just want to mention, this was working fine in previous versions, but I'm not sure when exactly it got broken. |
same issue for RetrievalQA! |
@adamyodinsky are you able to point to a specific version for which this worked? |
@dsaks9 No, I'm sorry I can't. |
<!-- Thank you for contributing to LangChain! Your PR will appear in our release under the title you set. Please make sure it highlights your valuable contribution. Replace this with a description of the change, the issue it fixes (if applicable), and relevant context. List any dependencies required for this change. After you're done, someone will review your PR. They may suggest improvements. If no one reviews your PR within a few days, feel free to @-mention the same people again, as notifications can get lost. Finally, we'd love to show appreciation for your contribution - if you'd like us to shout you out on Twitter, please also include your handle! --> <!-- Remove if not applicable --> Fixes #3983 Mimicing what we do for saving and loading VectorDBQA chain, I added the logic for RetrievalQA chain. Also added a unit test. I did not find how we test other chains for their saving and loading functionality, so I just added a file with one test case. Let me know if there are recommended ways to test it. #### Before submitting <!-- If you're adding a new integration, please include: 1. a test for the integration - favor unit tests that does not rely on network access. 2. an example notebook showing its use See contribution guidelines for more information on how to write tests, lint etc: https://github.com/hwchase17/langchain/blob/master/.github/CONTRIBUTING.md --> #### Who can review? Tag maintainers/contributors who might be interested: @dev2049 <!-- For a quicker response, figure out the right person to tag with @ @hwchase17 - project lead Tracing / Callbacks - @agola11 Async - @agola11 DataLoaders - @eyurtsev Models - @hwchase17 - @agola11 Agents / Tools / Toolkits - @vowelparrot VectorStores / Retrievers / Memory - @dev2049 --> --------- Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
<!-- Thank you for contributing to LangChain! Your PR will appear in our release under the title you set. Please make sure it highlights your valuable contribution. Replace this with a description of the change, the issue it fixes (if applicable), and relevant context. List any dependencies required for this change. After you're done, someone will review your PR. They may suggest improvements. If no one reviews your PR within a few days, feel free to @-mention the same people again, as notifications can get lost. Finally, we'd love to show appreciation for your contribution - if you'd like us to shout you out on Twitter, please also include your handle! --> <!-- Remove if not applicable --> Fixes langchain-ai#3983 Mimicing what we do for saving and loading VectorDBQA chain, I added the logic for RetrievalQA chain. Also added a unit test. I did not find how we test other chains for their saving and loading functionality, so I just added a file with one test case. Let me know if there are recommended ways to test it. #### Before submitting <!-- If you're adding a new integration, please include: 1. a test for the integration - favor unit tests that does not rely on network access. 2. an example notebook showing its use See contribution guidelines for more information on how to write tests, lint etc: https://github.com/hwchase17/langchain/blob/master/.github/CONTRIBUTING.md --> #### Who can review? Tag maintainers/contributors who might be interested: @dev2049 <!-- For a quicker response, figure out the right person to tag with @ @hwchase17 - project lead Tracing / Callbacks - @agola11 Async - @agola11 DataLoaders - @eyurtsev Models - @hwchase17 - @agola11 Agents / Tools / Toolkits - @vowelparrot VectorStores / Retrievers / Memory - @dev2049 --> --------- Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
<!-- Thank you for contributing to LangChain! Your PR will appear in our release under the title you set. Please make sure it highlights your valuable contribution. Replace this with a description of the change, the issue it fixes (if applicable), and relevant context. List any dependencies required for this change. After you're done, someone will review your PR. They may suggest improvements. If no one reviews your PR within a few days, feel free to @-mention the same people again, as notifications can get lost. Finally, we'd love to show appreciation for your contribution - if you'd like us to shout you out on Twitter, please also include your handle! --> <!-- Remove if not applicable --> Fixes langchain-ai#3983 Mimicing what we do for saving and loading VectorDBQA chain, I added the logic for RetrievalQA chain. Also added a unit test. I did not find how we test other chains for their saving and loading functionality, so I just added a file with one test case. Let me know if there are recommended ways to test it. #### Before submitting <!-- If you're adding a new integration, please include: 1. a test for the integration - favor unit tests that does not rely on network access. 2. an example notebook showing its use See contribution guidelines for more information on how to write tests, lint etc: https://github.com/hwchase17/langchain/blob/master/.github/CONTRIBUTING.md --> #### Who can review? Tag maintainers/contributors who might be interested: @dev2049 <!-- For a quicker response, figure out the right person to tag with @ @hwchase17 - project lead Tracing / Callbacks - @agola11 Async - @agola11 DataLoaders - @eyurtsev Models - @hwchase17 - @agola11 Agents / Tools / Toolkits - @vowelparrot VectorStores / Retrievers / Memory - @dev2049 --> --------- Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
I'm on Langchain v0.0.219 and still running into this issue with RetrievalQAWithSourcesChain where I'm getting an error that Saving not supported for this chain type. Note that I have RetrievalQAWithSourcesChain defined as a tool going into another agent.
Here I turn it into a tool
Doing a query on agent_aggregator has the following error. I did remove this specific tool and everything works fine, so it's isolated to RetrievalQAWithSourcesChain being a tool in this other agent.
Major apologies if this is the wrong issue thread, I'm pretty sure it's related but can move it somewhere more appropriate if needed. Any thought on what could be happening? |
Having the exact same problem! Here's my stacktrace: `
When using the Retrieval QA From Sources chain everything works fine. However I have to combine it with other tools into an agent. See this other issue: #1844 however it didn't helped me. I am on LangChain 0.0.231 |
Hi @fabmeyer @shessenauer I am also trying with the same approach, do you have any resolutions on the issues since your last attempt? |
@shessenauer @fabmeyer @mikexd-dev I have the same problem, were you able to resolve this? |
@mikexd-dev @skeretna No I was not able to solve the problem. However I decided to add a UI element to select the model/tool and "hardcode" it rather than using an agent to select the appropriate model/tool. |
This worked for me when I called the chain using lambda instead of directly, no idea why So, Change from this:
to this
|
@skeretna seems it works with this change, but need modification, add custom output parser can help I think or for example use the lambda q: qa_chain(q)['answer'] |
#3983 mentions serialization/deserialization issues with both `RetrievalQA` & `RetrievalQAWithSourcesChain`. `RetrievalQA` has already been fixed in #5818. Mimicing #5818, I added the logic for `RetrievalQAWithSourcesChain`. --------- Co-authored-by: Markus Tretzmüller <markus.tretzmueller@cortecs.at> Co-authored-by: Bagatur <baskaryan@gmail.com>
VectorDBQA
is being deprecated in favour ofRetrievalQA
& similarly,VectorDBQAWithSourcesChain
is being deprecated forRetrievalQAWithSourcesChain
.Currently,
VectorDBQA
&VectorDBQAWithSourcesChain
chains can be serialized usingvec_chain.save(...)
because they have_chain_type
property - https://github.com/hwchase17/langchain/blob/3bd5a99b835fa320d02aa733cb0c0bc4a87724fa/langchain/chains/qa_with_sources/vector_db.py#L67However,
RetrievalQA
&RetrievalQAWithSourcesChain
do not have that property and raise the following error when trying to save withret_chain.save("ret_chain.yaml")
:There isn't any functions to support loading RetrievalQA either, unlike the VectorQA counterparts: https://github.com/hwchase17/langchain/blob/3bd5a99b835fa320d02aa733cb0c0bc4a87724fa/langchain/chains/loading.py#L313-L356
The text was updated successfully, but these errors were encountered: