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

Context selection for prompts #982

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion docs/cody/capabilities/prompts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Click the **New prompt** button from the **Prompt Library** page.

There are also a few advanced options that you can configure.

![create-prompt](https://storage.googleapis.com/sourcegraph-assets/Docs/create-prompt-2025-01.png)
![create-prompt](https://storage.googleapis.com/sourcegraph-assets/Docs/create-prompts-0225.jpg)

### Draft prompts

Expand Down Expand Up @@ -90,6 +90,24 @@ Once site admins create tags, other users in your organization can assign tags t

You can assign multiple tags to a prompt and group them based on their functionality, category, or any other criteria for your organization. In addition, with tags assigned to prompts, you can filter prompts by tags in the Prompt Library.

## Specific and dynamic context

<Callout type="info">Sourcegraph 6.0 adds Beta support for the `@` mention menu in the prompt library.</Callout>

When writing prompts, you can leverage both specific and dynamic context through the `@` mention system.

![A dropdown appears after typing `@` in the prompt editor.](https://storage.googleapis.com/sourcegraph-assets/Docs/%40-mention-prompts-0225.jpg)

Type `@` to open a dropdown menu that lets you reference specific context like symbols, directories, files, repositories and web URLs.

When selecting a web URL, type out the domain, including the `https://` prefix, for example, https://sourcegraph.com.

For dynamic context that adapts based on what the user is working on, the prompt editor provides special mentions for the current selection, current file, current repository, current directory, and open tabs.
When a user runs a prompt template containing dynamic context mentions, they are automatically resolved to the appropriate specific context based on the user's current workspace state.
To add dynamic context, click on one of the buttons below the prompt editor. We will soon move the buttons into the `@` mention menu as well.

This powerful combination allows prompt authors to create templates that can intelligently access both explicitly defined context and contextually relevant information at runtime.

## Run prompts

You can run prompts via:
Expand Down