Codeium: A first attempt

Codeium is a free AI-powered toolkit for developers. It is backed by the commercial team ExaFunction. It provides official integration with many popular editors - including NeoVim. This post makes a brief description on how was my experience while coding the messagepack refactor with Codeium enabled.

I picked Codeium over other tools, mainly because it is providing a free solution that respects GPL licenses. While other tools will charge per usage, they will also profit from the training data we provide as we consume the tool. Amazon CodeWhisperer is also a good option, but I feel a less transparent experience, and they don’t support Vim natively.

Setup

The setup is quite simple, and it involves creating an account on their website, verifying an email, and getting a token API. My NeoVim configuration is also straightforward, and is copy&paste from their suggestion:

vim.keymap.set('i', '<C-g>', function () return vim.fn['codeium#Accept']() end, { expr = true })
vim.keymap.set('i', '<c-;>', function() return vim.fn['codeium#CycleCompletions'](1) end, { expr = true })
vim.keymap.set('i', '<c-,>', function() return vim.fn['codeium#CycleCompletions'](-1) end, { expr = true })
vim.keymap.set('i', '<c-x>', function() return vim.fn['codeium#Clear']() end, { expr = true })

I stick their default 500ms delay to render suggestions (i.e. let g:codeium_idle_delay = 500). This provides a somewhat smooth experience without too much interference from annoying suggestions, as more than that might be annoying and disrupt a train of thought.

Code suggestions

I produced a total of 2315 lines of code with the refactor; from these, I accepted 357 code suggestions. Most of the suggestions needed some reviewing, but they helped a lot with boilerplate and repeated code situations. It was particularly useful to write tests, as in the example below:

output

It works very well for continuation code. Here, it predicts the target u32 type, and the 5 bytes consumption (4 of the u32 and 1 for the format tag):

output

It also performs a quite decent job on document short snippets and unsafe usage:

output

However, the core of the code will have to be written manually for correctness. It will be most helpful to complete, but the process of writing function skeletons & API is still responsibility of the developer.

Conclusion

Overall, my experience is positive. I’ll continue using it, and will expect it to help me writing documentation, tests, and boilerplate code.

Written on June 8, 2023