Cody for Web
Learn how to use Cody in the web interface with your Sourcegraph.com instance.
In addition to the Cody extensions for VS Code and JetBrains IDEs, Cody is also available in the Sourcegraph web app. Community users can use Cody for free by logging into their accounts on Sourcegraph.com, and enterprise users can use Cody within their Sourcegraph instance.
Initial setup
Create a Sourcegraph.com account by logging in through codehosts like GitHub and GitLab or via traditional Google sign-in. This takes you to Sourcegraph’s web interface. From here, there are two ways to access the Cody chat:
- Run any search query via Code Search and click the Cody button on the left to open the chat window
- Directly click the Cody tab from the top header to open the chat interface
Enterprise users can also log in to their Sourcegraph.com Enterprise instance and use Cody in the web interface.
Chat Interface
The chat interface for Cody on the web is similar to the one you get with the VS Code editor extension. If you click the Cody chat from the top header, you will see a Start new chat + button in the bottom left sidebar with the chat editor. All your previous chats appear in this left sidebar. To delete any chat, hover over the chat and click the Delete icon.
The chat interface with your Code Search queries is operated per chat. You cannot run multiple chats and store them in parallel. A new chat window opens whenever you click the Cody button from the query editor or the top header.
LLM Selection
Sourcegraph.com users with Cody Free and Pro can choose from a list of supported LLM models for a chat. Claude Sonnet 3.5 is the default LLM model, but users can select the LLM of their choice from the drop-down menu.
Users on an Enterprise Sourcegraph instance do not have the option to choose an LLM model. Their site admin will configure the default LLM model for chat. However, Enterprise users with the new model configuration can use the LLM selection dropdown to choose a chat model.
Selecting Context with @-mentions
Cody chat with a Sourcegraph.com instance allows you to add files and symbols as context in your messages.
- Type
@file
and then a filename to include a file as a context - Type
@
and you can also add Symbols, Files, and Repositories as context
Context retrieval
When you start a new Cody chat inside the search query window, the chat input window opens with a default @-mention
context chip for all the context it intends to use. This context is based on your current repository and current file.
At any point in time, you can edit these context chips or remove them completely if you do not want to use these as context. Any chat without a context chip will instruct Cody to use no codebase context. However, you can always provide an alternate @-mention
file or symbols to let Cody use it as a new context source.
When you have both a repository and files @-mentioned, Cody will search the repository for context while prioritizing the mentioned files.
Rerun prompts with different context
If Cody's answer isn't helpful, you can try asking again with a different context:
- Public knowledge only: Cody will not use your own code files as context; it’ll only use knowledge trained into the base model
- Add context: Provides @-mention context options to improve the response by explicitly including files, symbols, and remote repositories
Prompts
Prompts and the Prompt Library are supported in Cody for Web. You can access these from the prompts selector drop-down in the chat interface. Read more about prompts and the Prompt Library here.