|
1 | | -# Cody on Sourcegraph Enterprise |
| 1 | +# Cody for Enterprise |
2 | 2 |
|
3 | 3 | <p className="subtitle">Cody enhances your coding experience by providing intelligent code suggestions, context-aware completions, and advanced code analysis. These docs will help you use Cody on your Sourcegraph Enterprise instance.</p> |
4 | 4 |
|
5 | 5 | <LinkCards> |
6 | 6 | <LinkCard href="https://sourcegraph.com/contact/request-info" imgSrc="https://sourcegraph.com/.assets/img/sourcegraph-mark.svg" imgAlt="Cody Enterprise" title="Cody Enterprise" description="Get in touch with our team to try Cody for Sourcegraph Enterprise." /> |
7 | 7 | </LinkCards> |
8 | 8 |
|
9 | | -## Cody Enterprise features |
| 9 | +## Setting up Cody Enterprise |
10 | 10 |
|
11 | | -To cater to your Enterprise requirements, Cody offers the following features: |
| 11 | +You can set up Cody for your Enterprise instance by two methods: |
12 | 12 |
|
13 | | -### IDE token expiry |
| 13 | +1. Sourcegraph Cloud |
| 14 | +2. Self-hosted Sourcegraph |
14 | 15 |
|
15 | | -Site administrators can set the duration of access tokens for users connecting Cody from their IDEs (VS Code, JetBrains, etc.). This can be configured from the **Site admin** page of the Sourcegraph Enterprise instance. Available options include **7, 14, 30, 60, and 90 days**. |
| 16 | +## Cody on Sourcegraph Cloud |
16 | 17 |
|
17 | | - |
| 18 | +With [Sourcegraph Cloud](/cloud/), you get Cody as a managed service, and you **do not** need to enable Cody as is required for self-hosted setup. However, by contacting your account manager, Cody can still be enabled or disabled on-demand on your Sourcegraph instance. |
18 | 19 |
|
19 | | -### Guardrails |
| 20 | +## Self-hosted Sourcegraph Enterprise |
20 | 21 |
|
21 | | -<Callout type= "note">Guardrails for public code is currently in Beta and is supported with VS Code and JetBrains IDEs extensions.</Callout> |
| 22 | +### Prerequisites |
22 | 23 |
|
23 | | -Open source attribution guardrails for public code, commonly called copyright guardrails, reduce the exposure to copyrighted code. This involves implementing a verification mechanism within Cody to ensure that any code generated by the platform does not replicate open source code. |
| 24 | +- You have Sourcegraph version `5.1.0` or more |
| 25 | +- A Sourcegraph Enterprise subscription with [Cody Gateway](/cody/core-concepts/cody-gateway) or an account with a third-party LLM provider |
24 | 26 |
|
25 | | -Guardrails for public code are available to all Sourcegraph Enterprise instances and are **disabled** by default. You can enable them from the Site configuration section by setting `attribution.enabled` to `true`. |
| 27 | +### Enable Cody on your Sourcegraph instance |
26 | 28 |
|
27 | | -Guardrails don't differentiate between license types. It matches any code snippet that is at least **ten lines** long from the **290,000** indexed open source repositories. |
| 29 | +Site admins can only enable Cody on the Sourcegraph instance. To do so, |
28 | 30 |
|
29 | | -### Admin controls |
| 31 | +- First, configure your desired LLM provider either by [using Sourcegraph Cody Gateway](/cody/core-concepts/cody-gateway) or by directly using a third-party LLM provider |
| 32 | +- Next, go to **Site admin > Site configuration** (`/site-admin/configuration`) on your instance and set: |
30 | 33 |
|
31 | | -<Callout type="note">Admin controls are supported with VS Code and JetBrains IDE extension.</Callout> |
| 34 | +```json |
| 35 | + { |
| 36 | + // [...] |
| 37 | + "cody.enabled": true, |
| 38 | + "completions": { |
| 39 | + "provider": "sourcegraph" |
| 40 | + } |
| 41 | + } |
| 42 | +``` |
32 | 43 |
|
33 | | -Site administrators have selective control over users' access to Cody Enterprise, which is managed via the Sourcegraph role-based access control system. This provides a more intuitive user interface for assigning permission to use Cody. |
| 44 | +- Cody is enabled on your self-hosted Sourcegraph enterprise instance |
34 | 45 |
|
35 | | -### Analytics |
| 46 | +## Disable Cody |
36 | 47 |
|
37 | | -<Callout type= "note">Cody Analytics are supported with VS Code IDE extension and on the latest versions of JetBrains IDEs.</Callout> |
| 48 | +To turn Cody off: |
38 | 49 |
|
39 | | -Cody Enterprise users can view analytics for their instance. A separately managed cloud service for Cody analytics handles user auth, gets metrics data from Sourcegraph's BigQuery instance, and visualizes the metrics data. |
| 50 | +- Go to **Site admin > Site configuration** (`/site-admin/configuration`) on your instance and set: |
40 | 51 |
|
41 | | -The following metrics are available for Cody Enterprise users: |
| 52 | +```json |
| 53 | + { |
| 54 | + // [...] |
| 55 | + "cody.enabled": false |
| 56 | + } |
| 57 | +``` |
42 | 58 |
|
43 | | -| **Metric Type** | **What is measured?** | |
44 | | -| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
45 | | -| 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 | |
46 | | -| 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 /> | |
47 | | -| Chat | - Total chat events <br /> - Minutes saved per chat <br /> - Hours saved by chats <br /> - Cody chats by day | |
48 | | -| Commands | - Total command events <br /> - Minutes saved per command <br /> - Hours saved by commands <br /> - Cody commands by day <br /> - Most used commands | |
| 59 | +## Enable Cody only for some users |
49 | 60 |
|
50 | | -To enable Cody Analytics: |
| 61 | +How to enable Cody only for _some_ users depends on what version of Sourcegraph you are running. |
51 | 62 |
|
52 | | -- Create an account on [Sourcegraph Accounts](https://accounts.sourcegraph.com/) |
53 | | -- A user already having a Sourcegraph.com account gets automatically migrated to Sourcegraph Accounts. Users can sign in to Cody Analytics using their email and password |
54 | | -- Users without a Sourcegraph.com account should contact one of our team members. They can help with both the account setup and assigning instances to specific users |
55 | | -- Map your user account to a Sourcegraph instance, and this gives you access to Cody analytics |
| 63 | +### Sourcegraph v5.3+ |
56 | 64 |
|
57 | | -### Multi-repository context |
| 65 | +In Sourcegraph v5.3+, access to Cody is managed via user roles. By default, all users have access. |
58 | 66 |
|
59 | | -Cody supports multi-repository context, allowing you to search up to 10 repositories simultaneously for relevant information. Open a new chat, type `@`, and select `Remote Repositories.` |
| 67 | +First, ensure Cody is enabled in your site configuration. Go to **Site admin > Site configuration** (`/site-admin/configuration`) on your instance and set: |
60 | 68 |
|
61 | | -Keep @-mentioning repos that you want to include in your context. This flexibility lets you get more comprehensive and accurate responses by leveraging information across multiple codebases. |
| 69 | +```json |
| 70 | + { |
| 71 | + // [...] |
| 72 | + "cody.enabled": true, |
| 73 | + // Make sure cody.restrictUsersFeatureFlag is not in your configuration! If it is, remove it. |
| 74 | + } |
| 75 | +``` |
62 | 76 |
|
63 | | -### @-mention directory |
| 77 | +<Callout type="info"> Ensure `cody.restrictUsersFeatureFlag` is **not** in your site configuration. If it is, remove it or else the old feature-flag approach from Sourcegraph 5.2 and earlier will be used.</Callout> |
64 | 78 |
|
65 | | -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. |
| 79 | +Next, go to **Site admin > Users & Auth > Roles** (`/site-admin/roles`) on your instance. On that page, you can: |
66 | 80 |
|
67 | | -To do this, type `@` in the chat, and then select **Directories** to search other repositories for context in your codebase. |
| 81 | +- Control whether users **by default** have access to Cody (expand `User [System]` and toggle **Cody** > **Access** as desired) |
| 82 | +- Control whether groups of users have access to Cody (`+Create role` and enable the **Cody** > **Access** toggle as desired) |
68 | 83 |
|
69 | | - |
| 84 | +### Sourcegraph v5.2 and earlier |
70 | 85 |
|
71 | | -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. |
| 86 | +In Sourcegraph v5.2 and earlier, you should use the feature flag `cody` to turn Cody on selectively for some users. To do so: |
72 | 87 |
|
73 | | -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. |
| 88 | +- Go to **Site admin > Site configuration** (`/site-admin/configuration`) on your instance and set: |
74 | 89 |
|
75 | | -## Supported LLM models |
| 90 | +```json |
| 91 | + { |
| 92 | + // [...] |
| 93 | + "cody.enabled": true, |
| 94 | + "cody.restrictUsersFeatureFlag": true |
| 95 | + } |
| 96 | +``` |
76 | 97 |
|
77 | | -Sourcegraph Enterprise supports different LLM providers and models, such as models from Anthropic and OpenAI. You can do this by adjusting your Sourcegraph instance configuration. |
| 98 | +- Next, go to **Site admin > Feature flags** (`/site-admin/feature-flags`) |
| 99 | +- Add a feature flag called `cody` |
| 100 | +- Select the `boolean` type and set it to `false` |
| 101 | +- Once added, click on the feature flag and use **add overrides** to pick users that will have access to Cody |
78 | 102 |
|
79 | | -<FeatureParity type='ent' /> |
80 | | -For the supported LLM models listed above, refer to the following notes: |
| 103 | + |
81 | 104 |
|
82 | | -1. Microsoft Azure is planning to deprecate the APIs used in Sourcegraph version `>5.3.3` on July 1, 2024 [Source](https://learn.microsoft.com/en-us/azure/ai-services/openai/api-version-deprecation) |
83 | | -2. Claude 2.1 is not recommended |
84 | | -3. Sourcegraph doesn’t recommend using the GPT-4 (non-Turbo), Claude 1, or Claude 2 models anymore |
85 | | -4. Only supported through legacy completions API |
86 | | -5. BYOK (Bring Your Own Key) with managed services are only supported for Self-hosted Sourcegraph instances |
87 | | -6. GPT-4 and GPT-4o for completions have a bug that is resulting in many failed completions |
| 105 | +## Configure Cody for LLM providers |
88 | 106 |
|
89 | | -### Supported model configuration |
| 107 | +Cody supports several LLM providers and models. You can access these models via the Cody Gateway, directly using your own model provider account or infrastructure. |
90 | 108 |
|
91 | | -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. |
| 109 | +There are two ways of configuring Cody for LLM providers: |
92 | 110 |
|
93 | | -<FeatureParity type='configuration' /> |
| 111 | +<QuickLinks> |
94 | 112 |
|
95 | | -For the supported LLM model configuration listed above, refer to the following notes: |
| 113 | +<QuickLink title="Completions" icon='lightbulb' href="/cody/enterprise/completions-configuration" description="How to configure Cody using the completions." /> |
96 | 114 |
|
97 | | -1. Microsoft Azure is planning to deprecate the APIs used in Sourcegraph version `>5.3.3` on July 1, 2024 [Source](https://learn.microsoft.com/en-us/azure/ai-services/openai/api-version-deprecation) |
98 | | -2. Claude 2.1 is not recommended |
99 | | -3. Sourcegraph doesn't recommend GPT-4 non-turbo, Claude 1 or 2 models |
100 | | -4. Only supported through legacy completions API |
101 | | -5. BYOK (Bring Your Own Key) with managed services are only supported for Self-hosted Sourcegraph instances |
| 115 | +<QuickLink title="Model Configuration" icon='installation' href="/cody/enterprise/model-configuration" description="How to configure Cody using the model configuration." /> |
| 116 | + |
| 117 | +</QuickLinks> |
0 commit comments