Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2025-01

AI Assistant added

7 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Michael Van Canneyt

Hi,

I've added an AI assistant (AIssist) to the Lazarus codebase. Check out components/aissist.

It is a first, rudimentary, implementation that has been tested with Jan AI. (Jan AI must be installed separately, see https://jan.ai/)

It currently offers:

- a chat window in which you can chat with an AI (menu: view - AIssist chat)

- an 'Explain code' menu entry in the source menu

- a settings dialog under tools.

The actual AI REST API has been abstracted away, so it should be possible to add other APIs.

The "Jan AI" REST API is compatible to the ChatGPT API, so it should be possible to extend the implementation to include authentication and connect to ChatGPT.

All this is meant to provide a start for a CoPilot-kind of functionality, as well as a possibility to generate e.g. fpdoc documentation for code.

As said, it is an initial implementation, ideas for improvements or new functionality are of course more than welcome.

Michael.

PS. If you run the AI locally, make sure you have a good graphics card with lots of memory, or be prepared to wait for some time for answers: 30 seconds is the average wait time on my nearly-10-year old PC...

Reply by email

zeljko
to Michael Van Canneyt
Michael Van Canneyt wrote 33 lines
Hi, I've added an AI assistant (AIssist) to the Lazarus codebase. Check out components/aissist. It is a first, rudimentary, implementation that has been tested with Jan AI. (Jan AI must be installed separately, see https://jan.ai/) It currently offers: - a chat window in which you can chat with an AI (menu: view - AIssist chat) - an 'Explain code' menu entry in the source menu - a settings dialog under tools. The actual AI REST API has been abstracted away, so it should be possible to add other APIs. The "Jan AI" REST API is compatible to the ChatGPT API, so it should be possible to extend the implementation to include authentication and connect to ChatGPT. All this is meant to provide a start for a CoPilot-kind of functionality, as well as a possibility to generate e.g. fpdoc documentation for code. As said, it is an initial implementation, ideas for improvements or new functionality are of course more than welcome.

Great news, thanks ! :)

zeljko

Reply by email

Michael Fuchs
to Michael Van Canneyt: I've added an AI assistant (AIssist) to the Lazarus codebase. Check out…
Michael Van Canneyt wrote
I've added an AI assistant (AIssist) to the Lazarus codebase. Check out components/aissist.

But why?

All this is meant to provide a start for a CoPilot-kind of functionality, as well as a possibility to generate e.g. fpdoc documentation for code.

Great, we have a pile of rubbish generated and then we have documentation. THAT will help.

Michael

Reply by email

Michael Van Canneyt
to Michael Fuchs
Michael Fuchs wrote 5 lines
Am 04.01.25 um 16:02 schrieb Michael Van Canneyt via lazarus: > I've added an AI assistant (AIssist) to the Lazarus codebase. > Check out components/aissist. But why?

2 reasons:

- Because it was requested by a user.

- Lazarus is perceived as a tool from the 90-ies (last century). Showing that one can integrate an AI can help to counter that perception.

There was also no pressing reason to create the "IDE scout" plugin, but it was made with the same goal: show that Lazarus is not "outdated" and can do the same things a 'modern' (whatever that is) IDE can do.

Both are plugins, no need to use it if you don't want/like/trust it.

Show quoted text 5 lines
> All this is meant to provide a start for a CoPilot-kind of functionality, > as well as a possibility to generate e.g. fpdoc documentation for code. Great, we have a pile of rubbish generated and then we have documentation. THAT will help.

Personally, I would not let the AI generate code - every serious question I asked till now generated rubbish answers on all AIs I tried online, but for generating textual descriptions (aka "docs") of existing code, it does a reasonable job.

I'm very critical of AI as a code generating tool: we're hopefully all aware that currently an AI cannot "reason". Therefore I consider AI a serious misnomer.

But as a replacement/enhancement of google search or a documentation tool it can make sense.

You might even try to use it to generate icons. I am horrible at creating icons, and so I did some experiments, what came out was better than what I came up with...

Like most tools, you must use it correctly. I can hammer in a nail with a screwdriver, but that doesn't mean it is a good idea. Same with "AI"...

