Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

feat/cody: new site config for smart context#62802

Merged
abeatrix merged 3 commits into
mainfrom
bee/smart-context
May 21, 2024
Merged

feat/cody: new site config for smart context#62802
abeatrix merged 3 commits into
mainfrom
bee/smart-context

Conversation

@abeatrix

@abeatrix abeatrix commented May 20, 2024

Copy link
Copy Markdown
Contributor

CLOSE https://github.com/sourcegraph/cody-issues/issues/76

See the linked issue for details.

Objectives:

  • Add a new site config value called SmartContext
  • SmartContext is default to "enabled"
  • Update site config docs for ChatModelMaxTokens to indicate it is not respected if SmartContext is enabled, and that instead, Cody will determine the max tokens to use based on the model name

Changes:

  • Add SmartContext field to CompletionsConfig struct
  • Implement SmartContext() method in codyLLMConfigurationResolver
  • Set default SmartContext value to "enabled" if not provided, and "disabled" to disable the feature
  • Update schema and documentation to describe SmartContext feature
  • Update documentation of chatModelMaxTokens regarding how it would be overrides when SmartContext is enabled

Test plan

  1. Run sg start from this branch to start a Sourcegraph instance locally
  2. Visit https://sourcegraph.test:3443/api/console#%7B%22query%22%3A%22%23%20Type%20queries%20here%2C%20with%20completion%2C%20validation%2C%20and%20hovers.%5Cn%23%5Cn%23%20Here's%20an%20example%20query%20to%20get%20you%20started%3A%5Cn%5Cnquery%20CurrentSiteCodyLlmConfiguration%20%7B%5Cn%20%20%20%20site%20%7B%5Cn%20%20%20%20%20%20%20%20codyLLMConfiguration%20%7B%5Cn%20%20%20%20%20%20%20%20%20%20%20%20smartContext%5Cn%20%20%20%20%20%20%20%20%7D%5Cn%20%20%20%20%7D%5Cn%7D%22%2C%22operationName%22%3A%22CurrentSiteCodyLlmConfiguration%22%7D to RUN the graphQL query below that the Cody clients would call
  3. If "completions.smartContext" is not configured in your site configurations, it will be defaulted to "enabled":
  • image
  1. Go to your site configurations and set "completions.smartContext" to "disabled"
  • image
  • image
  1. Run the graphQL query again to verify that it returns "disabled":

image

graphQL query

query CurrentSiteCodyLlmConfiguration {
    site {
        codyLLMConfiguration {
            smartContext
        }
    }
}

@cla-bot cla-bot Bot added the cla-signed label May 20, 2024
- Add `SmartContext` field to `CompletionsConfig` struct
- Implement `SmartContext()` method in `codyLLMConfigurationResolver`
- Set default `SmartContext` value to "enabled" if not provided
- Update schema and documentation to describe `SmartContext` feature
@abeatrix abeatrix force-pushed the bee/smart-context branch from f3b8a93 to 170845c Compare May 21, 2024 00:07
@abeatrix abeatrix marked this pull request as ready for review May 21, 2024 01:48
@abeatrix abeatrix requested review from a team, arafatkatze and emidoots May 21, 2024 01:49
@abeatrix abeatrix changed the title feat(completions): add smart context site config feat/cody: new site config for smart context May 21, 2024

@arafatkatze arafatkatze left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified and tested locally.

@abeatrix abeatrix merged commit 2cb1112 into main May 21, 2024
@abeatrix abeatrix deleted the bee/smart-context branch May 21, 2024 17:45
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