Spaces:
Sleeping
Sleeping
File size: 476 Bytes
9b45841 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | from utils.pdf_reader import read_pdf
from utils.chunker import chunk_text
from utils.embeddings import create_embeddings
from utils.vector_store import add_chunks
from pathlib import Path
def ingest_document(path):
text = read_pdf(path)
chunks = chunk_text(text)
embeddings = create_embeddings(chunks)
filename = Path(path).name
add_chunks(
chunks,
embeddings,
filename
)
return len(chunks) |