Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revamp Cody PLG+ENT docs #658

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
330 changes: 314 additions & 16 deletions docs/cody/capabilities/chat.mdx

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/cody/clients/enable-cody-enterprise.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Enabling Cody on Sourcegraph Enterprise
# Cody Enterprise

<p className="subtitle">This guide will walk you through the steps to install and set up Cody with your Sourcegraph Enterprise instance.</p>

Expand Down
61 changes: 61 additions & 0 deletions docs/cody/clients/install-vscode.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,67 @@ function bubbleSort(array){
<source src="https://storage.googleapis.com/sourcegraph-assets/Docs/Media/cody-in-action.mp4" type="video/mp4" />
</video>

## Ask Cody your first question

Let's use Cody chat interface to answer your first question.

- Click the Cody icon from the sidebar in VS Code to open the chat panel
- The chat input field will show pre-added context about the files and repository it reads
- If you want to add or remove context, you can use the `@-mention` syntax
- Select your LLM via the drop-down. By default Cody will use Claude Sonnet 3.5 for chat
- Write your question or instruction to Cody and then press **Enter**.

Cody will take a few seconds to process your question, providing contextual information about the files it reads and generating the answer.

<video width="1920" height="1080" loop playsInline controls style={{ width: '100%', height: 'auto', aspectRatio: '1920 / 1080' }}>
<source src="https://storage.googleapis.com/sourcegraph-assets/Docs/Media/chat-interface-0724.mp4" type="video/mp4" />
</video>

## Ask Cody to write code

The chat feature can also write code for your questions. For example, in VS Code, ask Cody to "write a function that sorts an array in ascending order".

You are provided with code suggestions in the chat window along with the following options for using the code.

- The **Copy Code** icon to your clipboard and paste the code suggestion into your code editor
- Insert the code suggestion at the current cursor location by the **Insert Code at Cursor** icon
- The **Save Code to New File** icon to save the code suggestion to a new file in your project

During the chat, if Cody needs additional context, it can ask you to provide more information with a follow-up question. If your question is beyond the scope of the context, Cody will ask you to provide an alternate question aligned with the context of your codebase.

## Keyboard shortcuts

Cody provides a set of powerful keyboard shortcuts to streamline your workflow and boost productivity. These shortcuts allow you to quickly access Cody's features without leaving your keyboard.

* `Opt+L` (macOS) or `Alt+L` (Windows/Linux): Toggles between the chat view and the last active text editor. If a chat view doesn't exist, it opens a new one. When used with an active selection in a text editor, it adds the selected code to the chat for context.

* `Shift+Opt+L` (macOS) or `Shift+Alt+L` (Windows/Linux): Instantly starts a new chat session, perfect for when you want to begin a fresh conversation with Cody.

* `Opt+K` (macOS) or `Alt+K` (Windows/Linux): Opens the Edit Code instruction box. This works with either selected code or the code at the cursor position, allowing you to quickly request edits or improvements.

* `Opt+C` (macOS) or `Alt+C` (Windows/Linux): Opens the Cody Commands Menu, giving you quick access to a range of Cody's powerful features.

* `Cmd+.` (macOS) or `Ctrl+.` (Windows/Linux): Opens the Quick Fix menu, which includes options for Cody to edit or generate code based on your current context.

## Updating the extension

VS Code will typically notify you when updates are available for installed extensions. Follow the prompts to update the Cody AI extension to the latest version.

## Authenticating Cody with VS Code forks

Cody also works with Cursor, Gitpod, IDX, and other similar VS Code forks. To access VS Code forks like Cursor, select **Sign in with URL and access token** and generate an access token. Next, copy and paste into the allocated field, using `https://sourcegraph.com` as the URL.

## Add/remove account

To add/remove an account you can do the following:

1. Open Cody by clicking the Cody icon on the left navbar
1. On the open sidebar select the Account icon
1. Select `Sign Out` to remove account or `Switch Account` to login to a different account

//END OF DRAFT


## Chat

Cody chat in VS Code is available in a unified interface opened right next to your code. Once connected to Sourcegraph, a new chat input field is opened with a default `@-mention` [context chips](#context-retrieval).
Expand Down
6 changes: 4 additions & 2 deletions docs/cody/core-concepts/enterprise-architecture.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Enterprise architecture
# Cody Enterprise Architecture

<p className="subtitle">The diagrams on this page explain the core architecture for Cody Enterprise users.</p>

[Cody Enterprise](/cody/clients/enable-cody-enterprise) can run in the Sourcegraph Cloud environment or on your own infrastructure. Here are a few possible deployment architectures.

Expand All @@ -15,4 +17,4 @@

## Data flow

<img src="https://sourcegraphstatic.com/docs/enterprise-architecture-data-flow-v0.png" />
<img src="https://sourcegraphstatic.com/docs/enterprise-architecture-data-flow-v0.png" />
74 changes: 74 additions & 0 deletions docs/cody/enterprise/configure-cody.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Advanced Features

<p className="subtitle">Learn about all the advanced features that users on Cody Enterprise get.</p>

<Tabs>
<Tab title="IDE Token Expiry">
Site administrators can customize the time duration of the access token used by other users on the Sourcegraph Enterprise instance to connect Cody from their IDEs via the **Site admin** page. Administrators can choose from various options, including 7, 14, 30, 60, and 90 days.

![ide-token-expiry](https://storage.googleapis.com/sourcegraph-assets/Docs/token-expiry.png)
</Tab>
<Tab title="Guardrails">
<Callout type= "note">Guardrails for public code is currently in Beta stage and is supported with VS Code and JetBrains IDEs extensions.</Callout>

Open source attribution guardrails for public code reduce the exposure to copyrighted code, commonly called copyright guardrails. This involves the implementation of a verification mechanism within Cody to ensure that any code generated by the platform does not replicate open source code.

Guardrails for public code are available to all Sourcegraph Enterprise instances and are **disabled** by default. You can enable it from the **Site configuration**. You can do so by setting `"attribution.enabled": true` in site config.

It only matches code snippets that are at least **10 lines** or longer, and the search corpus **290,000** open source repositories.

<Callout type="info">Guardrails don't differentiate between license types. It matches any code snippet that is at least 10 lines long from the 290,000 indexed open source repositories.</Callout>
</Tab>
<Tab title="Admin Controls">
<Callout type="note">Admin Controls is supported with VS Code and JetBrains IDE extension.</Callout>

Sourcegraph account admins have selective control over users' access to Cody Enterprise, which is now managed via the Sourcegraph role-based access control system. This provides a more intuitive user interface for assigning permission to use Cody.
</Tab>
<Tab title="Analytics">
<Callout type= "note">Cody Analytics are supported with VS Code IDE extension and on the latest versions of JetBrains IDE.</Callout>

Cody Enterprise users get a clear view of usage analytics for their instance on a self-service basis. A separately managed cloud service for Cody analytics handles user auth, gets metrics data from Sourcegraph's BigQuery instance, and visualizes the metrics data.

The following metrics are available for Cody Enterprise users:

| **Metric Type** | **What is measured?** |
| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Active users | - Total active users <br /> - Average daily users <br /> - Average no. of days each user used Cody (of last 30 days) <br /> - Cody users by day (last 30 days) <br /> - Cody users by month (last two months) <br /> - Cody users by number of days used |
| Completions | - Total accepted completions <br /> - Minutes saved per completion <br /> - Hours saved by completions <br /> - Cody completions by day <br /> - Completions acceptance rate <br /> - Weighted completions acceptance rate <br /> - Average completion latency <br /> - Acceptance rate by language <br /> |
| Chat | - Total chat events <br /> - Minutes saved per chat <br /> - Hours saved by chats <br /> - Cody chats by day |
| Commands | - Total command events <br /> - Minutes saved per command <br /> - Hours saved by commands <br /> - Cody commands by day <br /> - Most used commands |

To enable Cody Analytics:

- Create an account on [Sourcegraph Accounts](https://accounts.sourcegraph.com/)
- A user already having an account on Sourcegraph.com gets automatically migrated to Sourcegraph Accounts. Users can sign in to Cody Analytics using their email and password
- Users without a Sourcegraph.com account, please get in touch with one of our teammates. They can help with both the account setup and assigning instances to specific users
- Map your user account to a Sourcegraph instance, and this gives you access to Cody's analytics

</Tab>

<Tab title="Multi-repository context">
<Callout type="info">Multi-repo context for Sourcegraph Enterprise is supported with VS Code and JetBrains editor extensions.</Callout>

Cody Enterprise supports searching up to 10 repositories to find relevant context in chat.

* In VS Code, open a new Cody chat, type `@`, and select `Remote Repositories` to search other repositories for context
* In JetBrains, use the enhanced context selector

### @-mention directory

<Callout type="info">@-mentioning directory is available for Enterprise users on VS Code, JetBrains, and Cody Web.</Callout>

To better support teams working with large monorepos, Enterprise users can `@-mention` directories when chatting with Cody. This helps you define more specific directories and sub-directories within that monorepo to give more precise context.

To do this, type `@` in the chat, and then select **Directories** to search other repositories for context in your codebase.

<video width="1920" height="1080" loop playsInline controls style={{ width: '100%', height: 'auto' }}>
<source src="https://storage.googleapis.com/sourcegraph-assets/Docs/Media/%40-mention-dir-0824.mp4" type="video/mp4"/>
</video>

Please note that you can only `@-mention` remote directories (i.e., directories in your Sourcegraph instance) but not local directories. This means any recent changes to your directories can't be utilized as context until your Sourcegraph instance re-indexes any changes.

If you want to include recent changes that haven't been indexed in your Sourcegraph instance, you can `@-mention` specific files, lines of code, or symbols.
</Tab>
</Tabs>
1 change: 1 addition & 0 deletions docs/cody/enterprise/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Cody for Admins
32 changes: 32 additions & 0 deletions docs/cody/enterprise/llm-models.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Supported LLM Models and Configuration

<p className="subtitle">This page will help you explore and learn about all the LLM models and their configuratiojns that are supported on Cody Enterprise.</p>

Sourcegraph Enterprise supports many different LLM providers and models. You can use state of the art code completion models such as Anthropic's Claude or OpenAI's ChatGPT by adjusting your Sourcegraph instance's configuration.

Refer to the [Model Configuration](/cody/clients/model-configuration) or [Supported Models](/cody/capabilities/supported-models) sections for more information.
Use the drop-down menu to make your desired selection and get a detailed breakdown of the supported LLM models for each provider on Cody Enterprise.

<FeatureParity type='ent' />
For the supported LLM models listed above refer to the following notes:

1. Microsoft Azure is planning to deprecate the APIs used in SG version less than `5.3.3` on July 1, 2024 [Source](https://learn.microsoft.com/en-us/azure/ai-services/openai/api-version-deprecation)
2. Claude 2.1 is not recommended
3. Sourcegraph doesn't recommend GPT-4 non-turbo, Claude 1 or 2 models
4. Only supported through legacy completions API
5. BYOK with managed services are only supported for Self-hosted Sourcegraph instances
6. GPT-4 and GPT-4o for completions has a bug that is resulting in many failed completions

### Supported model configuration

Use the drop-down menu to make your desired selection and get a detailed breakdown of the supported model configuration for each provider on Cody Enterprise. This is an on-site configuration. Admins should pick a value from the table for `chatModel` to configure their chat model.

<FeatureParity type='configuration' />

For the supported LLM model configuration listed above refer to the following notes:

1. Microsoft Azure is planning to deprecate the APIs used in SG version less than `5.3.3` on July 1, 2024 [Source](https://learn.microsoft.com/en-us/azure/ai-services/openai/api-version-deprecation)
2. Claude 2.1 is not recommended
3. Sourcegraph doesn't recommend GPT-4 non-turbo, Claude 1 or 2 models
4. Only supported through legacy completions API
5. BYOK with managed services are only supported for Self-hosted Sourcegraph instances
4 changes: 2 additions & 2 deletions src/components/Logo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ export function Logo(props: React.ComponentPropsWithoutRef<'svg'>) {
<>
<img
className="hidden h-[23px] w-[190px] dark:block"
src={`${basePath}/logo-theme-dark.svg`}
src={`/docs/logo-theme-dark.svg`}
alt="Sourcegraph Docs"
/>
<img
className="block h-[23px] w-[190px] dark:hidden"
src={`${basePath}/logo-theme-light.svg`}
src={`/docs/logo-theme-light.svg`}
alt="Sourcegraph Docs"
/>
</>
Expand Down
Loading
Loading