Chat extensions
Visual Studio Code's Copilot Chat architecture enables extension authors to integrate with the GitHub Copilot Chat experience. A chat extension is a VS Code extension that uses the Chat extension API by contributing a Chat participant.
Chat participants are domain experts that can answer user queries within a specific domain. Participants can use different approaches to process a user query:
- Use AI to interpret the request and generate a response, for example by using the Language Model API
- Forward the user request to a backend service
- Use procedural logic and local resources
Participants can use the language model in a wide range of ways. Some participants only make use of the language model to get answers to custom prompts, for example the sample chat participant. Other participants are more advanced and act like autonomous agents that invoke multiple tools with the help of the language model. An example of such an advanced participant is the built-in @workspace
that knows about your workspace and can answer questions about it. Internally, @workspace
is powered by multiple tools: GitHub's knowledge graph, combined with semantic search, local code indexes, and VS Code's language services.
When a user explicitly mentions a @participant
in their chat prompt, that prompt is forwarded to the extension that contributed that specific chat participant. The participant then uses a ResponseStream
to respond to the request. To provide a smooth user experience, the Chat API is streaming-based. A chat response can contain rich content, such as Markdown, file trees, command buttons, and more. Get more info about the supported response output types.
To help the user take the conversation further, participants can provide follow-ups for each response. Follow-up questions are suggestions that are presented in the chat user interface and might give the user inspiration about the chat extension's capabilities.
Participants can also contribute commands, which are a shorthand notation for common user intents, and are indicated by the /
symbol. The extension can then use the command to prompt the language model accordingly. For example, /explain
is a command for the @workspace
participant that corresponds with the intent that the language model should explain some code.