Skip to content

Latest commit

 

History

History
134 lines (105 loc) · 4.87 KB

README.md

File metadata and controls

134 lines (105 loc) · 4.87 KB

Skillset Example

Note

Copilot Extensions are in public preview and may be subject to change. Pre-release terms apply. You must have a GitHub Copilot license of any type to use Copilot Extensions.

Description

This code sample demonstrates building a Copilot Extension using the skillsets approach rather than a traditional agent. This extension is designed to generate random test and example data for a number of development purposes, by calling publicly available APIs.

Architectural Model

  • Skillsets: Define up to 5 API endpoints that Copilot can call directly. Copilot handles all AI interactions, prompt engineering, and response formatting.
  • Agents: Provide full control over the interaction flow, including custom prompt crafting and specific LLM model selection.

Architectural comparison between Skillsets and Agents

When to Choose Skillsets

Skillsets are ideal when you want to:

  • Quickly integrate existing APIs or services without managing AI logic
  • Focus purely on your service's core functionality
  • Maintain consistent Copilot-style interactions without extensive development
  • Get started with minimal infrastructure and setup

Use agents instead if you need:

  • Complex custom interaction flows
  • Specific LLM model control (using LLMs that aren't provided by the Copilot API)
  • Custom prompt crafting
  • Advanced state management

Example Implementation

This extension showcases the skillset approach by providing three simple endpoints that generate random development data:

  • Random commit messages
  • Lorem ipsum text generation
  • Random user data

Getting Started

  1. Clone the repository:
git clone [email protected]:copilot-extensions/skillset-example.git
cd skillset-example
  1. Install dependencies:
go mod tidy

Usage

  1. Start up ngrok with the port provided:
ngrok http http://localhost:8080
  1. Set the environment variables (use the ngrok generated url for the FDQN)
  2. Run the application:
go run .

Accessing the Extension in Chat:

  1. In the Copilot tab of your Application settings (https://github.com/settings/apps/<app_name>/agent)
  • Set the app type to "Skillset"
  • Specify the following skills
Name: random_commit_message
Inference description: Generates a random commit message
URL: https://<your ngrok domain>/random-commit-message
Parameters: { "type": "object" }
Return type: String
---
Name: random_lorem_ipsum 
Inference description: Generates a random Lorem Ipsum text.  Responses should have html tags present.
URL: https://<your ngrok domain>/random-lorem-ipsum
Parameters: 
{
   "type": "object",
   "properties": {
      "number_of_paragraphs": {
         "type": "number",
         "description": "The number of paragraphs to be generated.  Must be between 1 and 10 inclusive"
      },
      "paragraph_length": {
         "type": "string",
         "description": "The length of each paragraph.  Must be one of \"short\", \"medium\", \"long\", or \"verylong\""
      }
   }
}
Return type: String
---
Name: random_user
Inference description: Generates data for a random user
URL: https://<your ngrok domain>/random-user
Parameters: { "type": "object" }
Return type: String
  1. In the General tab of your application settings (https://github.com/settings/apps/<app_name>)
  • Set the Callback URL to anything (https://github.com works well for testing, in a real environment, this would be a URL you control)
  • Set the Homepage URL to anything as above
  1. Ensure your permissions are enabled in Permissions & events >
  • Account Permissions > Copilot Chat > Access: Read Only
  1. Ensure you install your application at (https://github.com/apps/<app_name>)
  2. Now if you go to https://github.com/copilot you can @ your skillset extension using the name of your app.

What can the bot do?

Here's some example things:

  • @skillset-example please create a random commit message
  • @skillset-example generate a lorem ipsum
  • @skillset-example generate a short lorem ipsum with 3 paragraphs
  • @skillset-example generate random user data

Implementation

This bot provides a passthrough to a couple of other APIs:

Documentation