Skip to content

Commit

Permalink
Add default Anthropic autocomplete model (#4803)
Browse files Browse the repository at this point in the history
Fixes the default model value for the Anthropic autocomplete provider.
  • Loading branch information
justinmilner1 authored Jul 17, 2024
1 parent 5e37b75 commit 57a0f8f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
1 change: 1 addition & 0 deletions vscode/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ This is a log of all notable changes to Cody for VS Code. [Unreleased] changes a

- Edit: Fixed an issue where, when unable to detect the indentation of a file, Cody would remove all indentation from a response. [pull/4704](https://github.com/sourcegraph/cody/pull/4704)
- Edit: Fixed an issue where Cody would sometimes remove unintended parts of the code when an edit was accepted on save. [pull/4720](https://github.com/sourcegraph/cody/pull/4720)
- Autocomplete: Fixes the default model value for the Anthropic autocomplete provider. [pull/4803](https://github.com/sourcegraph/cody/pull/4803)
- Chat: The loading dots in the loading page are now centered correctly. [pull/4808](https://github.com/sourcegraph/cody/pull/4808)

### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ describe('[getInlineCompletions] completion event', () => {
"multiline": true,
"multilineMode": "block",
"providerIdentifier": "anthropic",
"providerModel": "claude-instant-1.2",
"providerModel": "anthropic/claude-instant-1.2",
"resolvedModel": "sourcegraph/gateway-model",
"responseHeaders": {
"fireworks-speculation-matched-tokens": "100",
Expand Down Expand Up @@ -205,7 +205,7 @@ describe('[getInlineCompletions] completion event', () => {
"multiline": false,
"multilineMode": null,
"providerIdentifier": "anthropic",
"providerModel": "claude-instant-1.2",
"providerModel": "anthropic/claude-instant-1.2",
"resolvedModel": "sourcegraph/gateway-model",
"responseHeaders": {
"fireworks-speculation-matched-tokens": "100",
Expand Down
5 changes: 3 additions & 2 deletions vscode/src/completions/providers/anthropic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ export function createProviderConfig({
providerOptions,
...otherOptions
}: AnthropicOptions & { providerOptions?: Partial<ProviderOptions> }): ProviderConfig {
const defaultClientModel = model ?? 'anthropic/claude-instant-1.2'
return {
create(options: ProviderOptions) {
return new AnthropicProvider(
Expand All @@ -296,12 +297,12 @@ export function createProviderConfig({
...providerOptions,
id: PROVIDER_IDENTIFIER,
},
{ maxContextTokens, model, ...otherOptions }
{ maxContextTokens, model: model ?? defaultClientModel, ...otherOptions }
)
},
contextSizeHints: standardContextSizeHints(maxContextTokens),
identifier: PROVIDER_IDENTIFIER,
model: model ?? 'claude-instant-1.2',
model: model ?? defaultClientModel,
}
}

Expand Down
10 changes: 5 additions & 5 deletions vscode/src/completions/providers/create-provider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe('createProviderConfig', () => {
dummyAuthStatus
)
expect(provider?.identifier).toBe('anthropic')
expect(provider?.model).toBe('claude-instant-1.2')
expect(provider?.model).toBe('anthropic/claude-instant-1.2')
})

it('returns "fireworks" provider config and corresponding model if specified', async () => {
Expand Down Expand Up @@ -137,7 +137,7 @@ describe('createProviderConfig', () => {
dummyAuthStatus
)
expect(provider?.identifier).toBe('anthropic')
expect(provider?.model).toBe('claude-instant-1.2')
expect(provider?.model).toBe('anthropic/claude-instant-1.2')
})

it('provider specified in VSCode settings takes precedence over the one defined in the site config', async () => {
Expand Down Expand Up @@ -200,7 +200,7 @@ describe('createProviderConfig', () => {
provider: 'aws-bedrock',
completionModel: 'anthropic.claude-instant-1.2',
},
expected: { provider: 'anthropic', model: 'claude-instant-1.2' },
expected: { provider: 'anthropic', model: 'anthropic/claude-instant-1.2' },
},
{
codyLLMConfig: { provider: 'aws-bedrock', completionModel: 'anthropic.' },
Expand Down Expand Up @@ -256,7 +256,7 @@ describe('createProviderConfig', () => {
// provider not defined (backward compat)
{
codyLLMConfig: { provider: undefined, completionModel: 'superdupercoder-7b' },
expected: { provider: 'anthropic', model: 'claude-instant-1.2' },
expected: { provider: 'anthropic', model: 'anthropic/claude-instant-1.2' },
},
]

Expand Down Expand Up @@ -287,6 +287,6 @@ describe('createProviderConfig', () => {
dummyAuthStatus
)
expect(provider?.identifier).toBe('anthropic')
expect(provider?.model).toBe('claude-instant-1.2')
expect(provider?.model).toBe('anthropic/claude-instant-1.2')
})
})

0 comments on commit 57a0f8f

Please sign in to comment.