-
Notifications
You must be signed in to change notification settings - Fork 72
Add modelConfig docs #735
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
Merged
Merged
Add modelConfig docs #735
Changes from 14 commits
Commits
Show all changes
72 commits
Select commit
Hold shift + click to select a range
b4169f2
wip
taras-yemets 131e030
Merge branch 'main' into ty/modelconfig
taras-yemets f651e4f
wip
taras-yemets 8d56a3b
Merge remote-tracking branch 'origin/ty/modelconfig' into ty/modelconfig
taras-yemets f453374
wip
taras-yemets 44bf2d9
revert changes
taras-yemets 63274ec
wip
taras-yemets 0b6962c
wip
taras-yemets 9d4c5b0
Merge branch 'main' into ty/modelconfig
taras-yemets cb0fa6a
wip
taras-yemets c7c9073
Merge remote-tracking branch 'origin/ty/modelconfig' into ty/modelconfig
taras-yemets a9f7f4c
wip
taras-yemets d935f69
wip
taras-yemets 90ac8d0
wip
taras-yemets 1467b00
wip
taras-yemets 3551c9d
wip
taras-yemets be6f553
wip
taras-yemets f6a58b0
wip
taras-yemets fb2e71b
rm "edit" capability mentions
taras-yemets e716b9c
Update docs/cody/model-configuration/examples.mdx
taras-yemets d25fdfc
Update docs/cody/model-configuration/examples.mdx
taras-yemets a881d5f
upd copy
taras-yemets 7862b6c
Merge branch 'ty/modelconfig' of github.com:sourcegraph/docs into ty/…
taras-yemets e4977a2
Resolve conflicts
MaedahBatool b01326b
Add nav items
MaedahBatool 24add92
Merge branch 'main' into ty/modelconfig
MaedahBatool 76213c5
Resolve merge conflicts
MaedahBatool 9b33ea1
remove Google Vertex (public) example
taras-yemets 14e375b
Merge branch 'ty/modelconfig' of github.com:sourcegraph/docs into ty/…
taras-yemets bf4ac99
First draft still working
MaedahBatool 8ace100
Rmv model config matrix
MaedahBatool b680cf5
Add improvements
MaedahBatool e6c2576
Add examples
MaedahBatool 237d732
Add links and hash links
MaedahBatool b6669b3
Add note for missing code
MaedahBatool 09bf462
Merge branch 'main' into ty/modelconfig
MaedahBatool af56933
add missing example
taras-yemets 91da74b
add note on azure openai models
taras-yemets e893b3c
fix formatting
taras-yemets 097bfc2
fix
taras-yemets f21997f
Merge branch 'ty/modelconfig' of github.com:sourcegraph/docs into ty/…
taras-yemets 67cddad
address feedback
taras-yemets 523ba07
fix
taras-yemets 3b22db8
upd
taras-yemets 78aae4c
change examples order
taras-yemets db4f562
Update docs/cody/enterprise/model-configuration.mdx
taras-yemets 50ea693
change section order
taras-yemets bca37cc
Merge branch 'ty/modelconfig' of github.com:sourcegraph/docs into ty/…
taras-yemets 1bceb58
Update docs/cody/enterprise/model-configuration.mdx
taras-yemets e9e7af6
Update docs/cody/enterprise/model-configuration.mdx
taras-yemets 4477219
upd comment
taras-yemets a7d4290
address feedback
taras-yemets 9e47078
fix formatting
taras-yemets ddc090c
aws => amazon bedrock
taras-yemets 9c08f89
remove duplication
taras-yemets bb76873
remove model tier mentions
taras-yemets ec11370
upd comment
taras-yemets ed191ef
Update docs/cody/enterprise/features.mdx
taras-yemets 03c9d6d
Update docs/cody/enterprise/completions-configuration.mdx
taras-yemets 8a280f7
Update docs/cody/clients/enable-cody-enterprise.mdx
taras-yemets 324868b
Update docs/cody/enterprise/completions-configuration.mdx
taras-yemets b1f1b9f
upd amazon bedrock example and docs
taras-yemets 56cd4b8
Merge branch 'ty/modelconfig' of github.com:sourcegraph/docs into ty/…
taras-yemets 1033347
fix default model field name
taras-yemets 6b11a52
remove self-hosted models
taras-yemets 891ff0a
Merge branch 'main' into ty/modelconfig
bb313f0
Update src/data/navigation.ts
MaedahBatool bbe8279
Update docs/cody/enterprise/features.mdx
MaedahBatool 3471de4
fix build errors
MaedahBatool aa709dd
prompt pre-instructions docs
MaedahBatool eadab3a
Rmv duplicate folder
MaedahBatool fead11d
Merge branch 'sg-next-nov25' into ty/modelconfig
MaedahBatool File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,372 @@ | ||
# Examples | ||
|
||
## Sourcegraph-supplied models only | ||
|
||
This section includes examples how to configure Cody to use Sourcegraph-supplied models. | ||
|
||
- [Minimal configuration](/cody/model-configuration#configure-sourcegraph-supplied-models) | ||
- [Using model filters](/cody/model-configuration#model-filters) | ||
- [Change default models](/cody/model-configuration#default-models) | ||
|
||
## Sourcegraph-supplied models and BYOK (Bring Your Own Key) | ||
|
||
Sourcegraph-supplied models come with preconfigured providers, identified by the following IDs (namespaces): | ||
|
||
- "anthropic" | ||
- "google" | ||
- "fireworks" | ||
- "mistral" | ||
- "openai" | ||
|
||
### Override provider config for all models in the namespace | ||
taras-yemets marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
When Sourcegraph-supplied models are used and a provider override for a Sourcegraph-supported provider (same ID) is specified, | ||
the override applies to all Sourcegraph-supplied models within that provider. | ||
For example, if you specify an override for a provider with ID `"anthropic"`, it will apply to all models from the `"anthropic"` provider. | ||
taras-yemets marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
Example configuration: | ||
|
||
```json | ||
{ | ||
"cody.enabled": true, | ||
"modelConfiguration": { | ||
"sourcegraph": {}, | ||
"providerOverrides": [ | ||
{ | ||
"id": "anthropic", | ||
"displayName": "Anthropic BYOK", | ||
"serverSideConfig": { | ||
"type": "anthropic", | ||
"accessToken": "sk-ant-token", | ||
"endpoint": "https://api.anthropic.com/v1/messages" | ||
} | ||
} | ||
], | ||
"defaultModels": { | ||
"chat": "anthropic::2024-10-22::claude-3.5-sonnet", | ||
"fastChat": "anthropic::2023-06-01::claude-3-haiku", | ||
"autocomplete": "fireworks::v1::deepseek-coder-v2-lite-base" | ||
} | ||
} | ||
``` | ||
|
||
In the configuration above, we: | ||
|
||
- Enable Sourcegraph-supplied models and do not set any overrides (note that `"modelConfiguration.modelOverrides"` is not specified). | ||
- Route requests for Anthropic models directly to the Anthropic API (via the provider override specified for "anthropic"). | ||
- Route requests for other models (such as the Fireworks model for "autocomplete") through Cody Gateway. | ||
|
||
### Override provider config for some models in the namespace and use the Sourcegraph-configured provider config for the rest | ||
|
||
It's possible to route requests directly to the LLM provider (bypassing the Cody Gateway) for some models while using the | ||
Sourcegraph-configured provider config for the rest. | ||
|
||
Example configuration: | ||
|
||
In the configuration above, we: | ||
|
||
- Enable Sourcegraph-supplied models (the `sourcegraph` field is not empty or `null`). | ||
- Define a new provider with the ID `"anthropic-byok"` and configure it to use the Anthropic API. | ||
- Since this provider is unknown to Sourcegraph, no Sourcegraph-supplied models are available for it. | ||
Therefore, we add a custom model in the `"modelOverrides"` section. | ||
- Use the custom model configured in the previous step (`"anthropic-byok::2024-10-22::claude-3.5-sonnet"`) for `"chat"`. | ||
Requests are sent directly to the Anthropic API as set in the provider override. | ||
- For `"fastChat"` and `"autocomplete"`, we use Sourcegraph-supplied models via Cody Gateway. | ||
|
||
## Config examples for various LLM providers | ||
|
||
Below are configuration examples for setting up various LLM providers using BYOK. | ||
These examples are applicable whether or not you are using Sourcegraph-supported models. | ||
|
||
**Note:** | ||
|
||
- In this section, all configuration examples have Sourcegraph-supplied models disabled. To use a combination of | ||
Sourcegraph-supplied models and BYOK, please refer to the previous section. | ||
- Ensure that at least one model is available for each Cody feature ("chat", "edit", "autocomplete"), regardless of | ||
the provider and model overrides configured. To verify this, [view the configuration](/cody/model-configuration#view-configuration) | ||
and confirm that appropriate models are listed in the `"defaultModels"` section. | ||
|
||
<Accordion title="Anthropic"> | ||
|
||
```json | ||
{ | ||
"cody.enabled": true, | ||
"modelConfiguration": { | ||
"sourcegraph": null, | ||
"providerOverrides": [ | ||
{ | ||
"id": "anthropic", | ||
"displayName": "Anthropic", | ||
"serverSideConfig": { | ||
"type": "anthropic", | ||
"accessToken": "sk-ant-token", | ||
"endpoint": "https://api.anthropic.com/v1/messages" | ||
} | ||
} | ||
], | ||
"modelOverrides": [ | ||
{ | ||
"modelRef": "anthropic::2024-10-22::claude-3.5-sonnet", | ||
"displayName": "Claude 3.5 Sonnet", | ||
"modelName": "claude-3-5-sonnet-latest", | ||
"capabilities": ["edit", "chat"], | ||
"category": "accuracy", | ||
"status": "stable", | ||
"tier": "free", | ||
"contextWindow": { | ||
"maxInputTokens": 45000, | ||
"maxOutputTokens": 4000 | ||
} | ||
}, | ||
{ | ||
"modelRef": "anthropic::2023-06-01::claude-3-haiku", | ||
"displayName": "Claude 3 Haiku", | ||
"modelName": "claude-3-haiku-20240307", | ||
"capabilities": ["edit", "chat"], | ||
"category": "speed", | ||
"status": "stable", | ||
"tier": "free", | ||
taras-yemets marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
"contextWindow": { | ||
"maxInputTokens": 7000, | ||
"maxOutputTokens": 4000 | ||
} | ||
}, | ||
{ | ||
"modelRef": "anthropic::2023-01-01::claude-instant-1.2", | ||
"displayName": "Claude Instant", | ||
"modelName": "claude-instant-1.2", | ||
"capabilities": ["autocomplete", "edit", "chat"], | ||
"category": "other", | ||
"status": "deprecated", | ||
"tier": "free", | ||
"contextWindow": { | ||
"maxInputTokens": 7000, | ||
"maxOutputTokens": 4000 | ||
} | ||
} | ||
], | ||
"defaultModels": { | ||
"chat": "anthropic::2024-10-22::claude-3.5-sonnet", | ||
"fastChat": "anthropic::2023-06-01::claude-3-haiku", | ||
"autocomplete": "anthropic::2023-01-01::claude-instant-1.2" | ||
} | ||
} | ||
``` | ||
|
||
In the configuration above, we: | ||
|
||
- Set up a provider override for Anthropic, routing requests for this provider directly to the specified Anthropic endpoint (bypassing Cody Gateway). | ||
- Add three Anthropic models: | ||
- Two models with chat capabilities (`"anthropic::2024-10-22::claude-3.5-sonnet"` and `"anthropic::2023-06-01::claude-3-haiku"`), | ||
providing options for chat users. | ||
- One model with autocomplete capability (`"anthropic::2023-01-01::claude-instant-1.2"`). | ||
- Set the configured models as default models for Cody features in the `"defaultModels"` field. | ||
|
||
</Accordion> | ||
|
||
<Accordion title="Fireworks"> | ||
taras-yemets marked this conversation as resolved.
Show resolved
Hide resolved
|
||
```json | ||
"cody.enabled": true, | ||
"modelConfiguration": { | ||
"sourcegraph": null, | ||
"providerOverrides": [ | ||
{ | ||
"id": "fireworks", | ||
"displayName": "Fireworks", | ||
"serverSideConfig": { | ||
"type": "fireworks", | ||
"accessToken": "token", | ||
"endpoint": "https://api.fireworks.ai/inference/v1/completions" | ||
} | ||
} | ||
], | ||
"modelOverrides": [ | ||
{ | ||
"modelRef": "fireworks::v1::mixtral-8x22b-instruct", | ||
"displayName": "Mixtral 8x22B", | ||
"modelName": "accounts/fireworks/models/mixtral-8x22b-instruct", | ||
"capabilities": ["edit", "chat"], | ||
"category": "other", | ||
"status": "stable", | ||
"tier": "free", | ||
"contextWindow": { | ||
"maxInputTokens": 7000, | ||
"maxOutputTokens": 4000 | ||
} | ||
}, | ||
{ | ||
"modelRef": "fireworks::v1::starcoder-16b", | ||
"modelName": "accounts/fireworks/models/starcoder-16b", | ||
"displayName": "(Fireworks) Starcoder 16B", | ||
"contextWindow": { | ||
"maxInputTokens": 8192, | ||
"maxOutputTokens": 4096 | ||
}, | ||
"capabilities": ["autocomplete"], | ||
"category": "balanced", | ||
"status": "stable" | ||
} | ||
], | ||
"defaultModels": { | ||
"chat": "fireworks::v1::mixtral-8x22b-instruct", | ||
"fastChat": "fireworks::v1::mixtral-8x22b-instruct", | ||
"autocomplete": "fireworks::v1::starcoder-16b" | ||
} | ||
} | ||
``` | ||
|
||
In the configuration above, we: | ||
|
||
- Set up a provider override for Fireworks, routing requests for this provider directly to the specified Fireworks endpoint (bypassing Cody Gateway). | ||
- Add two Fireworks models: - `"fireworks::v1::mixtral-8x22b-instruct"` with "edit" and "chat" capabiities - used for "chat" | ||
and "fastChat" - `"fireworks::v1::starcoder-16b"` with "autocomplete" capability - used for "autocomplete". | ||
|
||
</Accordion> | ||
|
||
<Accordion title="OpenAI"> | ||
|
||
```json | ||
"modelConfiguration": { | ||
"sourcegraph": null, | ||
"providerOverrides": [ | ||
{ | ||
"id": "openai", | ||
"displayName": "OpenAI", | ||
"serverSideConfig": { | ||
"type": "openai", | ||
"accessToken": "token", | ||
"endpoint": "https://api.openai.com" | ||
} | ||
} | ||
], | ||
"modelOverrides": [ | ||
{ | ||
"modelRef": "openai::2024-02-01::gpt-4o", | ||
"displayName": "GPT-4o", | ||
"modelName": "gpt-4o", | ||
"capabilities": ["edit", "chat"], | ||
"category": "accuracy", | ||
"status": "stable", | ||
"tier": "pro", | ||
"contextWindow": { | ||
"maxInputTokens": 45000, | ||
"maxOutputTokens": 400 | ||
} | ||
}, | ||
{ | ||
"modelRef": "openai::unknown::gpt-3.5-turbo-instruct", | ||
"displayName": "GPT-3.5 Turbo Instruct", | ||
"modelName": "gpt-3.5-turbo-instruct", | ||
"capabilities": ["autocomplete"], | ||
"category": "speed", | ||
"status": "stable", | ||
"tier": "free", | ||
"contextWindow": { | ||
"maxInputTokens": 7000, | ||
"maxOutputTokens": 400 | ||
} | ||
} | ||
], | ||
"defaultModels": { | ||
"chat": "openai::2024-02-01::gpt-4o", | ||
"fastChat": "openai::2024-02-01::gpt-4o", | ||
"autocomplete": "openai::unknown::gpt-3.5-turbo-instruct" | ||
} | ||
} | ||
``` | ||
|
||
In the configuration above, we: | ||
|
||
- Set up a provider override for OpenAI, routing requests for this provider directly to the specified OpenAI endpoint (bypassing Cody Gateway). | ||
- Add two OpenAI models: | ||
- `"openai::2024-02-01::gpt-4o"` with "edit" and "chat" capabiities - used for "chat" and "fastChat" | ||
- `"openai::unknown::gpt-3.5-turbo-instruct"` with "autocomplete" capability - used for "autocomplete". | ||
|
||
</Accordion> | ||
|
||
<Accordion title="Azure OpenAI"> | ||
|
||
```json | ||
taras-yemets marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"cody.enabled": true, | ||
"modelConfiguration": { | ||
"sourcegraph": null, | ||
"providerOverrides": [ | ||
{ | ||
"id": "azure-openai", | ||
"displayName": "Azure OpenAI", | ||
"serverSideConfig": { | ||
"type": "azureOpenAI", | ||
"accessToken": "token", | ||
"endpoint": "https://acme-test.openai.azure.com/", | ||
"user": "", | ||
"useDeprecatedCompletionsAPI": true | ||
} | ||
} | ||
], | ||
"modelOverrides": [ | ||
{ | ||
"modelRef": "azure-openai::unknown::gpt-4o", | ||
"displayName": "GPT-4o", | ||
"modelName": "gpt-4o", | ||
"capabilities": ["edit", "chat"], | ||
"category": "accuracy", | ||
"status": "stable", | ||
"tier": "pro", | ||
"contextWindow": { | ||
"maxInputTokens": 45000, | ||
"maxOutputTokens": 4000 | ||
} | ||
}, | ||
{ | ||
"modelRef": "azure-openai::unknown::gpt-35-turbo-instruct-test", | ||
"displayName": "GPT-3.5 Turbo Instruct", | ||
"modelName": "gpt-35-turbo-instruct-test", | ||
"capabilities": ["autocomplete"], | ||
"category": "speed", | ||
"status": "stable", | ||
"tier": "free", | ||
"contextWindow": { | ||
"maxInputTokens": 7000, | ||
"maxOutputTokens": 4000 | ||
} | ||
} | ||
], | ||
"defaultModels": { | ||
"chat": "azure-openai::unknown::gpt-4o", | ||
"fastChat": "azure-openai::unknown::gpt-4o", | ||
"autocomplete": "azure-openai::unknown::gpt-35-turbo-instruct-test" | ||
} | ||
} | ||
``` | ||
|
||
In the configuration above, we: | ||
|
||
- Set up a provider override for Azure OpenAI, routing requests for this provider directly to the specified Azure OpenAI endpoint (bypassing Cody Gateway). | ||
- Add two OpenAI models: | ||
- `"azure-openai::unknown::gpt-4o"` with "edit" and "chat" capabiities - used for "chat" and "fastChat" | ||
- `"azure-openai::unknown::gpt-35-turbo-instruct-test"` with "autocomplete" capability - used for "autocomplete". | ||
- Since `"azure-openai::unknown::gpt-35-turbo-instruct-test"` is not supported on the newer OpenAI `"v1/chat/completions"` endpoint, | ||
we set `"useDeprecatedCompletionsAPI"` to `true` to route requests to the legacy `"v1/completions"` endpoint. This setting is | ||
unnecessary if you are using a model supported on the `"v1/chat/completions"` endpoint. | ||
|
||
</Accordion> | ||
|
||
<Accordion title="Generic OpenAI-compatible"> | ||
|
||
TODO | ||
|
||
</Accordion> | ||
|
||
<Accordion title="Google Vertex (Anthropic)"></Accordion> | ||
<Accordion title="Google Vertex (Gemini)"></Accordion> | ||
<Accordion title="Google Vertex (public)"></Accordion> | ||
|
||
<Accordion title="AWS Bedrock"></Accordion> | ||
|
||
## Self-hosted models | ||
|
||
TODO | ||
|
||
``` | ||
|
||
``` |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.