In this video tutorial, we'll walk through a Colab notebook that demonstrates how to create a factual Q&A assistant using the OpenAI Embeddings & Completions API.
The Colab notebook we'll be walking through is based on the Question Answering using Embeddings notebook from OpenAI and the steps we're going to walk through include:
- Installing, importing the necessary packages, and setting the OpenAI key.
- Use prompt engineering to prevent hallucination
- Use the Embedding API to find relevant context to the user's question.
- Pre-processing the contextual information in smaller sections, creating an embedding vector for each section, matching relevant document sections using vector similarity, and prepending the most relevant sections to the prompt
- Using the Completions API to answer questions with relevant context
In future videos, we'll expand this code to several other use cases and show you how to create a simple web app with these functions using Streamlit.