ConfigError: field "client" not yet prepared so type is still a ForwardRef-FlashrankRerank #22657
-
Checked other resources
Commit to Help
Example Codefrom langchain.retrievers import ContextualCompressionRetriever
from langchain.retrievers.document_compressors import FlashrankRerank
compressor = FlashrankRerank()
compression_retriever = ContextualCompressionRetriever(
base_compressor=compressor, base_retriever=retriever, top_n=4
) DescriptionHi, I am trying to use FlashrankRerank and I get the following error: ConfigError: field "client" not yet prepared so type is still a ForwardRef, you might need to call FlashrankRerank.update_forward_refs(). I added this line FlashrankRerank.update_forward_refs() but I still get the error. System InfoSystem Information
Package Information
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
Hello, @mdeniz1! I'm here to assist you with your issue. I'm a bot designed to help you solve bugs, answer questions, and become a contributor. Let's work together to resolve the issue you're facing. To resolve the Here is how you can do it: from langchain.retrievers.document_compressors import FlashrankRerank
# Call update_forward_refs to resolve forward references
FlashrankRerank.update_forward_refs() Ensure that you call this method after the class definition and before you instantiate or use the pip install flashrank Here is an example of how to integrate it into your code: from langchain.retrievers import ContextualCompressionRetriever
from langchain.retrievers.document_compressors import FlashrankRerank
# Call update_forward_refs to resolve forward references
FlashrankRerank.update_forward_refs()
compressor = FlashrankRerank()
compression_retriever = ContextualCompressionRetriever(
base_compressor=compressor, base_retriever=retriever, top_n=4
) This should resolve the |
Beta Was this translation helpful? Give feedback.
I'm sure you already tried this but for me just restarting the kernel actually did the job