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

support @-mentioning URLs to use web page contents as context #3436

Merged
merged 1 commit into from Mar 19, 2024

Conversation

sqs
Copy link
Member

@sqs sqs commented Mar 16, 2024

This is an experimental (off-by-default) feature that lets you, in chat, @-mention web pages by URL to include their text contents as context for the LLM. For example, you can type what are the books listed at @https://slack.org/reading into chat, select the context item in the menu, and then press Enter, and Cody will read the contents of that web page.

Requires the experimental and undocumented "cody.experimental.urlContext": true VS Code setting (or the cody-url-context feature flag, which I enabled for all sourcegraph org members on dotcom).

This is just something we can experiment with internally for now.

Loom video (below)

@-mentioning.web.pages.by.URL.in.Cody.experimental.mp4

Test plan

CI

@sqs sqs requested a review from a team March 16, 2024 20:27
@sqs sqs force-pushed the sqs/at-url-context branch 5 times, most recently from 0b2d412 to 4c8cd77 Compare March 17, 2024 06:08
@sqs sqs force-pushed the sqs/at-url-context branch 2 times, most recently from 7edd060 to 0489c09 Compare March 17, 2024 07:37
Copy link
Member

@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.

Love the idea but I am unsure how useful this is because this won't work well if the website depends on JS to render its content and there's no way a user would notice when it's not working well right now. It also requires users to know the URL in which case they probably have it open in a browser already and it would be much more reliable for them to just copy-paste the content instead.

I think it's fine behind an experimental setting if the plan is to see how ergonomic it is but if we do want to move forward with it, we probably need a proper html client (ideally something like Playwright that can load the website and then extract the text) which adds a lot of complexity to this feature.

@toolmantim
Copy link
Contributor

V cool. Sadly I couldn't get the @-URL to tokenise and be used when testing this branch… I was keen to give it a try!

Did it work for you @philipp-spiess?

@philipp-spiess

This comment was marked as resolved.

@toolmantim
Copy link
Contributor

Got it working! I typo'd the JSON config to enable it 🤦🏼‍♂️

Worked well with Playwright docs.

For code docs in particular, it'd be nice to cut out the browser eventually. Being able to index the whole Playwright docs for example, and then being able to @-search the page titles to include the relevant page, vs copy and pasting from a browser.

But it's good to be able to attach an arbitrary thing into the chat as needed. There's probably a heap of use cases based on this we haven't even considered.

Base automatically changed from sqs/at-mention-parsing to main March 18, 2024 15:26
@sqs
Copy link
Member Author

sqs commented Mar 18, 2024

@philipp-spiess:

Love the idea but I am unsure how useful this is because this won't work well if the website depends on JS to render its content and there's no way a user would notice when it's not working well right now. It also requires users to know the URL in which case they probably have it open in a browser already and it would be much more reliable for them to just copy-paste the content instead.

I think it's fine behind an experimental setting if the plan is to see how ergonomic it is but if we do want to move forward with it, we probably need a proper html client (ideally something like Playwright that can load the website and then extract the text) which adds a lot of complexity to this feature.

Yes, agreed. This exposes a (future) gap in how we show context for things that aren't a file range in the current editor or linkable to a range on Sourcegraph. My intent is to keep it experimental to have a way to start exposing these gaps.

Also the point about how there are errors shown with each keystroke. I'll see how I can fix that even before merging this.

@sqs sqs force-pushed the sqs/at-url-context branch 2 times, most recently from 82ea358 to 620bfab Compare March 19, 2024 03:46
This is an experimental (off-by-default) feature that lets you, in chat, @-mention web pages by URL to include their text contents as context for the LLM. For example, you can type `what are the books listed at @https://slack.org/reading` into chat, select the context item in the menu, and then press Enter, and Cody will read the contents of that web page.

Requires the experimental and undocumented `"cody.experimental.urlContext": true` VS Code setting.

This is just something we can experiment with internally for now.
Copy link
Contributor

@abeatrix abeatrix left a comment

Choose a reason for hiding this comment

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

Oh wow just played around with this and think this could be pretty helpful in loading online docs!
image

nit: Should we update the heading title for mentionQuery.type === 'url' to 'Enter a valid URL to include...' (instead of 'Search for a file to include...')?

image

image

@sqs
Copy link
Member Author

sqs commented Mar 19, 2024

@abeatrix that tooltip idea is a good one. I'll add that in a followup.

@sqs sqs merged commit 71c7080 into main Mar 19, 2024
19 of 20 checks passed
@sqs sqs deleted the sqs/at-url-context branch March 19, 2024 23:29
@jdorfman
Copy link
Member

community member:

"bro this is a effen game changer"

Amazing work @sqs

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

5 participants