Reading and analyzing webpages content by GPT-4 API

I’m new with chatGPT development and currently I’m trying to integrate my java based web application with it.

At first I’d started testing the API to find a prompt that will do the job I want for me. I wanna pass to chatGPT-4 API a prompt with url to read the content of a web article, analyze it and then return short summary of the article.

Unfortunately when I was trying to do something like this, it looks like chat was analyzing only by url and was not reading the page content. From ChatGPT GUI it workes perfect, but from API the result was a made up story that never happened.

Is anoyone knows how can I make something like this work with an API? Any plugin or something?

1 Like

The API doesn’t take “plugins”, nor can the AI model access the internet, but it can be improved by your own code’s features.

Consider an AI model on API to be in its basic form. You are interacting with the language AI itself in text mode. It accepts context input, and from that it produces output.

In order to produce output, you’ll need to provide the AI model the input data that it should operate on, besides your instructions.

A basic interface you could write yourself for this specific task could have a URL input box. You type in the URL, use a http requests method, see a display of what was retrieved (to know if the page doesn’t simply say “javascript required”), and then press the “summarize article with AI” button.

Further, the AI has function-call abilities. You could create a function get_website that retrieves a web page’s contents, cleans it up into text and limited length the AI can understand, and returns that back to the AI as a function return value. The AI can then fulfill user’s requests for knowledge about a URL.

1 Like