MLQ Academy: Create a Custom Q&A Bot with GPT-3 & Embeddings

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.

2 years ago   •   7 min read

By Peter Foy

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:

  1. Installing, importing the necessary packages, and setting the OpenAI key.
  2. Use prompt engineering to prevent hallucination
  3. Use the Embedding API to find relevant context to the user's question.
  4. 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
  5. 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.

This content is only available to subscribers

Subscribe now and have access to all our stories, enjoy exclusive content and stay up to date with constant updates.

Sign up now

Spread the word

Keep reading