PDA

View Full Version : openAI chat















AlexOsk
7th May 2023, 10:23 PM
Watched the youtube vido "How scared should we be of artificial intelligence?"
Bla-bla almost of invention of the weel , bla-bla, need to be regulated, bla-bla.

Decided give it a crack and have a chat with a thing about woodworking. The thing is Dumb, it just search google for answers. ))))
Looks like someone trying to sell something for a squillion or two.))

Bernmc
8th May 2023, 07:57 PM
if you're playing with a free service, you're probably talking to GPT3.5, which failed the American bar exam (what a dunce machine eh).

GPT4 is a whole different animal. It passed the American Bar exam in the 90th percentile. You can get very limited access for free if you sniff around.

I asked it to write me an arduino program to monitor a door sensor, and send an alert to a web server. It spat out the code below, explained it, then made me a shopping list for components and drew me a circuit diagram.

And if the code generates an error, you just tell the AI the error and it figures it out and re-writes for another crack.


<esp8266wifi.h><esp8266httpclient.h>
<code class="!whitespace-pre hljs language-C++">#include (includes removed for this post)<esp8266wifi.h>
#include <esp8266httpclient.h>

// Replace with your network credentials
const char* ssid = "your_SSID";
const char* password = "your_PASSWORD";

// Replace with the IP address of your web server
const char* serverIP = "10.0.0.20";

// Replace with the port number your web server is listening on
const int serverPort = 80;

// Pin connected to the switch sensor
const int switchPin = 2;

// Set the initial state of the door
bool doorClosed = true;

void setup() {
// Connect to Wi-Fi
Serial.begin(115200);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi...");
}
Serial.println("Connected to WiFi");

// Set the switch sensor pin as input
pinMode(switchPin, INPUT_PULLUP);
}

void loop() {
// Read the state of the switch sensor
bool switchState = digitalRead(switchPin) == LOW;

// If the door has been opened, send an alert to the web server
if (doorClosed && !switchState) {
Serial.println("Door opened");

// Construct the URL for the web server
String url = "http://" + String(serverIP) + ":" + String(serverPort) + "/door_opened";

// Create an HTTP client
WiFiClient client;

// Make the HTTP request
HTTPClient http;
http.begin(client, url);
int httpCode = http.GET();
if (httpCode > 0) {
Serial.printf("HTTP status code: %d\n", httpCode);
String payload = http.getString();
Serial.println(payload);
} else {
Serial.println("HTTP request failed");
}
http.end();

// Set the state of the door to opened
doorClosed = false;
}

// If the door h</esp8266httpclient.h></esp8266wifi.h></code><code class="!whitespace-pre hljs language-C++">as been closed, reset the state
if (!doorClosed && switchState) {
Serial.println("Door closed");
doorClosed = true;
}

// Wait a short time before checking the sensor again
delay(100);
}
</code></esp8266httpclient.h></esp8266wifi.h><esp8266wifi.h><esp8266httpclient.h>
</esp8266httpclient.h></esp8266wifi.h>

Bernmc
8th May 2023, 08:38 PM
Here's another one I tried for fun:

