From the course: OpenAI API for Python Developers
Generative AI: The future of development
- Since the release of ChatGPT in 2022, the chatbot application and the generative models have been a transformative force in various domains of content creation, creativity with image generation and problem solving. So let's see right now a quick demonstration with ChatGPT. I'm going to ask ChatGPT to write an email for me, but actually I'm going to be more specific. I'm going to ask, write a thank you email. All right. So right below we've got an example of a draft email, which is being generated pretty fast, and we simply need to fill in with our own personal information. So we can ask the chatbot all kinds of text processing task like correcting content, summarizing and translating documents. We can even ask the chatbot to do math for us. So the use cases for generative AI are limitless, based on the simple text description. So how does generative AI work? It starts with a prompt, a text input. With a prompt, we give the language models instructions to achieve the desired outputs, like generating text, processing translations or code and writing emails. For example, we can ask a basic math question like, what is two and two? And naturally the language model is going to give the exact answer, which is equals four. So the language model uses the training data to predict the subsequent words. And before reaching the language models, the text input goes through one step, which is called tokenization, which is the process of breaking the instructions into small units called tokens. And we can try and test this Tokenizer tool, which is provided by the OpenAI platform. So we can here as well ask another basic math question like, what is two and seven? And right below you're going to see how many tokens are going to be processed by the language models in order to generate the output to this text input, which is what is two and seven. And so the heart of ChatGPT is powered by the GPT models, trained on a massive amount of data, millions of data to understand and generate natural language. And GPT stands for generative pre-trained transformer. And the GPT models are called large because they are defined by billions of parameters spread across 96 layers in a neural network, making it one of the largest deep learning models ever created. So whenever you submit a text input before you get the output, it goes through the process of breaking the text input into tokens that are converted into token IDs that are then processed by the language models in order to generate the outputs. So given a sequence of input tokens, the model is then capable of predicting the next ones. And that is because the models relies on the neural network techniques, which is to generate text structured in a way that is grammatically and semantically correct based on the massive amount of text data that it was trained on, and coming from different sources like books, articles, and also the internet. An example of tasks that the language models can perform include drafting documents, analyzing texts, writing computer codes, and answering questions about a knowledge base. And also create conversational agents that seem surreal and lifelike. The startup, Open AI give developers access to an extensive API reference. So developers can also access Quickstart guides, libraries with the support of multiple programming languages, and also with examples of use cases to inspire developers in order to build their next AI driven tools and applications.