Anyone looking at writing their first Generative AI application should read this to save time.
In June 2023, Google Cloud published a useful blog post, linked below, containing a concrete example for writing a simple Generative AI application using their cloud services. Here is a bit of context on some of the contents of the blog post.
The cornerstone of any Generative AI is the Large Language Model, or LLM for short, which understands the semantic meaning of words and expressions in text documents and encodes them as numerical representations in mathematical vectors called embeddings. Embedding generally refers to a numerical representation of a piece of information. In the case of Generative AI, the embedding is the encoded semantic meaning.
Generative AI can produce a lot of embeddings, which must be stored somewhere. There are specialized vector databases, but embeddings can also be stored in a general database like PostgreSQL, as shown in the Google blog post example, because PostgreSQL supports vectors as a data type when using the extension pgVector. pgVector also implements custom SQL operators, which are useful when searching embeddings. PostgreSQL is free and open source (except when it’s a cloud service), very popular, and a great choice for storing embeddings. Plain English user queries are also encoded as embeddings and the PostgreSQL database is searched for embeddings that closely match the user queries using the custom SQL operators provided by pgVector. The database results of the queries are then returned in plain English to the user, thanks again to the LLM.
Learning how to write a Generative AI application can seem like a daunting task at first because of the various complex parts involved, especially the LLM. But cloud services make this a lot easier by providing those parts in ready-to-go and easy-to-use fashion. This Google Cloud blog post is a good place to start for implementing a first test generative AI application, and it provides a link to a non-trivial example dataset to use with the application. Other major cloud providers have also published similar examples.