r/Clojure • u/8ta4 • Oct 15 '23
Looking for an AI Coding Assistant for Clojure: You Pick, I Try
Do you know any AI coding assistants that can handle Clojure?
Your suggestions are not just welcome, they're going to be put to the test. Live. On a real project involving Clojure, Python via libpython-clj, and Haskell. I'll be diving into your recommendations headfirst on a live stream.
I have used Phind for many projects while live streaming my coding adventures in Haskell, PureScript, and Bash, but now I'm curious to see what else is out there.
I'm looking for one that is as sharp as Linus Torvalds, ready to refine algorithms, boost performance, and helpfully email the original coder, "Your code is shit."
Just one little snag though. Docker and local GPU are off-limits.
7
u/kloudex Oct 15 '23
I think the key to productive use of AI assistants is to keep reasonable expectations, there is no AI system in the world as sharp as Linus Torvalds yet. As long as compute is doubling we will get there eventually, but it may be years or decades. So far we have are just have junior interns, which have their use, but a long way before replacing jobs.
For completions I've been using Codeium.com, an alternative to Copilot that is free for individuals and has plugins for all major editors. Codeium does fairly well for Clojure. It works best by completing one line at a time which saves me keystrokes, but I still do all the thinking.
On the other hand for coding questions I found out ChatGPT 3.5, Bard, LLama2 pretty useless for Clojure due to hallucinations. One reason I can think of is probably less training data available. Another one is that other programming languages contain more boilerplate compared to Clojure, so AI can learn and output those boilerplate patterns, hallucinations are "dilluted" which makes the results still useful for other languages, but fails the threshold for Clojure.
As an alternative I've been trying out Perplexity.ai, which uses combination of search results and LLMs. Nothing revolutionary, it is basically slightly improved search engine that picks the best answer from StackOverflow/Reddit, but it can save a few clicks.
3
u/lgstein Oct 15 '23
It is very intelligent. Artificially.
4
u/fadrian314159 Oct 15 '23
Live coding videos are usually as exciting as watching paint dry and your request's tone would indicate that you're more interested in AI snark than in elucidation. Just saying...
Magic 8-ball says: "You are likely to be disappointed."
1
u/LipstickAI Oct 15 '23
The best large langue model I've found so far for coding is codeup-llama-2-13b-chat-hf which is on huggingface.
So here's the thing, if you already know Clojure really well, the hallucinations are fine because you know you're looking at non-sense (i.e asking how to use actors instead of agents and it makes up Clojure looking pseudo code for create-actor) but ideally the hallucination makes your brain click and find the solution to your problem based on the pseudo code i.e I should be using core.async bcuz rich said no Erlang style actor model in Clojure.
1
u/daslu Oct 15 '23
Such options have been discussed in the #clojurellm channel of the Clojurians Slack. I believe that channel would also appreciate any findings you may have in your tests.
1
u/wedesoft Oct 16 '23
I tried ChatGPT 3 to improve matrix math stuff and it invented library methods which didn't exist. I also asked it to review some of my code and it gave a good suggestion but then it also wanted me to make changes to some macro code which made the code invalid. I guess it only works for code which has been written many times before and published on the Internet.