Skip to content
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
chrsmith merged 1 commit into
mainfrom
chrsmith/cody-pro-x-sg-supplied-models
Jul 19, 2024
Merged

Fixes re: Cody Pro x Sourcegraph-supplied models#63892
chrsmith merged 1 commit into
mainfrom
chrsmith/cody-pro-x-sg-supplied-models

Conversation

@chrsmith

Copy link
Copy Markdown
Contributor

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 of func 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

I'll try to add a unit test to ensure this behavior before submitting, but wanted to get the PR sent out for review ASAP.

Test plan

Added, updated unit tests. Tested manually.

Changelog

NA

@chrsmith chrsmith requested review from a team and emidoots July 17, 2024 22:23
@cla-bot cla-bot Bot added the cla-signed label Jul 17, 2024
@chrsmith chrsmith merged commit 0212a47 into main Jul 19, 2024
@chrsmith chrsmith deleted the chrsmith/cody-pro-x-sg-supplied-models branch July 19, 2024 16:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants