Skip to content
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

/symf: remove direct anthropic dependency, pass sourcegraph token #1207

Merged
merged 5 commits into from
Sep 27, 2023

Conversation

beyang
Copy link
Member

@beyang beyang commented Sep 27, 2023

Previously, symf talked directly to the Anthropic API. Now, it goes through a Sourcegraph instance to access the LLM. This PR updates Cody to pass the Sourcegraph auth token to symf and removes the old code for setting an Anthropic API token.

Test plan

Test locally:

  • Check out the main branch

  • Remove any cody.experimental.symf.anthropicKey in your settings.

  • Try running /symf [query]. You should see an error indicating that symf is unauthorized.

  • Check out this branch and run the extension

  • In the sidebar, run /symf [query], where query is either a keyword search or a natural language question

    • You should observe a pop-up indicating a new version of symf (v0.0.1) is being downloaded
  • You should see successful search results

@beyang beyang force-pushed the bl/symf-sg-auth branch 2 times, most recently from ebba582 to 7e87b8c Compare September 27, 2023 15:57
@philipp-spiess
Copy link
Contributor

@beyang I've been running this branch but when I run the /symf command, nothing happens in chat and the console is also not helpful 🤔

Screen.Recording.2023-09-27.at.13.46.47.mov

@@ -107,7 +107,7 @@ const register = async (
disposables.push(vscode.workspace.onDidChangeTextDocument(updateParseTreeOnEdit))
}

const symfRunner = platform.createSymfRunner?.(context, config.experimentalSymfAnthropicKey)
const symfRunner = platform.createSymfRunner?.(context, initialConfig.accessToken)
Copy link
Contributor

Choose a reason for hiding this comment

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

Have you looked into the chatClient available in the scope here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh nevermind you need that in the symf binary 🤦

Copy link
Member Author

Choose a reason for hiding this comment

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

symf currently issues its own query to transform the user query into a keyword search... I suppose we could move that out of symf into Cody/agent and then symf could focus solely on keyword search. Perhaps in a future PR.

Copy link
Contributor

@philipp-spiess philipp-spiess left a comment

Choose a reason for hiding this comment

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

Got it to work in the third repo i tried, I think if something breaks during index creation it might not recover properly.

@beyang beyang merged commit 81a60fd into main Sep 27, 2023
11 checks passed
@beyang beyang deleted the bl/symf-sg-auth branch September 27, 2023 20:31
Copy link
Member

@valerybugakov valerybugakov left a comment

Choose a reason for hiding this comment

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

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants