#40502·长链

核心: `InMemoryVectorStore` 为相关性分数搜索和 `similarity_score_threshold` 回调函数引发 `NotImplementedError`

作者: mrutunjay-kinagi创建于 2026年9月16日更新于 2026年9月17日
标签bugcoreexternal

`VectorStore.as_retriever` and `VectorStore.search` advertise `search_type="similarity_score_threshold"`, and `VectorStoreRetriever` accepts that configuration at construction time. Both paths go through `similarity_search_with_relevance_scores` / `asimilarity_search_with_relevance_scores`, which call `self._select_relevance_score_fn()`. The base implementation of `_select_relevance_score_fn` raises `NotImplementedError` and says vector stores should define their own. `InMemoryVectorStore`, the reference implementation shipped in `LangChain-core`, never overrides it, so relevance-score search and the threshold retriever fail with a bare `NotImplementedError` (sync and async) as soon as they are invoked — even though the

内容来源: langchain-ai/langchain