-
Notifications
You must be signed in to change notification settings - Fork 209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
configure autocomplete provider based on cody LLM settings in site config #1035
configure autocomplete provider based on cody LLM settings in site config #1035
Conversation
…e-autocomplete-provider-based-on-site-config
I wonder if we should fall back to the completions provider from site config if provider/model/token is misconfigured in VSCode settings. The current approach for this case is not to create any completions provider. It may be more user-friendly. WDYT, @chwarwick? |
yeah this was done on purpose so if you really manually set something, we can show you what's wrong and not "silently ignore it and leave you with no debug info" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, but if you haven't already can you verify this works or has a proper fall back when connecting to a legacy sg version that doesn't have the provider available in the LLM config
@@ -46,6 +46,7 @@ query CurrentSiteCodyLlmConfiguration { | |||
fastChatModelMaxTokens | |||
completionModel | |||
completionModelMaxTokens | |||
provider |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this doesn't cause issues if the provider field does not exist?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch! How did I miss that?! Thank you, @chwarwick!
Addressed in a16c760
Honestly, I don't like the implementation. Do you know of a more robust way of getting a potentially non-existing field?
cc: @philipp-spiess
Thanks for your review, @chwarwick! |
…e-autocomplete-provider-based-on-site-config
Part of #931
Test in pair with sourcegraph/sourcegraph#56568
Defines the autocomplete provider config based on the completions provider and model names from the site config.
The suggested configuration hierarchy:
cody.autocomplete.advanced.provider
field in VSCode settings is set to a supported provider name, and all the additional conditions like model, access token, etc. are met the corresponding provider config is returned. Otherwise, returnnull
(completions provider is not created).null
is returned (completions provider is not created).TODO:
createProviderConfig
testsTest plan