create the embedding and write to the database manually
Adapt the SQLModel model (see word2vec) with a column for the embedding
Then, use a sentence transformer model to embed the document
and then write to the database. Might have to run session.exec(text("CREATE EXTENSION IF NOT EXISTS vector))
first.
writing to the database using LangChain
Or use LangChain to write (with less flexible column and table names).
We can then create a session without having to rewrite to the database using from_existing index
Session management can be used in a FastAPI function with