mirror of
https://github.com/hwchase17/langchain
synced 2024-11-18 09:25:54 +00:00
2a6f78a53f
**Description:** This pull request introduces a new feature for LangChain: the integration with the Rememberizer API through a custom retriever. This enables LangChain applications to allow users to load and sync their data from Dropbox, Google Drive, Slack, their hard drive into a vector database that LangChain can query. Queries involve sending text chunks generated within LangChain and retrieving a collection of semantically relevant user data for inclusion in LLM prompts. User knowledge dramatically improved AI applications. The Rememberizer integration will also allow users to access general purpose vectorized data such as Reddit channel discussions and US patents. **Issue:** N/A **Dependencies:** N/A **Twitter handle:** https://twitter.com/Rememberizer
21 lines
670 B
Python
21 lines
670 B
Python
from typing import List
|
|
|
|
from langchain_core.callbacks import CallbackManagerForRetrieverRun
|
|
from langchain_core.documents import Document
|
|
from langchain_core.retrievers import BaseRetriever
|
|
|
|
from langchain_community.utilities.rememberizer import RememberizerAPIWrapper
|
|
|
|
|
|
class RememberizerRetriever(BaseRetriever, RememberizerAPIWrapper):
|
|
"""`Rememberizer` retriever.
|
|
|
|
It wraps load() to get_relevant_documents().
|
|
It uses all RememberizerAPIWrapper arguments without any change.
|
|
"""
|
|
|
|
def _get_relevant_documents(
|
|
self, query: str, *, run_manager: CallbackManagerForRetrieverRun
|
|
) -> List[Document]:
|
|
return self.load(query=query)
|