Implement Custom Search In GPT-3

Using General & Specific Search In GPT-3

In the general Q&A chatbot, not using any training data, you can see how GPT-3 fields questions. Notice how context is maintained vertically, and how users can ask questions referencing earlier context in the conversation.

Custom Search Using Provided Documents

In the example below we are going to follow a two-step process where we are going to upload a data file and then have search results yielded based on this file.

{"text": "puppy A is happy", "metadata": "emotional state of puppy A"}{"text": "puppy B is sad", "metadata": "emotional state of puppy B"}
OpenAI is installed using pip. Python is used to mount a Google Drive and access the training file. The training process is initiated.
The result of the file uploading and training process.
Python code to query the single word of “happy” while referencing our file ID.

General Search With GPT-3

GPT-3 has a very powerful and simple interface for general question and answer conversations. More than that, the context of the conversation is managed exceptionally well.

A GPT-3 Search chatbot written in Python in 14 lines of code. Line 8 with a string assigned to the variable called prompt acts as the training data
Who won the F1 title in 2011?
prompt="I am a highly intelligent question answering bot. If you ask me a question that is rooted in truth, I will give you the answer. If you ask me a question that is nonsense, trickery, or has no clear answer, I will respond with \"Unknown\".\n\nQ: What is human life expectancy in the United States?\nA: Human life expectancy in the United States is 78 years.\n\nQ: Who was president of the United States in 1955?\nA: Dwight D. Eisenhower was president of the United States in 1955.\n\nQ: Which party did he belong to?\nA: He belonged to the Republican Party.\n\nQ: What is the square root of banana?\nA: Unknown\n\nQ: How does a telescope work?\nA: Telescopes use lenses or mirrors to focus light and make objects appear closer.\n\nQ: Where were the 1992 Olympics held?\nA: The 1992 Olympics were held in Barcelona, Spain.\n\nQ: How many squigs are in a bonk?\nA: Unknown\n\nQ: Who won the F1 title in 2011?\nA:"

Conclusion

There are elements of GPT-3 which is mind-blowing, the text related tasks are super useful; summarization, simplification, theming, key word extraction etc.

NLP/NLU, Chatbots, Voice, Conversational UI/UX, CX Designer, Developer, Ubiquitous User Interfaces. www.cobusgreyling.me

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store