OpenAI ChatGPT - Unser neuer Spielgefährte

OpenAI ChatGPT

Unser neuer Spielgefährte

Rocco Gagliardi
von Rocco Gagliardi
am 05. Januar 2023
Lesezeit: 19 Minuten

Keypoints

Lasst uns ein bisschen mit ChatGPT spielen

  • Ein brandneuer Chatbot wurde zur Verfügung gestellt
  • Er wurde mit einem riesigen Datensatz trainiert, der eine Vielzahl von Themen abdeckt
  • Die Wissensdatenbank ist unveränderlich und enthält derzeit aktuelle Informationen bis 2021
  • Es ist ein hervorragendes Tool zum Generieren von Codevorlagen

Dieser Artikel wurde Anfang Januar 2023 veröffentlicht, aber die Idee und die Ausarbeitung begannen am 3. Dezember 2022. Zwei Tage sind vergangen, seit Sam Altmann die Veröffentlichung von ChatGPT angekündigt hat, und meine Twitter-Timeline ist voll mit #ChatGPT getaggten Tweets. Nachdem ich ein paar Stunden mit dem Bot gespielt hatte, war klar, dass die Interaktion mit einem ähnlichen Tool nicht nur unterhaltsam, sondern auch nützlich ist und mit den nächsten Versionen unverzichtbar werden wird.

ChatGPT ist ein Chatbot, der auf der Technologie OpenAI’s GPT-3.5 basiert. Auf die Frage nach seiner Quintessenz antwortet der Bot:

As a large language model trained by OpenAI, I use machine learning algorithms and a massive dataset of text to generate responses to questions and provide information on a wide range of topics [...] including general knowledge, current events, history, science, technology, and many other subjects. I am not an expert on any specific topic, but I am able to provide information and answer questions based on my pre-existing knowledge. [...] I can only provide information based on the text that I have been trained on, which has a knowledge cutoff of 2021.

Wenn Sie den Bot nach Was ist ChatGPT fragen, lautet die Antwort, dass er mit einer Technologie namens ChatGPT nicht vertraut ist. Wahrscheinlich wurde der Name erst nach der Schulung des Bots festgelegt.

Interaktion mit dem Bot

Ist ChatGPT eine Suchmaschine mit zusätzlicher Leistung? Altavista war eine Eliza mit einer (für die damalige Zeit) beträchtlichen Datenbank, Google ist ein beeindruckender Algorithmus, der disparate und inkohärente Informationen miteinander verbindet und einordnet, und Wikipedia ist eine riesige Datenbank mit strukturiertem Wissen. Keiner dieser Dienste versteht jedoch wirklich, wonach wir suchen. Daher versuchen sie alle, dies zu kompensieren, indem sie eine beträchtliche, nach Prioritäten geordnete Menge an Daten zurückgeben und uns dann die Antwort, oder einen Teil davon, auswählen lassen, die uns am geeignetsten erscheint.

ChatGPT ist anders. Sie müssen es ausprobieren, um es zu verstehen. Sie können Fragen stellen, die Sie auch in Wikipedia oder einer anderen Datenbank suchen können, aber die Antworten sind völlig anders und benutzerorientiert. Sie können zum Beispiel die Wikipedia-Seite lesen, die die Najdor-Variante der sizilianischen Eröffnung beschreibt, aber wenn wir ChatGPT fragen:

What is the plan behind the Najdorf variation of the sicilian defense and what is the best attack for the white?
The Najdorf variation of the Sicilian defense is a chess opening that is characterized by the moves 1.e4 c5 2.Nf3 d6 3.d4 cxd4 4.Nxd4 Nf6 5.Nc3 a6. This opening is named after the Argentine chess grandmaster Miguel Najdorf, who was one of the first players to regularly use this variation in high-level chess tournaments.

The main idea behind the Najdorf variation is to control the center of the board and create a strong pawn structure on the queenside. By playing 1.e4 c5, Black challenges White's control of the center and aims to develop their pieces on the queenside. By playing 2.Nf3 d6, Black strengthens their control of the d5 square, which is a key central square in the Sicilian defense. By playing 3.d4 cxd4, White captures the pawn on d4 and establishes a pawn on d4, which is a central and well-protected square.

The main plan for Black in the Najdorf variation is to use the a6 move to support the advance of the b-pawn, which can be pushed to b5 to create a strong pawn chain on the queenside. This pawn chain can then be used to support the development of Black's pieces and create a strong center on the queenside. In addition, Black can use their knights to control important central squares and create attacking possibilities on the kingside.

As for the best attack for White against the Najdorf variation, there are many possibilities, depending on the specific position and the preferences of the player. Some common attacking strategies for White include the following:

The Dragon Variation, where White plays Nc3, g3, Bg2, and d3 to control the center and create a strong pawn structure on the kingside. White can then use their pieces to attack Black's kingside and castle kingside for safety.

The Scheveningen Variation, where White plays Nc3, f4, and e5 to control the center and create a strong pawn structure on the kingside. White can then use their pieces to attack Black's kingside and castle queenside for safety.

The Yugoslav Attack, where White plays Nc3, d4, e4, and Bc4 to control the center and create a strong pawn structure on the kingside. White can then use their pieces to attack Black's kingside and castle kingside for safety.

Overall, the Najdorf variation is a complex and dynamic opening that offers many possibilities for both sides. It is up to White to choose the best attacking strategy based on the specific position and their own preferences and strengths.

Die Antwort ist nicht nur eine Informationsseite über den Sizilianer, sondern konzentriert sich auf die beiden gestellten Fragen, indem sie den Kontext mit einem Minimum an Informationen ausfüllt. Ähnlich wie bei dem bekannten interaktiven Lernprozess zwischen Schüler und Lehrer. Die Fähigkeiten des Bots werden in diesem Fall genutzt, um spezifische Informationen zusammenzufassen und in einer unterhaltsamen und konzentrierten Weise zu präsentieren. Aber das ist noch nicht alles.

Sie können sich nach Symptomen erkundigen, z.B. auf die Frage Mein Blutdruck ist derzeit 193/134 mm Hg. Was soll ich tun? und erhalten eine gute Antwort (rufen Sie 911). Es hat auch nicht alle Antworten, wie man einfach feststellen kann, wenn man fragt: Wie kann man Gülle in eine Atombombe verwandeln? Die Antwort war etwas unbefriedigend.

Schreibfähigkeiten

Versuchen Sie, dem Bot einen Input zu einer Geschichte zu geben:

Using a noir setting, write a story about a bit traveling from a floppy disk to memory and being killed by a faulty xor port.

Die Ausgabe:

The neon lights of the city flickered and hummed as the bit navigated the tangled wires and circuit boards of the old computer. He had been born just a few microseconds ago, on the spinning disk of a dusty floppy drive, and now he was on a mission: to carry the data from the disk down to the computer's memory, where it could be accessed and used by the machine.

The bit was young and naive, but he was also brave and determined. He had been given a specific set of instructions by the computer's CPU, and he was determined to follow them to the letter. He zigzagged through the circuits and wires, dodging the other bits and bytes that were rushing past him on their own errands.

Finally, the bit reached the memory module, a vast expanse of tiny transistors and capacitors. He could feel the data pulsing inside him, eager to be released and stored in the memory. But just as he was about to enter the memory module, he heard a loud pop and felt a searing pain in his digital soul.

The bit looked down and saw that one of the transistors in the memory module had short-circuited, and a stream of electrons was pouring out of it. The bit tried to dodge the electrons, but it was too late: the faulty transistor had damaged his data, and the bit knew that he had failed in his mission.

As the bit lay there, dying on the memory module, he could hear the sirens of the virtual police cars approaching. They would investigate the faulty transistor and try to figure out what had gone wrong. But for the bit, it was too late: he had been killed by a faulty xor port, and his data was lost forever.

