diff --git a/docs/cody/clients/install-jetbrains.mdx b/docs/cody/clients/install-jetbrains.mdx index 08c901d3f..66dd2218e 100644 --- a/docs/cody/clients/install-jetbrains.mdx +++ b/docs/cody/clients/install-jetbrains.mdx @@ -153,7 +153,7 @@ If Cody's answer isn't helpful, you can try asking again with a different contex ## Context fetching mechanism -JetBrains users on the Free or Pro plan use [local context](/cody/core-concepts/context#context-selection). +JetBrains users on the Free or Pro plan use [local context](/cody/core-concepts/context#context-sources). Enterprise users can leverage the full power of the Sourcegraph search engine as Cody's primary context provider. diff --git a/docs/cody/clients/install-vscode.mdx b/docs/cody/clients/install-vscode.mdx index 662aa0c14..8b8ddca9f 100644 --- a/docs/cody/clients/install-vscode.mdx +++ b/docs/cody/clients/install-vscode.mdx @@ -213,7 +213,7 @@ If Cody's answer isn't helpful, you can try asking again with different context: ## Context fetching mechanism -VS Code users on the Free or Pro plan use [local context](/cody/core-concepts/context#context-selection). +VS Code users on the Free or Pro plan use [local context](/cody/core-concepts/context#context-sources). Enterprise users can use the full power of the Sourcegraph search engine as Cody's primary context provider. diff --git a/docs/cody/core-concepts/context.mdx b/docs/cody/core-concepts/context.mdx index 59b2069aa..c0d9b3076 100644 --- a/docs/cody/core-concepts/context.mdx +++ b/docs/cody/core-concepts/context.mdx @@ -6,28 +6,43 @@ Context refers to any additional information provided to help Cody understand an ## Why is context important? -Context and [methods of retrieving context](#context-selection) are crucial to the quality and accuracy of AI. Cody relies on its ability to retrieve context from user codebases to provide reliable and accurate answers to developers’ questions. When Cody has access to the most relevant context about your codebase, it can: +Context and [methods of retrieving context](#context-sources) are crucial to the quality and accuracy of AI. Cody relies on its ability to retrieve context from user codebases to provide reliable and accurate answers to developers’ questions. When Cody has access to the most relevant context about your codebase, it can: - Answer questions about your codebase - Produce unit tests and docs - Generate code that aligns with the libraries and style of your codebase - Significantly reduce your work that's required to translate LLM-provided answers into actionable value for your users -## Context selection +## Context sources -Cody employs various methods to gather context relevant to user input, ensuring the quality of the information provided. These methods include: +Cody uses a variety of sources to retrieve context relevant to the user input. These sources include: -- **Keyword Search**: A traditional text search approach that finds keywords matching the user input. When needed, queries are automatically rewritten to include more relevant terms. -- **Sourcegraph Search**: Sourcegraph Search API. Queries are sent to the SG instance (managed or self-hosted), and search is done using the SG search stack. Relevant documents are returned to the user IDE for use by the LLM -- **Code Graph**: Analyzing the structure of the code, Cody examines how components are interconnected and used, finding context based on code elements' relationships +- **Keyword Search**: A traditional text-based search method that finds keywords matching the user input. When needed, queries are automatically rewritten to include more relevant terms. +- **Sourcegraph Search**: The powerful native Sourcegraph Search API. Queries are sent to the SG instance (managed or self-hosted), and search is done using the SG search stack. Relevant documents are returned to the user IDE for use by the LLM. +- **Code Graph**: Analyzing the structure of the code, Cody examines how components are interconnected and used, finding context based on code elements' relationships. All these methods collectively ensure Cody's ability to provide relevant and high-quality context to enhance your coding experience. -## Context fetching mechanism +## Cody context fetching features + +Cody uses @-mentions to retrieve context from your codebase. Inside the chat window, there is an `@` icon that you can click to select a context source. Alternatively, you can press `@` to open the context picker. + +Based on your Cody tier, you can @-mention the following: + +| **Tier** | **Client** | **Files** | **Symbols** | **Web URLs** | **Remote Files/Directories** | **OpenCtx** | +| -------------- | ------------- | --------- | ----------- | ------------ | ---------------------------- | ----------- | +| **Free/Pro** | VS Code | ✅ | ✅ | ✅ | ❌ | ✅ | +| | JetBrains | ✅ | ❌ | ✅ | ❌ | ❌ | +| | Visual Studio | ✅ | ✅ | ✅ | ❌ | ❌ | +| | Cody Web | ✅ | ✅ | ✅ | ❌ | ❌ | +| **Enterprise** | VS Code | ✅ | ✅ | ✅ | ✅ | ✅ | +| | JetBrains | ✅ | ❌ | ✅ | ✅ | ❌ | +| | Visual Studio | ✅ | ✅ | ✅ | ✅ | ✅ | +| | Cody Web | ✅ | ✅ | ✅ | ✅ | ❌ | -You can @-mention files, symbols, and web pages in Cody. Cody Enterprise also supports @-mentioning remote directories to search for context in a broader scope. Cody's experimental [OpenCtx](https://openctx.org) support adds more context sources, including Jira, Linear, Google Docs, Notion, and more. +## Repo-based context -Here's a detailed breakdown of the number of repositories supported by each client for Cody Free, Pro, and Enterprise users: +Cody supports repo-based context. You can link single or multiple repositories based on your tier. Here's a detailed breakdown of the number of repositories supported by each client for Cody Free, Pro, and Enterprise users: | **Tier** | **Client** | **Repositories** | | -------------- | ------------- | ---------------- | @@ -37,14 +52,11 @@ Here's a detailed breakdown of the number of repositories supported by each clie | **Enterprise** | Cody Web | Multi | | | VS Code | Multi | | | JetBrains | Multi | - -## Context sources - -You can @-mention files, symbols, and web pages in Cody. Cody Enterprise also supports @-mentioning repositories to search for context in a broader scope. Cody's experimental [OpenCtx](https://openctx.org) support adds more context sources, including Jira, Linear, Google Docs, Notion, and more. +| | Visual Studio | Multi | ## How does context work with Cody prompts? -Cody works in conjunction with an LLM to provide codebase-aware answers. The LLM is a machine learning model that generates text in response to natural language prompts. However, the LLM doesn't inherently understand your codebase or specific coding requirements. Cody bridges this gap by generating context-aware prompts. +Cody works in conjunction with an LLM to provide codebase-aware answers. The LLM is a machine learning model that generates text in response to natural language prompts. However, the LLM needs to inherently understand your codebase or specific coding requirements. Cody bridges this gap by generating context-aware prompts. A typical prompt has three parts: @@ -54,7 +66,7 @@ A typical prompt has three parts: ## Impact of context LLM vs Cody -When the same prompt is sent to a standard LLM, the response may lack specifics about your codebase. In contrast, Cody augments the prompt with context from relevant code snippets, making the answer far more specific to your codebase. This difference underscores the importance of context in Cody's functionality. +When the same prompt is sent to a standard LLM, the response may need more specifics about your codebase. In contrast, Cody augments the prompt with context from relevant code snippets, making the answer far more specific to your codebase. This difference underscores the importance of context in Cody's functionality. ## Manage Cody context window size