Home > IT > Main-main dengan ChatGPT

Main-main dengan ChatGPT

Beberapa hari ini, dunia dihebohkan dengan kehadiran model bahasa bernama ChatGPT. ChatGPT “dilatih” untuk bercakap-cakap dalam bahasa manusia. Tanggapan ChatGPT atas pertanyaan dan pernyataan yang disampaikan pengguna manusia terasa sangat natural.

Baru hari ini saya berkesempatan mencoba bercakap-cakap dengan ChatGPT ini. Saya mencoba bercakap-cakap dengan dua bahasa: Inggris dan Indonesia, dan semuanya ditanggapi dengan mulus olehnya.

Awalnya saya mencoba menanyakan pertanyaan-pertanyaan “mudah”, seperti berikut ini:

Saya (S): How far is Jakarta from Singapore?

ChatGPT (C): Jakarta and Singapore are approximately 1,145 kilometers (710 miles) apart. The exact distance may vary depending on the specific route taken and the mode of transportation used. The distance between the two cities is roughly a one hour flight by plane or a two-day journey by car or train.

Tampak jelas ia mampu memahami pertanyaan saya. Susunan kalimat jawabannya rapi, dan tepat menanggapi sebagaimana yang saya harapkan.

Saya coba lanjutkan.

S: How about Jakarta from Bangkok?

Perhatikan bahwa untuk menjawab pertanyaan saya ChatGPT perlu “ingat” konteks pembicaraan, yaitu jarak antar kota. Kali ini saya menyebut kota yang berbeda. Dan jawabannya tepat sesuai konteks pembicaraan.

Saya mencoba bertanya mengenai sesuatu hal yang spesifik. Saya baru mencoba membaca ulang serial Trio Detektif, dan saya ingin tahu apakah ChatGPT tahu mengenainya.

S: Do you know about The Three Investigators, a series of young adult novel from US?

Mantab..
Saya mulai iseng mencoba membahas topik yang berbeda, yang walau topik umum tapi untuk menjelaskannya tidak terlalu mudah. Kali ini dalam bahasa Indonesia.

S: Mengapa gigi susu tanggal?

Cukup akurat.

Oh ya, tersedia tombol “Try again” jika kita kurang puas dengan jawaban yang diberikan, lalu kita ingin meminta ChatGPT mencoba menyediakan jawaban yang berbeda. Saya coba klik “Try again”.

C: Gigi susu tanggal atau gigi deciduous adalah gigi yang pertama kali tumbuh pada anak-anak sebelum diganti oleh gigi permanen. Gigi susu biasanya mulai tanggal pada usia antara 5 hingga 12 tahun, tergantung pada individu. Gigi susu tanggal karena mereka tidak dibutuhkan lagi setelah gigi permanen tumbuh dan mulai mengambil alih fungsinya. Gigi susu memiliki akar yang lebih pendek dan lebih lunak dibandingkan dengan gigi permanen, sehingga mudah ditarik atau tanggal saat gigi permanen tumbuh dan mulai mengambil alih fungsinya.

Luar biasa.

ChatGPT tidak bisa memberikan jawaban berupa gambar secara langsung. Tapi ia bisa menyediakan kode yang bisa dijalankan akan menampilkan gambar. Saya coba meminta ia menggambar sesuatu yang perlu pemahaman yang tidak sederhana.

S: Using svg, draw a circle right inside a box, with the circle touching the box’s sides

This SVG code creates a rectangle with dimensions of 200 pixels by 200 pixels, using the element. The rectangle has a stroke (outline) of black and is not filled with a color. The circle is created using the element, with a center point of (100, 100) and a radius of 80 pixels. The circle also has a black stroke and is not filled with a color. This creates a circle that is contained within the rectangle and touches the sides of the rectangle.

Hasil gambarnya adalah benar lingkaran di dalam bujursangkar, namun lingkarannya tidak menyentuh sisi kotak sebagaimana saya minta. Saya protes boleh dong..

S: But on the image you created, the circle doesn’t touch the sides of the box

This updated SVG code creates a circle with a radius of 90 pixels, which is exactly half the width and height of the rectangle. This makes the circle touch the sides of the rectangle.

Dia mengakui kesalahannya, dan kali ini dia memberikan jawaban yang benar. Rasa ngeri mulai merambat di pikiran..

Sebagai seorang programmer, tentu kurang lengkap bila saya tidak menanyakan sesuatu terkait pemrograman.

S: Write a PHP program to manage CRUD of contacts data


// connect to the database
$db = new mysqli('hostname', 'username', 'password', 'database_name');
// create a new contact
function createContact($first_name, $last_name, $email, $phone) {
    global $db;
    $query = "INSERT INTO contacts (first_name, last_name, email, phone)
              VALUES ('$first_name', '$last_name', '$email', '$phone')";
    return $db->query($query);
}
// read all contacts
function readContacts() {
    global $db;
    $query = "SELECT * FROM contacts";
    return $db->query($query);
}
// update an existing contact
function updateContact($id, $first_name, $last_name, $email, $phone) {
    global $db;
    $query = "UPDATE contacts
              SET first_name = '$first_name', last_name = '$last_name',
                  email = '$email', phone = '$phone'
              WHERE id = $id";
    return $db->query($query);
}
// delete a contact
function deleteContact($id) {
    global $db;
    $query = "DELETE FROM contacts WHERE id = $id";
    return $db->query($query);
}

This PHP program contains four functions for managing a contacts database: createContact(), readContacts(), updateContact(), and deleteContact(). The createContact() function can be used to add a new contact to the database, while the readContacts() function can be used to retrieve a list of all contacts. The updateContact() function can be used to update the information for an existing contact, and the deleteContact() function can be used to delete a contact from the database. These functions use a MySQL database to store and retrieve the contacts data.

Nanggung jika tidak minta dia menyediakan struktur tabelnya sekalian.

S: How about the database and tables’ structure?


CREATE DATABASE contacts_db;
CREATE TABLE contacts (
    id INT PRIMARY KEY AUTO_INCREMENT,
    first_name VARCHAR(255) NOT NULL,
    last_name VARCHAR(255) NOT NULL,
    email VARCHAR(255) NOT NULL,
    phone VARCHAR(255) NOT NULL
);

This SQL code creates a database called contacts_db and a table called contacts. The contacts table has five columns: id, first_name, last_name, email, and phone. The id column is an integer that serves as a unique identifier for each contact and is automatically incremented for each new contact that is added to the table. The other columns contain the first and last name, email address, and phone number for each contact. The first_name and last_name columns are required and cannot be left empty, while the other columns are optional. This table structure can be used to store and manage the contacts data for the PHP program.

Pekerjaan programmer pemula bisa ia kerjakan. Takjub sekaligus merasa ngeri.

Segera saya susul dengan pertanyaan lain untuk memastikan.

S: What kind of human jobs do you think you can replace?

Ia mencoba melegakan saya dan umat manusia.
Tapi saya masih penasaran.

S: How about jobs like customer support?

Saya lanjutkan lagi..

S: How if you get intensive and extensive training to get ready for those kind of jobs?

Betapapun demikian, saya merasa akan mulai ada pekerjaan yang selama ini dilakukan manusia bisa digantikan bot/AI.

Bagaimana menurut Anda?

ChatGPT bisa diakses di: https://chat.openai.com/chat

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: