InMemoryDocumentStore

InMemoryDocumentStore

Haystack에서 별다른 서비스나 의존성 없이 문서를 저장하고 검색하고 싶을 때 쓸 수 있는, 가장 단순한 문서 저장소예요. 바로 이 InMemoryDocumentStore가 그 역할을 해요.

이 저장소는 Haystack을 직접 실험해 보기에 아주 좋아요. 다만 운영 환경(production)에는 쓰지 않는 걸 권해요.

초기화 (Initialization)

InMemoryDocumentStore는 외부 설정이 전혀 필요 없어요. 아래 코드만 있으면 바로 쓸 수 있어요.

from haystack.document_stores.in_memory import InMemoryDocumentStore

document_store = InMemoryDocumentStore()

지원하는 Retriever

  • InMemoryBM25Retriever: 키워드 기반 Retriever로, 임시 인메모리 데이터베이스에서 쿼리와 매칭되는 문서를 가져와요.
  • InMemoryEmbeddingRetriever: 쿼리와 문서 임베딩을 비교해 쿼리와 가장 관련 있는 문서를 가져와요.

출처: 공식문서