Question Answer



OpenAI API can do question/answering pretty well for factual information. Depending on the complexity of the answer and whether you need contextual cues or new information, different size prompts are optimal.

[EOP] denotes end of prompt when API generation begins.

Zero Shot Results

The API returns zero-shot results but they are a bit random. E.g., the following code snippet returns the capital of Alaska correctly as Juneau but it might not be the form you want.

What is the capital of Alaska?[EOP]

The capital of Alaska is Juneau.

One Shot Results

Q: What is the capital of the USA?
A: Washington DC

Q: What is the capital of France?
A:[EOP] Paris

Adding Follow-up Questions

Here we can 0 shot the location of the Washington Monument.

Q: Where is the Washington Monument?
A:[EOP] The Washington Monument can be found in Washington, DC.

Feeding that information back in, we can ask a followup:

Q: How did you know that?[EOP]
A: A quick Google search and I found my answer.

It didn't actually query Google, but it saw enough people say something like that in training it just repeats it. That is, additional prompts feeding the original statement back in will get additional information on the subject. HOWEVER, these are not actually how OpenAI came up with the result; it's an explanation after the fact by being fed the prompt guessing what a human user would have written next.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License