CREATE TABLE documents (
    id BIGINT PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
    book_id BIGINT NOT NULL,
    version INTEGER NOT NULL,
    text_chunk TEXT NOT NULL,
    embedding vector(384) NOT NULL 
);

CREATE INDEX ON documents 
USING ivfflat (embedding vector_cosine_ops)
WITH (lists = 100);
