Ragbits Document Search is a Python package that provides tools for building RAG applications. It helps ingest, index, and search documents to retrieve relevant information for your prompts.
You can install the latest version of Ragbits Document Search using pip:
pip install ragbits-document-searchimport asyncio
from ragbits.core.embeddings import LiteLLMEmbedder
from ragbits.core.vector_stores.in_memory import InMemoryVectorStore
from ragbits.document_search import DocumentSearch
async def main() -> None:
"""
Run the example.
"""
embedder = LiteLLMEmbedder(
model_name="text-embedding-3-small",
)
vector_store = InMemoryVectorStore(embedder=embedder)
document_search = DocumentSearch(
vector_store=vector_store,
)
# Ingest all .txt files from the "biographies" directory
await document_search.ingest("local://biographies/*.txt")
# Search the documents for the query
results = await document_search.search("When was Marie Curie-Sklodowska born?")
print(results)
if __name__ == "__main__":
asyncio.run(main())