Skip to content

Latest commit

 

History

History
61 lines (45 loc) · 3.19 KB

CONTRIBUTING.md

File metadata and controls

61 lines (45 loc) · 3.19 KB

Proposed API Usage

This is the shape of the API:

export class ChatReferenceBinaryData {
	/**
	 * The MIME type of the binary data.
	 */
	readonly mimeType: string;

	/**
	 * Retrieves the binary data of the reference.
	 * @returns A promise that resolves to the binary data as a Uint8Array.
	 */
	data(): Thenable<Uint8Array>;

	/**
	 * @param mimeType The MIME type of the binary data.
	 * @param data The binary data of the reference.
	 */
	constructor(mimeType: string, data: () => Thenable<Uint8Array>);
}

After creating a chat handler, you can access attached variables via request.references.

Notes:

  1. There are several variable types for handling images. Images can originate from a URI, which is typically sourced from a workspace or file explorer, or from ChatReferenceBinaryData, often used for images copied from the clipboard
  2. URI files must be read and converted to base64 strings to be used.
  3. ChatReferenceBinaryData returns a promise that resolves to the binary data as a UInt8Array, which must be converted to base64 strings to be used.

Chat Example

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.

When an extension uses the Chat or the Language Model API, we call it a GitHub Copilot Extension, since GitHub Copilot is the provider of the Chat and the Language Model experience.

This GitHub Copilot Extension sample shows:

  • How to contribute a chat participant to the GitHub Copilot Chat view.
  • How to use the proposed API to get image data from the chat request.

Documentation can be found here:

Running the Sample

  • Run npm install in terminal to install dependencies
  • Run the Launch Extension target in the Debug View. This will:
    • Start a task npm: watch to compile the code
    • Run the extension in a new VS Code window
    • You will see the @vision chat participant show in the GitHub Copilot Chat view

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Tests can be run via node -- test after compiling the code with npx tsc.