Skip to content
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

[Question]: AttributeError: 'NoneType' object has no attribute 'search' #13391

Closed
1 task done
Amiya-Lahiri-AI opened this issue May 9, 2024 · 5 comments
Closed
1 task done
Labels
question Further information is requested

Comments

@Amiya-Lahiri-AI
Copy link

Amiya-Lahiri-AI commented May 9, 2024

Question Validation

  • I have searched both the documentation and discord for an answer.

Question

I am using QueryFusionRetriever

`from llama_index.core.retrievers import QueryFusionRetriever

retriever = QueryFusionRetriever(
[vector_retriever, bm25_retriever],
similarity_top_k=4,
num_queries=4,
mode="reciprocal_rerank",
verbose=True,
)`

`from llama_index.core.postprocessor import (
MetadataReplacementPostProcessor,
SimilarityPostprocessor,
)
from llama_index.core.postprocessor import SentenceTransformerRerank
from llama_index.core.query_engine import RetrieverQueryEngine

query_engine = RetrieverQueryEngine.from_args(retriever,
node_postprocessors=[
MetadataReplacementPostProcessor(target_metadata_key="window"),
SentenceTransformerRerank(
model="BAAI/bge-reranker-base"
)
],
)`

after that I am asing a query
response = query_engine.query("what are requimenets to submit the tender")
however I am facing an error AttributeError: 'NoneType' object has no attribute 'search'
it is coming from the engine_query
Can anyone please help me out why I am getting this error

@Amiya-Lahiri-AI Amiya-Lahiri-AI added the question Further information is requested label May 9, 2024
Copy link

dosubot bot commented May 9, 2024

The error you're encountering, AttributeError: 'NoneType' object has no attribute 'search', suggests that the retriever object is None. This typically occurs if the QueryFusionRetriever fails to properly instantiate, which might be due to issues with the initialization of vector_retriever, bm25_retriever, or the parameters passed to QueryFusionRetriever.

To address this, ensure that both vector_retriever and bm25_retriever are correctly initialized and are instances of BaseRetriever or its subclasses. Verify the parameters you're passing to QueryFusionRetriever match what is expected by the library, focusing on required and optional parameters such as retrievers, mode, similarity_top_k, num_queries, and others as applicable.

If after checking these aspects the issue persists, it would be helpful to have more details on how vector_retriever and bm25_retriever are being initialized. This additional context can provide clues to the root cause of the problem.

Details

Sources


About Dosu
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.

To continue the conversation, mention @dosu.

@logan-markewich
Copy link
Collaborator

logan-markewich commented May 9, 2024

You are using qdrant I'm guessing? Provide the async client

QdrantVectorStore(..., client=QdrantClient(...), aclient=AsyncQdrantClient(...))

Note that if using :memory: mode, these clients do not share data in qdrant

@Amiya-Lahiri-AI
Copy link
Author

Amiya-Lahiri-AI commented May 12, 2024

Hi @logan-markewich
thanks for your reply. I am indeed using QdrantVectorStore

import qdrant_client
from llama_index.vector_stores.qdrant import QdrantVectorStore
client = qdrant_client.QdrantClient(
url= "xxx",
api_key= "xxxxx",
)
asynclient = qdrant_client.AsyncQdrantClient(
url="xxxx",
api_key="xxxx"
)
vector_store = QdrantVectorStore(client=client, collection_name="xxxxxx", aclient=asynclient)

however can you please tell me why I was getting the error in the first place.
also after integrating your solution I am getting this warning message
WARNING:llama_index.vector_stores.qdrant.base:Both client and aclient are provided. If using :memory: mode, the data between clients is not synced.
can't I just use QdrantClient without using the AsyncQdrantClient?

@logan-markewich
Copy link
Collaborator

That warning is fine

Qdrant supports both async and sync operations. Some features use async, and need the async client

@Amiya-Lahiri-AI
Copy link
Author

ok thank you @logan-markewich

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants