The problem: currently, we assert the model ID assigned to the provider instance, but often, it's not used at all to make requests, which means this assertion is irrelevant to the actual functionality where we bump into bugs.
This PR adds tests for autocomplete request parameters in all supported instance configurations: dotcom/enterprise X local-settings/server-side-model-config/site-config for the anthropic provider.
Moves Claude-specific code to a model helper.
Changes the model helper interface to provider messages instead of only the prompt string.
Enforces the consistent requestParams.model format — providerId/modelName and consistent provider.legacyModel format — modelName.
The only remaining provider with few tests is Fireworks. I'm working on adding request params tests for it rn. But if you open different autocomplete providers now, you'll see they are 90% identical. I hope we can merge most of them soon and rely primarily on model helpers. Then, it will be much easier to work towards the future, where models are defined in the site-config, and the client has only one autocomplete provider that can handle all the cases. Also, unifying the requestParms.model format also brings us closer to migrating to server-side model config usage.
Test plan
CI and new unit tests
For manual testing, add "cody.autocomplete.advanced.provider": "anthropic" to your local settings and see if autocomplete works on DotCom.
For enterprise testing, use one of the instances with the configured Anthropic model (sg02 with Haiku), set the Anthropic model as the default codeCompletion in the site-config under modelConfiguration.defaultModels, and generate completions.
Beware that s2, sg02, and sg04 have server-side model config disabled currently.
The problem: currently, we assert the model ID assigned to the provider instance, but often, it's not used at all to make requests, which means this assertion is irrelevant to the actual functionality where we bump into bugs.
anthropic
provider.requestParams.model
format —providerId/modelName
and consistentprovider.legacyModel
format —modelName
.Note
The only remaining provider with few tests is Fireworks. I'm working on adding request params tests for it rn. But if you open different autocomplete providers now, you'll see they are 90% identical. I hope we can merge most of them soon and rely primarily on model helpers. Then, it will be much easier to work towards the future, where models are defined in the site-config, and the client has only one autocomplete provider that can handle all the cases. Also, unifying the
requestParms.model
format also brings us closer to migrating to server-side model config usage.Test plan
codeCompletion
in the site-config undermodelConfiguration.defaultModels
, and generate completions.Beware that s2, sg02, and sg04 have server-side model config disabled currently.