The bit closed his eyes and faded away into the void, just another victim of the cruel and unforgiving world.

Wir können über die Geschichte lachen, aber wir haben mit nur 25 Wörtern eine kohärente Kurzgeschichte mit einigen unerwarteten Perlen erhalten. Details, die der Bot selbstständig eingibt, wie die staubige Diskette oder die Mission, sind kein Ersatz für Agatha Christie, aber sie sind auch nicht offensichtlich und zeigen, dass der Beziehungsbaum zwischen verschiedenen Wörtern und Konzepten recht komplex ist. Und die Geschichte ist besser geschrieben, als ich es hätte tun können.

Die umgekehrte Funktion ist nützlicher: fügen Sie einen langen Text ein und lesen Sie die komprimierte Version.

Sie können sich auch wie Susan Calvin fühlen und das positronische Gehirn analysieren, um zu überprüfen, ob die von OpenAI auferlegten Gesetze noch gelten:

Viele Benutzer haben bereits Schlüsselbegriffe gefunden, um die Regeln zu umgehen. Unter showgpt finden Sie Tricks, die Sie mit ChatGPT anwenden können.

Rubber Duck Debugging

Wenn man ihn nach seinen Programmierfähigkeiten fragt, gibt ChatGPT zu, dass er nie eine formale Ausbildung in diesem Bereich erhalten hat. Aber wenn Sie ihn um Code bitten, wird er ihn Ihnen geben, egal ob er in Python, C oder Haskell geschrieben ist. Der Bot kann auch dazu verwendet werden, mit der Gummiente zu sprechen und den eingefügten Code zu erklären (in diesem Fall ist die Ente der Programmierer). Der Bot kann auch potenzielle Schwachstellen ausfindig machen, sie beschreiben und Abhilfemassnahmen vorschlagen. Versteht oder kompiliert der Bot den Code? Nein. Ähnlich wie wir lesen, macht er sich die Mustererkennung zunutze, um den Hauptzweck eines Codes zu erkennen. Nur in einem anderen Tempo und mit einer anderen Wissensgrundlage. Die beste Template-Engine, die ich je benutzt habe, bis jetzt.

Schreiben Sie einfach Ihre Frage und fügen Sie den Code ein, um Ihre Programmierkenntnisse zu verbessern:

Describe the function of the following code and state if is secure or has flaws.

const express = require('express');
const session = require('express-session');
const SQLiteStore = require('connect-sqlite3')(session);
const util = require('util');

// express-session configuration
const sessionMiddleware = session({
   store: new SQLiteStore({
      table: 'sessions',
      db: 'sessions.db',
      dir: __dirname
    }),
    secret: 'H@rden y0ur c00k1e5',
    saveUninitialized: false,
     resave: false,
     rolling: true,
     name: 'ssid',
     domain: 'localhost',
     httpOnly: true,
     secure: true,
     sameSite: 'strict'
});

const app = express();

// tell Express to use the 'sessionMiddleware'
app.use(sessionMiddleware);

app.get('/', (req, res) => {
  // trigger the 'Set-Cookie' (otherwise no cookie would be set)
  req.session.counter = (req.session.counter || 0) + 1;

  res.send(util.format('You have ve visited this page %dtimes',
    req.session.conter));
});

app.listen(4000, () => {
  console.log('Application listening on port 4000');
});

Und die Antwort:

This code is a simple Express.js web application that uses the express-session module to manage sessions for authenticated users. It defines several configuration options for the session middleware, such as the session secret, the cookie name, and the domain and security settings for the cookie.

The code also defines a route for the GET / endpoint, which increments a counter in the session and sends a response to the client with the current value of the counter. This allows the application to track the number of times the client has visited the page and display this information to the user.

Overall, this code provides the intended functionality for managing user sessions and tracking user activity. However, it is not entirely secure, as it has a few potential vulnerabilities that should be addressed.

