Closed phv2312 closed 3 weeks ago
How to use:
from kotaemon.deps.container import Container
from ktem.index.file.pipelines import DocumentRetrievalPipeline, IndexDocumentPipeline
"""
1. Indexing
"""
indexing_pipeline: IndexDocumentPipeline = Container.indexings.get("default").get()
print(indexing_pipeline)
stream = indexing_pipeline.stream(
["<your_filepath>"],
reindex=True
)
for response in stream:
print(response)
"""
2. Retriever
"""
crud = Container.crud
docids = crud.list_docids()
retriever_pipeline: DocumentRetrievalPipeline = Container.retrievers.get("default").get()
print(retriever_pipeline)
responses= retriever_pipeline.run(
text="What is the main content?",
doc_ids=docids
)
for response in responses:
print(response.id_)
print(response.text)
Description
Type of change
Checklist