Cody is an AI coding assistant that can help you write and understand code faster.
In this article, we'll take a closer look at this tool and answer questions like:
- What are Cody's features?
- What makes it different from other AI tools like Copilot or Codeium?
- How much does it cost?
What is Cody?
Cody is an AI-powered coding assistant with access to your entire codebase. This means that it understands your entire project structure and the information contained in your files.
With this knowledge, it can help you by explaining how your repository is structured, where specific code snippets are located, or by finding bugs in your code.
To get information about your project, you can use a chatbot interface similar to ChatGPT. It can also answer more general programming topics beyond your specific project.
Cody also offers an autocomplete feature that can help you write code faster. Just start writing a comment or a line of code, and Cody will suggest the next few lines.
On top of that, you will have access to a set of special commands that can help you improve, fix, document your code, and even generate unit tests.
You can use Cody in Visual Studio Code and a few other IDEs, like IntelliJ or Android Studio.
Let's explore Cody's most important capabilities 👇
If you have experience using AI coding assistants, you probably know how autocomplete works.
In short: As you type or write a comment, AI can provide suggestions to help you write faster and fulfill specific requests.
Autocomplete can suggest individual lines of code or even entire functions.
It uses LLMs(Language Learning Models) that have been trained on a diverse range of data. However, some programming languages may be easier to work with than others.
Cody understands your coding style and patterns and offers context-based suggestions for your current project.
That means the AI will try to mimic your writing style in order to provide code suggestions.
Cody chat allows you to ask questions about your entire codebase or a specific code snippet. You can also ask more general programming questions not specifically related to your code.
You have an option to include code from all files in your codebase. You can also use
/ to access special commands like
/explain to explain the code or
/test to generate unit tests.
For example, to analyze any file in your codebase, just open it, use the
alt + / shortcut to open the chat window, and then type the
/explain command to ask the AI for analysis.
Cody can also help you by generating code snippets, locating specific code snippets in your codebase, and visualizing the relationships between project files.
I am using the free version of Cody in Visual Studio Code, so all the responses I received from the chat were supported by Claude 2.0. If you are using the paid version, then you can switch and test different Language Learning Models.
Overall, I was very satisfied with the chatbot's output. I also compared it with ChatGPT by pasting my code snippet and asking it to explain. I felt that the responses from the Cody chat were usually more concise and contained only information that was truly relevant in the context of my projects.
Cody also provides quick, pre-built commands for common code actions like generating, describing, and fixing code.
By using commands, you can easily execute predefined actions in your editor, which have the necessary context to provide accurate answers regarding your codebase.
In Cody's docs, we can also read this:
Cody’s responses to commands are often better than responses to chats since they’ve been pre-packaged and prompt-engineered.
Let's test this feature out. We have access to several commands:
Most commands are self-explanatory. There are also some interesting ones, such as
/smell, which can suggest potential code improvements to help you improve code quality.
Another interesting thing is that we can create our custom commands. If you perform certain operations frequently, you can automate them with your own command.
If you want to learn more about custom commands, check out this article:
If you are using the VS Code extension, you also have access to the Code Actions feature, which can help you fix, explain, and edit your code easily.
To use this feature, simply hover over any error in your code and ask for help from Cody.
It's a simple and convenient way to fix bugs without having to use the chatbot. Based on my experience, the fixes provided are usually accurate, particularly for minor bugs.
My Thoughts on Cody
What I liked the most about Cody was how accurate its answers were. The suggestions were always based on the code in my repository, which made them much more valuable.
Using in-built commands like
/smell was especially good. The AI's suggestions were mostly relevant and very concise.
It's also interesting that the chat was based on Claude 2, not GPT. And if you're using the Pro version, you can try different LLMs for more flexibility.
In general, I like the emphasis on the AI's ability to familiarize itself with your codebase. It can be very helpful in locating logic within your files and gaining a better understanding of your project.
Would I recommend trying out Cody? Probably. It's free to use, and the codebase knowledge is very effective. You can test it out on your own projects to see if it can assist you in refactoring older code, creating unit tests, or explaining more complex concepts.
Sourcegraphy Cody Pricing
You can use Cody for free, which gives you access to:
- 500 autocompletions per month,
- 20 messages and commands per month,
- code context and personalization for a small codebase.
However, if you want to access Multiple LLM choices for chat and be able to test different ones (including Claude Instant 1.2, ChatGPT 3.5 Turbo, ChatGPT 4 Turbo Preview, Claude 2, and Mixtral), you need to switch to the Pro version.
And that's a wrap!
I really hope I was able to help you out with any questions you may have had about Cody. Speaking from my own experience, I think it's a great tool and an interesting alternative to other AI coding assistants like Copilot.
Thanks for taking the time to read this.
See you 🖐