Michael.

Reply by email

Michael Fuchs
to Michael Van Canneyt: 2 reasons: - Because it was requested by a user. - Lazarus is perceived as a tool from…
Michael Van Canneyt wrote
- Lazarus is perceived as a tool from the 90-ies (last century). Showing that one can integrate an AI can help to counter that perception.

Excuse me? That's a reason? Lazarus suddenly becomes more attractive because it serves a dubious hype?

There are certainly better ways to present Lazarus as a modern tool.

Personally, I would not let the AI generate code - every serious question I asked till now generated rubbish answers on all AIs I tried online, but for > generating textual descriptions (aka "docs") of

existing code, it does a

reasonable job.

It will only lead to incorrect documentation, because everything is happily pressed through the so-called ?AI? and then no longer checked.

Don't get me wrong, certain applications of deep learning such as automated translation are a real step forward. But even there, you have to keep a close eye on what deepl and similar tools have spit out. But generating documentation from source code just like that?

I'm very critical of AI as a code generating tool: we're hopefully all aware that currently an AI cannot "reason". Therefore I consider AI a serious misnomer.

100% approval

But as a replacement/enhancement of google search or a documentation tool it can make sense.

Its use as a ?search engine? has already been advertised to me several times. Apart from the fact that I didn't see any speed advantages in the test, there is also the enormous energy consumption for all the chatbots. That alone makes me stay far away from it.

You might even try to use it to generate icons. I am horrible at creating icons, and so I did some experiments, what came out was better than what I came up with...

And uses existing works by graphic designers who were not asked whether their icons and other images were used for these tools. If I remember, it was always a big issue not to take any source code from Delphi to avoid copyright problems... Then I find this problem-free use of stolen graphic data quite strange.

But I don't want to start another ?AI? discussion here - just this much: you should think very carefully about how useful these tools really are and how much damage they cause.

g
Michael

Reply by email

Kostas Michalopoulos
to Michael Fuchs
Michael Fuchs wrote
It will only lead to incorrect documentation, because everything is happily pressed through the so-called ?AI? and then no longer checked. [...] But generating documentation from source code just like that?

This is solved very easily by not "no longer checking" what it is produced. At the end of the day, if you use AI or write the text yourself by hand, you are the one responsible for whatever you submit. You don't blame Notepad, Vim, Emacs, Word, OpenOffice or whatever other tool you may use to write text when you write something wrong, so it doesn't make sense to blame some AI either.

Its use as a ?search engine? has already been advertised to me several times.

Some AIs can be used more as an augmentation for a search engine in that you can ask them things and they can point you to various concepts. I've used Mixtral recently (an "open weights" model you can download on your PC, though i used it from duck.ai) and it produced decent results. However i used it together with a search engine to look for things (other AIs create links to sources but Mixtral didn't - however if i'm going to use some AI i'd rather use something i can run on my own PC, at least in theory until i get a better one :-P). In that way it worked more as an "optimization" to finding stuff than a replacement, but i still found it useful.

I think in general it depends *a lot* in how you use these things and how you approach the problems you want to solve yourself to see any benefit or not. Personally for example i can't think of any advantage in my workflow for AIs like co-pilot (i tried it a bit some time ago in Visual Studio in a VM and found it more annoying than helpful) but there are people who claim they can be much more productive with these.

Show quoted text 5 lines
And uses existing works by graphic designers who were not asked whether their icons and other images were used for these tools. If I remember, it was always a big issue not to take any source code from Delphi to avoid copyright problems... Then I find this problem-free use of stolen graphic data quite strange.

If copyright of the training data is the concern then AFAICT from the recent EU AI Act, using copyrighted data for training is permitted unless there is a machine readable way (the act doesn't specify the exact means, it is something that is still in the works, but there are a couple of solutions already) to opt-out from that (with an exception for some special cases, like research purposes, which can ignore the opt-out). The reasoning (AFAICT) is that AIs need to be trained in large amounts of data to work in the first place but at the same time some individuals may not want to be part of that. AFAIK the UK and the US are also going in the same direction.

Kostas

Reply by email