I am happy to finally share my first julia package, AskAI! As the name suggests, it is a straightforward tool for AI queries in REPL. Currently, it utilizes Google’s Gemini model due to its free API.
Key Features:
Use @ai to query and receive AI responses.
Use @AI to directly execute the AI response as Julia code and obtain the result.
the codes would be executed under the Main.playground
Usage
julia> using AskAI
# set your gemini key, or set ENV["AI_API_KEY"] in your startup.jl
julia> setapi("1234567890abcdef1234567890abcdef")
julia> @ai "sort a dict by the values"
function sort_dict_by_value(d::Dict)
return Dict(sort(collect(d), by=x->x[2]))
end
BTW, the query history stored in the AskAI.Brain;
more usage example:
@AI "create a new project in /tmp, name it as demo + date, activate it"
@AI "load my data as df, the data file is in /tmp/celldata.csv"
@AI "install the package to support figure display in the terminal"
@AI "plot a scatter plot of geneX and geneY, I want the geneX on axis Y"
@AI "fit a linear model to predict value of geneY from geneX,using GLM"
This sounds like an interesting approach to use AI – thanks for starting such a package.
One possible feature could be to consider integrating it with REPL similar to ?, ], or ; (help, pkg, shell mode) and have an “AI mode”. It would have to be something no usual command starts with, so maybe also some closing “thing” like }? You could try to then switch to a (maybe purple?) AI> mode. For completeness it could even display which one it uses like pkg shows its env, so maybe even AI (Gemini)>?
That’s a really nice package idea, thanks for your work!
But you definitely should change the example in the Readme, because Dicts are unordered.
Maybe we should feed some Julia trivia to the AI in the beginning of each session?
This is pretty neat, thank you for sharing this. With Gemini gaining more and more prominence, it’s nice to see first-hand support for it from the REPL.
It doesn’t look like this doesn’t involve any fine-tuning or context-access to the AI, so it would be interesting to see how the results compare with something like AIHelpMe.jl - whether the Gemini model is better enough to offset its lack of specialization.
Note that JuliaHub also has their own “AskAI” feature on their website - at first I assumed this was related to that. It’s a generic enough name, and it doesn’t seem too actively maintained anyway, but it might be worthing adding a disclaimer to say this is unrelated to the JuliaHub AskAI.
using Pkg
module playground end
pkg"activate --temp"
pkg"add https://github.com/AIBioLab/AskAI"
using AskAI
read("gemini-api-key.txt", String) |> AskAI.setapi
@ai "what is a dog?"
Thanks for your feedback! You’re absolutely right—this implementation doesn’t involve fine-tuning, it works directly but can be adjust by setting prompt, like AskAI.Brain.Prompt = “your prefer prompt” would give some improvement for the AI answer ( anyway in most cases the AI answer should be reviewed)
Also, appreciate the note about JuliaHub’s ‘ask ai ’ feature on their webpage—I’ll make sure to clarify that this is an independent project to avoid any confusion. Thanks for pointing that out!