Hobbyist builds ChatGPT client for MS-DOS

0
129

[ad_1]

Enlarge / A photograph of an IBM PC 5155 transportable pc working a ChatGPT shopper written by Yeo Kheng Meng.

On Sunday, Singapore-based retrocomputing fanatic Yeo Kheng Meng released a ChatGPT shopper for MS-DOS that may run on a 4.77 MHz IBM PC from 1981, offering a novel option to converse with the favored OpenAI language mannequin.

Classic pc growth tasks come naturally to Yeo, who created a Slack client for Windows 3.1 again in 2019. “I assumed to strive one thing completely different this time and develop for a good older platform as a problem,” he writes on his weblog. On this case, he turned his consideration to MS-DOS, a text-only working system first launched in 1981, and ChatGPT, an AI-powered massive language mannequin (LLM) launched by OpenAI in November.

As a conversational AI mannequin, ChatGPT attracts on information scraped from the Web to reply questions and generate textual content. Because of an API that launched his month, anybody with the programming chops can interface ChatGPT with their very own customized utility.

Because of his new app, which may run on MS-DOS, Yeo can use a classic IBM PC-compatible pc to speak with ChatGPT over the Web. It is a comparable back-and-forth dialog as the standard ChatGPT internet interface, albeit as a text-only, full-screen utility working on the vintage machine.

Improvement challenges

A photo of an IBM PC 5155 computer running a ChatGPT client written by Yeo Kheng Meng.
Enlarge / A photograph of an IBM PC 5155 pc working a ChatGPT shopper written by Yeo Kheng Meng.

MS-DOS posed a very difficult platform for a ChatGPT shopper, missing native networking talents. As well as, Yeo focused a pc with very restricted processing energy: a 1984 IBM 5155 Portable PC, which incorporates an Intel 8088 4.77 MHz CPU, 640KB standard reminiscence, CGA ISA graphics, and MS-DOS 6.22.

To create the shopper, Yeo used Open Watcom C/C++, a contemporary compiler working on Home windows 11 that may goal 16-bit DOS platforms. For testing functions, he used a VirtualBox digital machine working DOS 6.22 to streamline the event course of, then he transferred the compiled binary to the goal IBM DOS PC for testing.

To deal with networking on the IBM PC, Yeo wanted to weave his approach by means of a number of layers. First, Yeo utilized a “Packet Driver API” customary invented in 1983. He built-in the open supply MTCP library by Michael B. Brutman into the appliance to speak with the Packet Driver, enabling networking capabilities for the shopper.

For the ChatGPT API, Yeo used OpenAI’s Chat Completion API, establishing the POST request (and parsing the JSON-formatted response) manually in C.

Nonetheless, Yeo hit a serious snag: the ChatGPT APIs require encrypted HTTPS connections. Since there are not any native HTTPS libraries for MS-DOS, Yeo needed to create an HTTP-to-HTTPS proxy that may run on a contemporary pc and translate the requests and responses between the MS-DOS shopper and ChatGPT’s safe API, appearing as a clear intermediary within the communication course of.

Yeo says that studying and writing enter to the console introduced one other problem as a result of single-threaded nature of DOS functions. He devised a technique to test and obtain keypresses with out pausing this system utilizing the MTCP web page and on-line samples as a reference.

Ultimately, the shopper works higher than Yeo anticipated, and he appears ahead to extra retro challenges sooner or later: “After experiencing this, I’ll positively be writing extra retro-software in future,” he writes in a blog post that describes his growth course of in additional element.

Yeo has launched his code (known as “doschgpt”) on GitHub if others need to run it themselves—or maybe enhance or prolong the code sooner or later. With slightly creativity, the most recent tech in AI language fashions needn’t be restricted to cutting-edge machines.

[ad_2]

Source link

LEAVE A REPLY

Please enter your comment!
Please enter your name here