DEV Community

Cover image for Connect ChatGPT to the Internet
Thomas Hansen for AINIRO.IO

Posted on • Edited on • Originally published at ainiro.io

Connect ChatGPT to the Internet

As of today we can connect our ChatGPT-based AI chatbots to the internet, allowing you to use our AI chatbot technology to search the internet, and discuss real-time live information from the web with ChatGPT.

From before our AI chatbots already displays images of course, and hyperlinks, references, lists, emojis, etc. Our new "browse the web with ChatGPT feature" obviously takes advantage of these features.

To understand why this is such a big deal, you can go to ChatGPT and ask it the following question:

Who won the US Open in 2023

At which point you'll get the following result.

ChatGPT real live internet data

If you ask our chatbot the following question:

Find me information for the following query "Who won the US Open in 2023?" and give me a summary with some images

You'll get the following answer:

ChatGPT connected to the web

Notice, it is important that you start out your question with exactly the following:

Find me information for the following query "QUERY_HERE"

This is because we're semantically matching your prompt towards our training snippets, where one of our training snippets contains Hyperlambda. This training snippet will kick in for the above sentence as your first hit most of the time, and be dynamically executed and return the result of your search query as "context".

Implementation

The way it's implemented is to some extent described in our ChatGPT with real time information article and our connect ChatGPT to your SQL database article. And since we already had ChatGPT with DuckDuckGo support, and a kick ass web scraper - The rest was just a matter of connecting the dots.

The way it works, is that we've got a training snippet that starts out with the words "Find me information for the following query". This training snippet contains Hyperlambda that basically searches and scrapes the result originating from DuckDuckGo. If you phrase your question such that this training snippet bubbles to the top, it will execute its Hyperlambda, which resembles the following:

Prompt - Find me information for the following query

Completion

{{
.query
strings.split:x:@.arguments/*/prompt
   .:"\""
set-value:x:@.query
   get-value:x:@strings.split/1
unwrap:x:+/*
signal:magic.ai.create-search-context
   query:x:@.query
   max_tokens:int:3500
.result
set-value:x:@.result
   strings.concat
      .:"While searching the internet for \""
      get-value:x:@strings.split/1
      .:"\" the following is what I found:"
      .:"\r\n"
      .:"\r\n"
      get-value:x:@signal
return:x:@.result
}}
Enter fullscreen mode Exit fullscreen mode

Once executed the above Hyperlambda will return whatever it found related to your query as Markdown, and us this as a "context" for ChatGPT. This allows ChatGPT to answer your question using real time data from the internet. Notice, only the parts between the double quotes (") will be sent to DuckDuckGo, while the whole question will be sent to ChatGPT. This allows you to ask questions such as for instance:

Find me information for the following query "Steve Jobs" and show me all images of Steve

Or ...

Find me information for the following query "Bill Gates" and write a 5 paragraph article about Bill's life

Etc ...

The scraping is done in parallel, and you can configure how many context tokens you want to use, and/or how many results you want to have DuckDuckGo return, etc. The parallel parts makes it surprisingly fast, since it will scrape (for instance) 5 web pages in parallel, and not sequentially, and aggregate the results of your query.

It also keeps the "source" for where it found the data, and will (most of the time) automatically display this. If you must have the source, you can also explicitly tell ChatGPT that it must provide its source.

Conclusion

This implies that as of today, we can deliver internet access to your ChatGPT AI chatbot if required. The feature is a little bit "BETA'ish" still, and we're still discussing pricing internally, and we'll probably not offer this in our "basic" package, but only from "professional" and up - Since I assume this would be most interesting for our AI Expert Systems allowing you to aggregate whatever you can figure out how to search for into your AI querying.

However, if you want to discuss this with us, we'd be happy to have an email from you and help you out getting a ChatGPT chatbot connected to the web 😊

Top comments (5)

Collapse
 
arianygard profile image
AriaNygard

This is an amazing update! The timing is too perfect with OpenAI shutting down the Bing beta, haha.

Collapse
 
polterguy profile image
Thomas Hansen

I know, some times you just get lucky ;)

Collapse
 
arianygard profile image
AriaNygard

Yes, but this kind of luck wouldn't be possible if you weren't so talented ;)

Thread Thread
 
polterguy profile image
Thomas Hansen

Hehe, thx ^_^

Collapse
 
mahseema profile image
Mahsima Dastan

I also create a repository for it: Connect ChatGPT to The Internet