Wednesday, December 25, 2024

Delphi and AI [3]: The meaning of Christmas

It's the time of the year to be merry and have fun, so no code today!

I've decided to ask our future AI overlords about the meaning of Christmas. The Delphi way, of course!

Today I'm posting just the answer I liked the most. You can read the others on GitHub.

Happy holidays, fellow programmers! And remember - Delphi, it is the way!

Happy holidays!
As befits an article on AI-generated content, the image was created by Midjourney.

Tuesday, December 17, 2024

Delphi and AI [Intermission]: Introducing Chatterbox

t’s great that Embarcadero has added an AI Chat window to RAD Studio, but let’s be honest—the implementation is lacking. As one participant at a recent workshop noted: “It looks like someone wrote it two hours before the release.” Sadly, I have to agree. The AI Chat feature is practically useless if you intend to use AI for anything more than a quick demo.

That’s when I started considering better ways to interface with LLMs. Instead of searching for an alternative, I decided to build my own AI chat interface. It’s called Chatterbox, and it’s fully open source. You can find it on GitHub under a “do with it (almost) whatever you want” license.

To start using Chatterbox, you can either build it from source or download the precompiled EXE from GitHub (currently available only for Windows 32-bit). The app is written with FireMonkey, so—at least theoretically—it can also be built for macOS, iOS, Android, and Linux. However, I haven’t tested it on platforms other than Windows.

To build Chatterbox, you’ll need the following libraries: Spring4D, DCPCrypt2, and TAES. Links to these dependencies are included in the README file.

Wednesday, December 11, 2024

Delphi and AI [2]: Clipboard Monitor

While preparing for my Delphi and AI workshop, I decided to keep a log of all my interactions with AI helpers in a file for later analysis. Initially, I searched for an existing utility to log clipboard changes to a file (and I found one), but then I thought—why not ask the AI helpers to help me create one? After all, it’s not a big problem: set up a timer, check if the clipboard content changes, and log the content to a file. What could be simpler?

I posed the same question to all five engines:

"I want to create a Delphi application that would monitor clipboard content (on Windows) and append clipboard content to a log file each time the clipboard has changed (and has a text inside)."

Let's see how they performed!

Logs and code are available here.

Saturday, December 07, 2024

Delphi and AI

Recently, I led a workshop in Slovenia where we explored the current state of AI in relation to Delphi programming. (A note to participants: the slides are finally online—apologies for the delay!) The initial results were, let’s say, interesting enough to warrant further study.

Now, let’s see how today’s "state-of-the-art" AIs perform with Delphi programming!

The contenders are:

  • OpenAI with the o1-mini model (my testing suggests that it gives better results than chatgpt-4o)
  • Ollama with codellama:13b model (the largest model I can run on my NVidia 4090)
  • Gemini with gemini-pro (currently pointing to gemini-1.5-pro)
  • Claude with claude-3-5-sonnet-latest (at this moment this resolves to claude-3-5-sonnet-20241022)
As I care for the privacy of the code I send to these tools, I'm using a paid version of Gemini.

These four engines I'll be using directly from the RAD Studio, most of the time through the "AI Chat" panel. 

When the privacy wouldn't be a concern, I'll also be using:
  • CoPilot via Microsoft Edge (I use it a lot and I like it for general-purpose questions with googlable answers)
All chat logs will be published on GitHub