This repository was archived by the owner on Sep 30, 2024. It is now read-only.
Fixes re: Cody Pro x Sourcegraph-supplied models#63892
Merged
Merged
Conversation
emidoots
approved these changes
Jul 18, 2024
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This PR fixes several issues related to CodyPro/Sourcegraph.com relying on Sourcegraph-supplied models.
When Sourcegraph.com is exclusively using the modelconfig systems we can delete a lot of this code, and all of the hard-coded lists of LLM models. However, in order to support a smoother transition, we need to support Sourcegraph.com not using Sourcegraph-supplied models, as well as updating the site configuration so that it does.
This PR makes the following fixes:
For forwards compatibility, Sourcegraph.com will now support model references using the "mref format" (a::b::c). Whereas previously it only would support the legacy format (a/b). This will allow us to update Cody clients to use mrefs natively.
Add virtualized models to the hard-coded list of Cody Pro chat models. If Sourcegraph.com is using Sourcegraph-supplied LLM models, then it will use ModelID "claude-3-sonnet" to refer to the LLM model with ModelName "claude-3-sonnet-20240229". We now accept the virtualized model name inside of
func isAllowedCodyProChatModel(...), as well as "devirtualize" the model name inside offunc resolveRequestedModel(..).Use the Cody Pro user's access token for calls to Cody Gateway. This is a serious bug that is live today. (⚠️ 😬) For Sourcegraph.com, when we call Cody Gateway we do not want to authenticate the request using the Sourcegraph license key. And instead use the end user's credentials. However, inside of the Cody Gateway completions client, we were not actually using that access token.
See: https://github.com/sourcegraph/sourcegraph/blob/dbf420bb8c359c71c07934b983116bdbb8f41b06/internal/completions/types/types.go#L61-L75
Test plan
Added, updated unit tests. Tested manually.
Changelog
NA