Can I use Retrieval with Completion API (not Assistant)?

The API available through OpenAI is “embeddings”, simply returning the embeddings vector state that captures semantics of an input. It can then be compared to other embeddings.

There are more developed database products out there that employ semantic search, like on Azure. However, it is not terribly difficult to make your own database that is the size of some documents for personal use.

I count around 10 lines of operation to capture embeddings of multiple inputs in this off-hand example I use to demonstrate.

The part that’s missing is the chunking logic, where you can customize the size and overlap and metadata for your application to exceed that of someone else’s solution, and the vector database, which besides providing storage, can have optimized methods for exhaustive search across the entirety of the embeddings to return a top-k.