I have created a new Delphi application called ChatLLM for chatting with Large Language Models (LLMs). Its primary purpose is to act as a coding assistant.
Features:
Supports both cloud based LLM models (ChatGPT) and local models using Ollama.
Supports both the legacy completions and the chat/completions endpoints.
The chat is organized around multiple topics.
Can save and restore the chat history and settings.
Streamlined user interface.
Syntax highlighting of code (python and pascal).
High-DPI awareness.
The application uses standard HTTP client and JSON components from the Delphi RTL and can be easily integrated in other Delphi applications.
You do not need an API key to use Ollama models and usage is free. It provides access to a large number of LLM models such as codegemma from Google and codelllama from Meta. The downside is that it may take a long time to get answers, depending on the question, the size of the model and the power of your CPU and GPU.
Chat topics
The chat is organized around topics. You can create new topics and move back and forth between the topics using the next/previous buttons on the toolbar. When you save the chat all topics are soved and then restored when you next start the application. Questions within a topic are asked in the context of the previous questions and answers of that topic.
Screenshots:
Settings using gpt-3.5-turbo, which is cheaper and faster than gpt-4:
UI:
Further prompting:
The code is not actually correct (Serialize returns a string) but it is close.
If you want to test ChatLLM you can download the executable.