Replies: 1 comment
-
Hey @lingvisa! 👋 I'm here to help you with bug fixes, answer questions, and guide you to become a contributor. Let's tackle this together! The issue with your retrieval config not working for Here is the relevant code snippet that validates the @validator("top_k")
def validate_top_k(cls, value: int) -> int:
if value < 0:
raise ValueError(f"top_k ({value}) cannot be negative.")
return value Additionally, ensure that the Here is an example of how the from langchain_core.runnables import ConfigurableField
faiss_retriever = faiss_vectorstore.as_retriever(
search_kwargs={"k": 2}
).configurable_fields(
search_kwargs=ConfigurableField(
id="search_kwargs_faiss",
name="Search Kwargs",
description="The search kwargs to use",
)
)
ensemble_retriever = EnsembleRetriever(
retrievers=[bm25_retriever, faiss_retriever], weights=[0.5, 0.5]
)
config = {"configurable": {"search_kwargs_faiss": {"k": 1}}}
docs = ensemble_retriever.invoke("apples", config=config)
docs In your case, ensure that the If the issue persists, double-check the versions of the LangChain modules you are using, as there might be compatibility issues between different versions [3][4]. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Checked other resources
Commit to Help
Example Code
Description
Specifically, the 'k'=1 configuration doesn't work for me.
docs2 = ensemble_retriever.invoke(question, config=config). it returns 5 results.
System Info
langchain==0.2.11
langchain-aws==0.1.6
langchain-community==0.2.10
langchain-core==0.2.23
langchain-google-genai==1.0.7
langchain-openai==0.1.17
langchain-text-splitters==0.2.2
langchain-weaviate==0.0.2
Beta Was this translation helpful? Give feedback.
All reactions