Train ChatGPT to Answer your Frequently Asked Questions

Enrich ChatGPT with your knowledge base.

Jesko Rehberg
6 min readFeb 7, 2023
Build your knowledge base on ChatGPT (image by Sergio)


Suppose we have questions that ChatGPT can’t answer. An example is the question about which country won the 2022 Soccer World Cup.

import openai
COMPLETIONS_MODEL = "text-davinci-003"
openai.api_key = "Your_API_KEY"
prompt = """Answer the question as truthfully as possible, and if you're unsure of the answer, say "Sorry, I don't know".

Q: Who won the world cup 2022?

temperature=0, # We use temperature of 0.0 because it gives the most predictable, factual answer.
max_tokens=4056, # This model's maximum context length is 4097 tokens, but 41 already included in prompt
)["choices"][0]["text"].strip(" \n")

Since ChatGPT was trained in a period before this World Cup, ChatGPT does not know the answer to this question yet.

In this article, we will learn how to teach ChatGPT these new topics. You can use this knowledge to let ChatGPT learn and answer your own (company-specific) Frequently Asked Questions (FAQ).


An interesting aspect of ChatGPT is that it often tries to give us an answer. That is, even if ChatGPT is not sure if the…



Jesko Rehberg

Data scientist at Views and opinions expressed are entirely my own and may not necessarily reflect those of my company