The Sourcery Coding Assistant¶
The Coding Assistant is Sourcery's AI powered pair programmer. You can use the Coding Assistant to help you tackle repetitive tasks like generating docstrings, ask questions to help you navigate a new code base, generate an automatic code review, and more.
The Coding Assistant is still in an early beta and is being updated on a daily basis.
Getting Started¶
The Coding Assistant is currently in a closed beta. To request early access you can sign up here.
Once you have access you should see a Sourcery icon in the VS Code sidebar and code lenses with commands start to appear above function and class definitions. Click on a code lens to trigger a command for that class or function or click the Sourcery icon to bring up the Coding Assistant sidebar.
The Coding Assistant is available for VS Code and JetBrains IDEs.
Interacting with the Coding Assistant¶
There are a number of ways you can interact with the Coding Assistant:
Chat¶
You can directly chat with the Coding Assistant in the sidebar. This is the best way to ask the Coding Assistant more open ended queries or to have it help you with creating new code (other than unit tests and docstrings)
Recipes¶
Recipes are specific common ways you can interact with a section of code using the Coding Assistant. You can trigger recipes by highlighting a seciton of code and selecting the recipe from the sidebar or by clicking on the code lens above a function or class definition.
The currently available recipes are:
- Generate Tests
- Generate Docstrings
- Explain Code
- Optimize Code
- Simplify Code
Review (Alpha Feature)¶
You can trigger a code review between two different branches to get feedback similar to what you would get from a colleagues code reivew. This feature is in early closed alpha - if you're intersted in access please let us know by emailing tim@sourcery.ai.
Troubleshooting (Alpha Feature)¶
Troubleshooting allows you to try to find the root cause of a bug or issue. You can describe and issue and provide context to the Coding Assistant and it will then do a search throughout your code base to try to find the underlying cause of the issue. This feature is in early closed alpha - if you're intersted in access please let us know by emailing tim@sourcery.ai.
Security & Privacy¶
The Coding Assistant uses a blend of third party large language models (LLMs) to help you interact with your code. While we ultimately want the Coding Assistant to be able to be able to be run fully locally, it currently needs to send pieces of your code and your conversations with the Coding Assistant to third party providers for analysis and response.
The third party LLM providers include OpenAI, Anthropic, and Google. Through the terms of the LLM providers we use, none of your code or messages will be used to train any future models or shared in any other way. Your code and messages may be retained by a third party LLM provider for up to 30 days for compliance purposes, but will not be retained beyond 30 days.
Before any of your code is analyzed you need to opt into using the Coding Assistant. Until you do so you won't be able to use the Coding Assistant functionality and none of your code will be sent.
The rest of Sourcery continues to run fully locally.
Configuring the Coding Assistant¶
At any point after you've opted in, you can choose to opt out of the Coding Assistant. Open your User Config file and change
coding_assistant:
enabled: true
to
coding_assistant:
enabled: false
You can toggle the Code Lenses (the recipe hints above a function or class
definition) on or off through the VS Code settings. Go to
Settings > Extension Settings > Sourcery
and toggle the checkbox for
Show code lens for Sourcery Coding Assistant
For JetBrains you can configure these settings by going to
Settings > Tools > Soucery
Questions and Support¶
The Coding Assistant is still in an early Beta and we're looking to make frequent updates and improvements to it. If you run into any issues or have any questions, please email us at support@sourcery.ai.