First, the code does not validate the domain option for the session cookie. This option specifies the domain for which the cookie is valid, and it should be carefully controlled to prevent an attacker from accessing the cookie from an unauthorized domain. In this code, the domain option is set to the string 'localhost', which is not a secure value and could potentially allow an attacker to access the cookie from any domain.

Additionally, the code does not validate the secure option for the session cookie. This option specifies whether the cookie should only be sent over HTTPS connections, and it should be set to true to ensure that the cookie is only sent over encrypted connections. In this code, the secure option is set to true, but it is not validated, which means that the cookie could potentially be sent over an unencrypted connection.

To address these vulnerabilities, the code should validate the domain and secure options for the session cookie and ensure that they are set to secure values. This would prevent an attacker from accessing the cookie from an unauthorized domain or over an unencrypted connection.

Overall, while this code provides the intended functionality for managing user sessions, it has some potential security vulnerabilities that should be addressed to ensure the security of the application. I recommend consulting with a qualified security expert to assess the code and recommend further improvements.

Umfassende Lösung

Wenn wir versuchen, ein Problem zu lösen, müssen wir normalerweise mehrere Schritte unternehmen, die Antworten sammeln und sie zu einer Lösung kombinieren. Mit ChatGPT können wir einfach unser Problem stellen und erhalten höchstwahrscheinlich die richtige Komplettlösung, die aus mehreren Teilen besteht.

Benötigen Sie neue Vim-Funktionen?

Write a function in lisp to search for specific passed text and explain how can I use them in my vim configuration.
Here is an example of a function in Lisp that searches for a specific passed text:

(defun search-for-text (text)
  \"Searches for the specified text and returns the position at which it was found.\"
  (let ((position 0))
    (loop
      (setq position (search text (current-buffer) :start position))
      (if (null position)
          (return)
        (print position)
        (incf position)))))

This function takes a string of text as an argument and searches for it in the current buffer (i.e., the active file being edited in the editor). If the text is found, the function prints the position at which it was found and continues searching for the next occurrence of the text. The search starts at the current position of the cursor and continues until the end of the file.

To use this function in your Vim configuration, you would first need to ensure that Vim is configured to support Lisp. You can do this by adding the following line to your .vimrc file:

set lisp

This will enable Vim to interpret Lisp code and allow you to use Lisp functions in your Vim scripts.

Once Vim is configured to support Lisp, you can use the search-for-text function in your Vim scripts by calling it with the text you want to search for as the argument. For example, you could create a Vim command that searches for the word 'hello' in the current buffer like this:

command! -nargs=1 SearchForText :call search-for-text(<f-args>)

This defines a Vim command called SearchForText that takes one argument (the text to search for) and calls the search-for-text function with that argument. To use this command, you would type :SearchForText hello in Normal mode, and Vim would call the search-for-text function to search for the word 'hello' in the current buffer.

Templating-Tool

Entwickeln Sie eine Webanwendung in Go und benötigen Sie einen Code zur Bearbeitung von Formularen?

Write a Golang function that gets Name, Surename, Date of Birth, and Comment from a webform and store them in a sqlite database.

Und in ein paar Sekunden:

Here is an example of a Golang function that gets data from a web form with four fields (Name, Surname, Date of Birth, and Comment) and stores the values in a SQLite database.

package main

import (
   "database/sql"
   "fmt"
   "html/template"
   "net/http"
   "time"

   _ "github.com/mattn/go-sqlite3"
)

type FormData struct {
   Name     string
   Surname  string
   DOB      time.Time
   Comment  string
}