It doesn't quite get the order correct (GPT3.5 again), but you can tell it and it'll have another crack. Or give it to GPT4 (I've run out of queries for the next few hours)

Prompt:
create a checkbox shopping list template. tasks: 1. create subheadings for all the major food groups like meat, vegetables, pasta etc. 2. arrange the headings in an order that will make shopping at woolworths australia the most efficient. 3. add 3 empty checkbox lines to each subheading.

Response:

Sure, here is a checkbox shopping list template that meets your requirements:

Shopping List:

Meat:




Vegetables:




Fruits:




Bakery:




Dairy:




Frozen:




Pantry:




Beverages:




Personal Care:




Household:




Pets:




Notes:

1. The subheadings are organized according to the major food groups, starting with meat, followed by vegetables, fruits, bakery, dairy, frozen, pantry, beverages, personal care, household, and pets.

2. The order of the subheadings is designed to make shopping at Woolworths Australia more efficient by grouping items together based on their location in the store.

3. Each subheading includes three empty checkbox lines to allow you to easily check off items as you shop.

woodg62
8th May 2023, 10:00 PM
Or give it to GPT4 (I've run out of queries for the next few hours)



You could try Bing Chat as it is based on GPT4.

BobL
8th May 2023, 10:05 PM
My son is a "white hat" hacker for an international IT security company.
He leads a team of hackers that legally hack IT systems and write reports written about how good/bad a clients IT security it..
As team leader my son spends a lot of time editing these reports -

Getting the hackers in his team to meet a set standard and be consistent in their report writing is hard work so my son writes manuals/guidelines about what should be in the reports and how to write them
Writing the manuals is one thing but getting the team members to read them is another and so quirky writing in the manuals is used to entice the team members to read them..
So he asked GTPchat (company pays so its no cost to him) to take the view point of a 3ft high devil and rewrite his manuals with a bit of humour etc and it did a great job.

This is only one of the myriads of ways he and his team usie AI in the hacking prevention game.
He reckons it's already improved his teams productivity by at least 20% and they havent even really gotten started yet.

Like anything to do with computers its the quality of the input that determines the quality of the output.

jack620
8th May 2023, 10:16 PM
And if the code generates an error, you just tell the AI the error and it figures it out and re-writes for another crack.


I can't quite get my head around that. A computer program that writes code that contains errors?

Jeffen
9th May 2023, 12:11 AM
I can't quite get my head around that. A computer program that writes code that contains errors?


From the horse's mouth (3.5)

As an artificial intelligence language model, ChatGPT has been trained on a vast corpus of text data from the internet, which includes a wide range of programming languages and coding styles. While the model has a good understanding of the syntax and structure of these languages, it may still generate code that contains errors or is otherwise incorrect.
There are several reasons why this can happen:


Ambiguity in natural language: Natural language is often ambiguous, and the same words or phrases can have multiple meanings depending on the context. When generating source code, ChatGPT relies on the context of the prompt and its training data to understand what the user is asking for. However, this can sometimes lead to errors or misunderstandings.
Lack of domain-specific knowledge: While ChatGPT has been trained on a wide range of text data, it may not have specialized knowledge in certain domains or industries. For example, if a user asks for code related to a specific scientific or engineering application, ChatGPT may not have the necessary domain-specific knowledge to generate correct code.
Noise in the training data: The training data used to train ChatGPT contains a lot of noise and errors, which can sometimes affect the accuracy of the model. While the model has been designed to filter out noise and learn from high-quality data, there may still be errors that affect the quality of the generated code.

In general, it is important to understand that ChatGPT is a language model that generates responses based on the patterns it has learned from its training data. While the model is very good at generating natural-sounding responses and code, it is not perfect and may sometimes generate incorrect or incomplete code. It is always a good idea to carefully review and test any code generated by ChatGPT to ensure its correctness and functionality.

jack620
9th May 2023, 08:15 AM
It is always a good idea to carefully review and test any code generated by ChatGPT to ensure its correctness and functionality.

So don't use it to generate mission-critical code I guess?

BobL
9th May 2023, 09:00 AM
My son uses GPTchat extensively to generate specific IT security testing code.
Any errors he has found so far have been his fault in not specifying the input requirements/data tightly enough.
As an extra check users can ask GTPchat to explain in words how the code works, which helps confirm it's operating correctly.
The approach my son uses for most coding is to break up longer programs up into chuncks that makes it easier to check and test which is what good programmers do anyway.
GPTchat also won't perform certain tasks it deems illegal so sometimes the break up method is a way around this.

tonzeyd
9th May 2023, 01:14 PM
It depends on what you're using it for. Ive toyed around with it for a period of time for work, it's surprisingly good at doing things programming related, eg VBA, python, excel SQL etc.

Jeffen
9th May 2023, 01:30 PM
So don't use it to generate mission-critical code I guess?

Well, the onus is on the developer using it to test appropriately.
It saves a lot of drudgery work, and as mentioned, the better the specification, the better the output.

I used it to create a comparison tool for some largish, slightly complex data sets. I spent a couple of hours fine tuning the question I was asking of it until I had the code I needed.

You still need to know what you're doing, it helps you speed up the process.

Jeff

Bernmc
10th May 2023, 05:52 PM
I can't quite get my head around that. A computer program that writes code that contains errors?

Remember that it's generating code in response to a plain English prompt - 'write me some code in x language to do this that and the next thing'

Bit like the bloke who asked the painter to paint his porch green... couple of hours later the painter bangs on the door and asks "do you want me to do the hubcaps too?"

jack620
10th May 2023, 06:56 PM
Bit like the bloke who asked the painter to paint his porch green... couple of hours later the painter bangs on the door and asks "do you want me to do the hubcaps too?"

That’s what worries me.