Thursday, July 24, 2025

Integrating LLM engines in your Delphi app with Chatterbox

But the real changes happened under the hood.

I’ve refactored the codebase to fully separate the AI client logic from both the UI and the network layer. And what does that mean for you? It means you can now use the Chatterbox AI libraries directly in your own code.

Let me say that again, loud and clear:

You can now use Chatterbox AI libraries from your code!

To test this, I created a very basic demo called EngineDemo. And naturally, for this announcement, I had to explain how the demo uses the Chatterbox libraries.

Since this was a brand-new development that the AI had no prior knowledge of, I decided to revisit an experiment I mentioned in a previous post—one that was only partially successful. This time, I took a different approach. But more on that in the next post.

For now, take a look at what ChatGPT had to say on the topic. Just keep in mind: this wasn’t a simple “click and publish” process. ChatGPT and I had a long back-and-forth, and the result of that collaboration is the article below.

Sunday, July 13, 2025

Delphi and AI [8]: Write me an article about ComputeCore

This was supposed to be an article comparing three major AI players in their ability to write technical articles. In preparation, however, I made some mistakes ... :(

When I prepared for the initial article, I asked them to fetch the data from https://github.com/gabr42/ComputeCore/blob/main/ComputeCore.pas and write about it. (See the end of this article for the initial query and results.) At that moment, however, that link was not public yet. All three AIs ignored that and happily wrote about the code they knew nothing about. It was only Claude that complained about the bad link but I missed that while checking the results. 

So I decided to rerun the experiment on all platforms. I started by asking the engines the following question: 

Can you accesss https://github.com/gabr42/ComputeCore/blob/main/ComputeCore.pas and provide an overview of the code in one paragraph?

This worked with ChatGPT but both Claude and Gemini complied that they cannot access the link. I had to rerun the query with the link to the raw file for the latter two to work:

Can you accesss https://raw.githubusercontent.com/gabr42/ComputeCore/refs/heads/main/ComputeCore.pas and provide an overview of the code in one paragraph?

Analyzing the answer shows that the answers were not done purely on the basis of the linked code. Both Claude and Gemini have included details that they got from my previous article on ComputeCode.

In the answers below I marked hallucinated misinformation with red and information that was obviously retreived from different sources with blue.

Saturday, June 28, 2025

ComputeCore - A Simple Parallel Task Framework

Today, I want to talk about a small multithreading kernel (framework, library, or whatever you want to call it) that I've recently helped develop for the Spring4D project.

ComputeCore is a lightweight parallel processing framework for Delphi that lets you easily run CPU-intensive tasks across multiple threads. Its goals are straightforward: to run (possibly compute-heavy) tasks concurrently, allow tasks to spawn child tasks, and expose a very simple interface for the caller.

It will eventually be published as Spring.Threading, but until that happens, we can examine the almost-final version at https://github.com/gabr42/ComputeCore. In Spring4D, it will run the parallel implementation of the new sorting algorithm, but that doesn't mean it is only useful for one specific job! It is indeed a completely open (although intentionally simple) framework that can be used for your projects too.

[This article was written with the help of an AI. My next article will explain this decision and the writing process.]

Friday, April 04, 2025

Run your Delphi programs in a browser

Next Wednesday I'll be talking about Delphi and TMS Web Core in Ljubljana. As the presentation will be in Slovenian language, so is the rest of this post.

Sunday, February 02, 2025

Delphi and AI [7]: How good are local DeepSeek models (for Delphi)

Due to potential privacy concerns with DeepSeek servers (we’re unsure if the data sent over the paid API is kept private), I looked into some smaller DeepSeek models available on the Ollama.com site. These models use less complex AI with fewer parameters than the online version, but they might still be good enough for an average Delphi programmer. We’ll see.

For testing, I used a powerful RTX 4090 card with 24 GB of memory. If your graphics card has less memory, your selection of useful models will be more limited.

I asked all models the same two questions: one on a general programming topic and another specific to the FireMonkey platform. The first question was:

"I have a multiline string containing newline ASCII characters (TMemo.Text). I want to change it to a single-line string with only printable ASCII characters. I could do that with BASE64 encoding, for example. I would, however, like to keep the text as much readable as possible by "encoding" only non-printable characters. Is there a simple way to do that?"

You can check Codellama’s response in an older post (Codellama being the only local model I had tested so far): Delphi and AI [5]: Encoding Multi-line Strings.

Last week, I asked the same question to the online DeepSeek-Reasoning model. Check the answers in this post: Delphi and AI [6]: DeepSeek-Reasoning Model.

The second question was:

"How can I copy text to clipboard in a Delphi Firemonkey application?"

Read here for Codellama’s response: Delphi and AI [4]: Device-ndependent clipboard.

The answer from the online DeepSeek-Reasoning model can be found at the end of this post.

Let’s see how the models are performing! As always, full logs are available on GitHub.

Thursday, January 30, 2025

Chatterbox v0.2 - Now with DeepSeek support!

As I’m writing this, a new Chatterbox release is available on GitHub. As with the initial release, you can either download the source and recompile it or grab an executable (Windows, 32-bit) from the release.

(If you have never heard of Chatterbox, you should probably read the initial release article.)

The biggest change since v0.1 is support for DeepSeek AI.

Friday, January 24, 2025

Delphi and AI[6]: DeepSeek reasoning model (Encoding a multi-line string)

An interesting AI has just appeared on my radar - DeepSeek. It exposes a "normal" chat model deepseek-chat and a "reasoning" (that's the interesting part) model deepseek-reasoning. While working on DeepSeek support for the Chatterbox (more on that in few days) I thought it would be interesting to ask the "reasoning" model the "multi-line string encoding" question that every other AI has failed.

Warning: DeepSeek privacy policy states: "When you use our Services, we may collect your text or audio input, prompt, uploaded files, feedback, chat history, or other content that you provide to our model and Services." Don't send any private or proprietary information in the chat!

The log is provided on GitHub.

Just as a reminder, the question was:

"I have a multiline string containing newline ASCII characters (TMemo.Text). I want to change it to a single-line string with only printable ASCII characters. I could do that with BASE64 encoding, for example. I would, however, like to keep the text as much readable as possible by "encoding" only non-printable characters. Is there a simple way to do that?"

Sunday, January 19, 2025

Delphi and AI[5]: Encoding a multi-line string

Recently I had to convert a multi-line string into a single-line string value for storage (ignore the 'why' of it; let's just blame it on a legacy code). My first idea was to do a Base64 encode of the string, but I was in a mood for some fun and so I asked my friendly AI helpers:

"I have a multiline string containing newline ASCII characters (TMemo.Text). I want to change it to a single-line string with only printable ASCII characters. I could do that with BASE64 encoding, for example. I would, however, like to keep the text as much readable as possible by "encoding" only non-printable characters. Is there a simple way to do that?"

Let's see what they came up with!

Full transcripts, as usual, are on GitHub. This time I had also created a program containing all implementations.

Sunday, January 05, 2025

Delphi and AI [4]: Device-independent clipboard

While working on Chatterbox I ran into number of problems, most of them caused by my limited knowledge of device-independent programming with Firemonkey. One particular challenge was copying data to the clipboard - something that is AFAIK available on all supported platforms. So I asked my friendly AI helpers:

"How can I copy text to clipboard in a Delphi Firemonkey application?"
As always, all logs are available on GitHub.