While editing our guide for ChatGPT integration (learn more in our blog post: https://www.edgedb.com/blog/chit-chatting-with-edgedb-docs-via-chatgpt-and-pgvector) and chatting with the engineer who built it, I finally understand (better, at least 😅) how this stuff works. Figured I could share in hopes it may help someone. 1/ Imagine you’re dropped into the book shop pictured here. I come to you and tell you I want to learn about the development of Japanese early tsunami warning systems. The catch: there’s no organization system here that you can discern. So, where do you start looking? 2/ This is why libraries use the Dewey Decimal System to organize books by subject. Knowing your subject of interest, you can reference the library’s card catalog to find a physical location in the library for that subject. Go there, and you can find the book I’m looking for. 3/ When generating embeddings, @OpenAI takes the text you give it and generates a bunch of numbers for each chunk. These numbers act as the Dewey Decimal System for the new information you want the LLM to use to answer questions. The numbers sort your content in a virtual space. 4/ The sets of numbers are called vectors, and they get stored in a database — maybe an EdgeDB database using our pgvector support. This database, full of vectors and the content chunks they reference, acts as the “card catalog” of the new information you want to use with the language model. 5/ Then, when someone asks a question, you generate embeddings from that too. By using math to compare the question’s embeddings to the embeddings generated from your content, you can easily find the relevant bits of content and feed that content to the LLM so it can answer the question. 6/ ChatGPT then uses that most similar chunk you gave it to answer the question being asked. Pretty cool, right? It’s not perfect, but it can still be extremely helpful. If you want to try it, head over to our docs and click the “Ask AI” button on the navigation bar! https://www.edgedb.com/docs 7/