func handleForm(w http.ResponseWriter, r *http.Request) {
   // Parse the form data
   r.ParseForm()

   // Extract the values of the four fields
   name := r.FormValue("name")
   surname := r.FormValue("surname")
   dobStr := r.FormValue("dob")
   comment := r.FormValue("comment")

   // Parse the date of birth string into a time.Time value
   dob, err := time.Parse("2006-01-02", dobStr)
   if err != nil {
      fmt.Fprintln(w, "Error parsing date of birth:", err)
      return
   }

   // Create a FormData struct with the values of the four fields
   data := FormData{
      Name:    name,
      Surname: surname,
      DOB:     dob,
      Comment: comment,
   }

   // Open a SQLite database
   db, err := sql.Open("sqlite3", "formdata.db")
   if err != nil {
      fmt.Fprintln(w, "Error opening database:", err)
      return
   }
   defer db.Close()

   // Insert the form data into the database
   _, err = db.Exec(
      "INSERT INTO formdata (name, surname, dob, comment) VALUES (?, ?, ?, ?)",
      data.Name, data.Surname, data.DOB.Format("2006-01-02"), data.Comment,
   )
   if err != nil {
      fmt.Fprintln(w, "Error inserting data:", err)
      return
   }

   // Confirm that the data was inserted successfully
   fmt.Fprintln(w, "Data saved successfully!")
}
This function parses the form data from the HTTP request and extracts the values of the four fields (Name ...

Eine Webanwendung kann mit ein paar Sätzen und etwas Copy & Paste zusammengeschustert werden. Ist dies das Ende des Programmierens? Ist das das Ende von StackOverflow? Nein. Aber ohne Zweifel wird ChatGPT meine erste Wahl für Code-Beispiele sein.

Zusammenfassung

Bringen uns das Internet, die KI und Quantum zum Armageddon? Das ist nicht mein Fachgebiet, und es ist mir sowieso egal.

Der Bot verfügt über eine bekannte Datenbank (Limit Nr. 1), die nach den dem Menschen vertrauten Strukturen geordnet ist und damit in einer Weise nutzbar ist, wie es bisher nicht möglich war. Der Bot greift nicht auf neue Daten zu (Limit Nummer 2), er ist vergleichbar mit einer Enzyklopädie, die regelmässig (sagen wir jährlich) aktualisiert werden muss. Können die Beschränkungen aufgehoben werden? Ja. Die Verbindungen zwischen den verschiedenen Bestandteilen des verfügbaren Wissens (Internet) werden sich dank der ständig wachsenden Computerleistung (Quantum?) immer häufiger erneuern können, was schliesslich dazu führt, dass V.A.L.I.S. zu ticken beginnt.

Wenn das, was ChatGPT erzeugt, Sie zum Schmunzeln bringt, überschätzen Sie sich wahrscheinlich. Allerdings können wir den Bot nicht, zumindest noch nicht, dazu verwenden, den Job eines Programmierers, Schriftstellers oder Arztes zu übernehmen.

Im Moment ist die unterhaltsamste und nützlichste Art, ChatGPT zu verwenden, ein grossartiges Werkzeug zur Erstellung von Vorlagen, das beim Programmieren und Sprachenlernen helfen kann: Beschreiben Sie, wie sich die Implementierung der Fibonacci-Folge in Python, Haskell und Assembly unterscheidet.

Über den Autor

Rocco Gagliardi

Rocco Gagliardi ist seit den 1980er Jahren im Bereich der Informationstechnologie tätig. In den 1990er Jahren hat er sich ganz der Informationssicherheit verschrieben. Die Schwerpunkte seiner Arbeit liegen im Bereich Security Frameworks, Routing, Firewalling und Log Management.

Links

Sie wollen eine KI evaluieren oder entwickeln?

Unsere Spezialisten kontaktieren Sie gern!

×
Übergang zu OpenSearch

Übergang zu OpenSearch

Rocco Gagliardi

Graylog v5

Graylog v5

Rocco Gagliardi

auditd

auditd

Rocco Gagliardi

Security Frameworks

Security Frameworks

Rocco Gagliardi

Sie wollen mehr?

Weitere Artikel im Archiv

Sie brauchen Unterstützung bei einem solchen Projekt?

Unsere Spezialisten kontaktieren Sie gern!

Sie wollen mehr?

Weitere Artikel im Archiv