sourcegraph / cody

Type less, code more: Cody is an AI code assistant that uses advanced search and codebase context to help you write and fix code.
https://cody.dev
Apache License 2.0
2.71k stars 297 forks source link

Autocomplete: add `anthropic` provider tests #5671

Closed valerybugakov closed 1 month ago

valerybugakov commented 1 month ago

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.

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

  1. CI and new unit tests
  2. For manual testing, add "cody.autocomplete.advanced.provider": "anthropic" to your local settings and see if autocomplete works on DotCom.
  3. 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.