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

Intelligent Cody: MVP using VSCode API #692

Merged
merged 20 commits into from
Aug 21, 2023
Merged

Intelligent Cody: MVP using VSCode API #692

merged 20 commits into from
Aug 21, 2023

Conversation

efritz
Copy link
Contributor

@efritz efritz commented Aug 15, 2023

This is an experimental (currently internal) MVP of fetching first-order definitions of symbols available in the current file. See the Intelligent Cody update for additional context.

This PR supplements the context fetching mechanism used to grab embeddings to also utilize the local VSCode API to emulate what we've been doing in the server-side implementation https://github.com/sourcegraph/sourcegraph/pull/51690.

Note: much of this code is shared from Cesar's work in #78, and my hackathon project in #472.

Test plan

Tested locally, and gated all changed code with an experimental VSCode extension setting feature flag.

@efritz efritz force-pushed the ef/ship-something branch 3 times, most recently from 9dfc085 to 64c4703 Compare August 16, 2023 13:52
@efritz efritz changed the title intelligent cody: vscode api Intelligent Cody: MVP using VSCode API Aug 16, 2023
@efritz efritz marked this pull request as ready for review August 16, 2023 14:01
@efritz efritz self-assigned this Aug 16, 2023
Copy link
Member

@beyang beyang left a comment

Choose a reason for hiding this comment

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

Can you provide some screenshots and/or illustrative examples of where this improves response quality and where it hurts response quality?

Is it targeted at autocomplete, chat, or all of the above?

lib/shared/src/chat/transcript/index.ts Show resolved Hide resolved
lib/shared/src/codebase-context/index.ts Show resolved Hide resolved
lib/shared/src/graph-context/index.ts Outdated Show resolved Hide resolved
vscode/src/chat/ContextProvider.ts Outdated Show resolved Hide resolved
lib/shared/src/graph-context/index.ts Outdated Show resolved Hide resolved
@efritz
Copy link
Contributor Author

efritz commented Aug 17, 2023

Can you provide some screenshots and/or illustrative examples of where this improves response quality and where it hurts response quality?

Sure, will gather some and post in a comment on the PR.

Is it targeted at autocomplete, chat, or all of the above?

Right now it's only set up for chat, but I'm currently working (between a few other tasks) to thread the graph context fetcher through autocomplete as well.

@toolmantim
Copy link
Contributor

For the name, I'm trying to move to a single bit of UI that summarises all the context prep Cody did and was included (vs the separate drop-downs we're adding here). The name would sit alongside "Embeddings".

My ranked naming suggestions (instead of "Intelligent Cody"… Cody is already intelligent in lots of ways 😉)

  1. Add experimental support for locally generated Symbol Context
  2. Add experimental support for locally generated Precise Symbol Context
  3. Add experimental support for locally generated Code Intel Context

imo from a product design POV calling it "Symbol Context" and using the word "Symbols" is probably best, alongside "Embeddings". And we can have other single-word bits of context, like "Ownership"and what-have-you.

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.

That's awesome! Since all the changes are behind the experimental flag, we can merge this one safely and iterate on improvements in follow-up PRs.

lib/shared/src/codebase-context/index.ts Show resolved Hide resolved
lib/shared/src/codebase-context/index.ts Outdated Show resolved Hide resolved
preciseContext?: PreciseContext
}

export interface PreciseContext {
Copy link
Member

Choose a reason for hiding this comment

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

Is this structure based on the work that's happening on the server-side? (should we keep in sync with something?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's meant to conform to the GraphQL schema we've defined here, so keeping it in the same shape will make the Remote API integration easier since we can just return the same type directly.

Copy link
Member

Choose a reason for hiding this comment

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

Would it be helpful to leave a comment on that?

lib/shared/src/graph-context/index.ts Outdated Show resolved Hide resolved
lib/shared/src/graph-context/index.ts Outdated Show resolved Hide resolved
lib/shared/src/graph-context/index.ts Outdated Show resolved Hide resolved
lib/ui/src/chat/PreciseContext.tsx Outdated Show resolved Hide resolved
vscode/src/chat/ContextProvider.ts Outdated Show resolved Hide resolved
vscode/src/chat/ContextProvider.ts Outdated Show resolved Hide resolved
vscode/src/chat/ContextProvider.ts Outdated Show resolved Hide resolved
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.

Also, we should add an entry about the new experimental setting to vscode/CHANGELOG.md.

@efritz
Copy link
Contributor Author

efritz commented Aug 18, 2023

@beyang Here's a quick example. I highlighted the part of the code I wanted precise symbols to be extracted from, then asked something about the shape of the type of one of the struct members (defined in the stdlib).

image

Clicking on the sidebar jumps me to ~/go/pkg/mod/golang.org/x/crypto@v0.11.0/ssh/certs.go:

image

@efritz efritz requested a review from beyang August 18, 2023 23:28
lib/ui/src/chat/PreciseContext.tsx Outdated Show resolved Hide resolved
lib/ui/src/chat/PreciseContext.tsx Outdated Show resolved Hide resolved
vscode/src/chat/GraphContextProvider.test.ts Outdated Show resolved Hide resolved
vscode/src/chat/GraphContextProvider.test.ts Outdated Show resolved Hide resolved
vscode/src/chat/GraphContextProvider.test.ts Outdated Show resolved Hide resolved
vscode/src/chat/GraphContextProvider.test.ts Outdated Show resolved Hide resolved
vscode/src/chat/GraphContextProvider.test.ts Show resolved Hide resolved
vscode/src/chat/GraphContextProvider.ts Show resolved Hide resolved
@beyang
Copy link
Member

beyang commented Aug 21, 2023

For the name, I'm trying to move to a single bit of UI that summarises all the context prep Cody did and was included (vs the separate drop-downs we're adding here). The name would sit alongside "Embeddings".

@toolmantim we should not use "embeddings" anywhere that's visible to the end user. Embeddings are an implementation detail and we need another descriptor for it, like "AI-enabled search" or "Intelligent search".

@efritz
Copy link
Contributor Author

efritz commented Aug 21, 2023

How do I turn it on to try it out?

There's an extension setting, mentioned in the changelog. It's not reactive so you'll need to reload the extension once you enable it (for now).

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.

5 participants