AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

RePhraseQueryRetriever._Aget_relevant_documents Raises NotImplementedError

The async retrieval method `_aget_relevant_documents` in `RePhraseQueryRetriever` is unimplemented, causing `ainvoke` to raise `NotImplementedError` while the synchronous `invoke` works normally.

highConfidence 95%LangchainVector StoresMemoryEmbeddingsAffected V<=1.0.7

Origin Analysis

The async method stub was left unimplemented when the class was ported to `langchain-classic`; it raises `NotImplementedError` instead of mirroring the synchronous logic using async equivalents.
1. Create a FakeRetriever implementing both sync and async `_get_relevant_documents` and `_aget_relevant_documents`.\n2. Create a RunnableLambda that returns a rephrased query.\n3. Instantiate `RePhraseQueryRetriever(retriever=FakeRetriever(), llm_chain=chain)`.\n4. Call `asyncio.run(retriever.ainvoke("what is langchain?"))`.\n5. Observe `NotImplementedError` raised from `_aget_relevant_documents`.

Fixing Code Block

Edge Case Audit

This fix assumes both `self.llm_chain` and `self.retriever` support async invocation. If the wrapped retriever does not implement `_aget_relevant_documents`, its `ainvoke` may still raise `NotImplementedError` or fall back to the synchronous implementation depending on the class. Additionally, forwarding `run_manager.get_child()` in the `config` dict may conflict with callback managers supplied by the caller; ensure that the retriever and LLM chain do not inadvertently override or drop existing callbacks. Rollback: if async invocation issues arise, revert to the previous stub or use the synchronous `invoke` method. Consider adding an async-specific test to prevent regression.

Ecosystem Topology

Agent Frameworks

LangChain, LlamaIndex, and Pydantic

  1. highProperty graph relation keys collide when entity IDs or labels contain underscores
  2. highCodeActAgent drops assistant tool-call metadata during handoff, leaving an orphan tool response
  3. high[Bug]: HierarchicalNodeParser async methods return the documents unsplit
  4. highLLM.predict_and_call fails with ValidationError for non-function-calling models when react_chat_formatter is omitted
  5. highAnthropic streaming server-tool input_json_delta overwrites completed client tool_use arguments due to stale cur_tool_call state