How to connect chatgpt 4 to the internet using the api?

This might be exactly what you’re looking for.

  1. Use GPT-3.5 to generate a search engine query for a message
  2. Use a SERP API to search Google / Bing for relevant websites using the search query generated above
  3. Pass the top results URLs to this API as well as the user’s original message
  4. API returns relevant chunks of text from the URLs that you insert into prompt
  5. ChatGPT answers based on the retrieved text.

See here for example, suppose we provided the URL of this news article and the user’s message shown in the screenshot:

It provides the answer in the first chunk of text returned ‘Gurman expects an early 2024 launch for the larger Pro laptops — perhaps in late January or early February’

The integration of that example would be

  1. 'Generate a relevant search query to find the answer to the user’s question: ‘when will the M3 macbook pro be released’ → GPT returns ‘m3 macbook pro release date’ as the search query
  2. We search Google using this search query and the Tom’s Guide article is the first one returned
  3. Pass that URL to the API
  4. API uses the message and the URL to return the relevant text
  5. We insert the top 3 or so chunks into the prompt.

Demo here: Demos | Not Quite Unicorns

Hope it helps and it’s free!