Note
Copilot Extensions are in public beta and may be subject to change.
This project is a Go application that demonstrates how to use retrieval augmented generation in an agent-based GitHub Copilot Extension.
- Go 1.16 or higher
- Set the following environment variables (example below):
export PORT=8080
export CLIENT_ID=Iv1.0ae52273ad3193eb // the application id
export CLIENT_SECRET="your_client_secret" // generate a new client secret for your application
export FQDN=https://6de513480979.ngrok.app // use ngrok to expose a url
- Clone the repository:
git clone [email protected]:copilot-extensions/rag-extension.git
cd rag-extension
- Install dependencies:
go mod tidy
- Start up ngrok with the port provided:
ngrok http http://localhost:8080
- Set the environment variables (use the ngrok generated url for the
FDQN
) - Run the application:
go run .
- In the
Copilot
tab of your Application settings (https://github.com/settings/apps/<app_name>/agent
)
- Set the URL that was set for your FQDN above with the endpoint
/agent
(e.g.https://6de513480979.ngrok.app/agent
) - Set the Pre-Authorization URL with the endpoint
/auth/authorization
(e.g.https://6de513480979.ngrok.app/auth/authorization
)
- In the
General
tab of your application settings (https://github.com/settings/apps/<app_name>
)
- Set the
Callback URL
with the/auth/callback
endpoint (e.g.https://6de513480979.ngrok.app/auth/callback
) - Set the
Homepage URL
with the base ngrok endpoint (e.g.https://6de513480979.ngrok.app/auth/callback
)
- Ensure your permissions are enabled in
Permissions & events
>
Account Permissions
>Copilot Chat
>Access: Read Only
- Ensure you install your application at (
https://github.com/apps/<app_name>
) - Now if you go to
https://github.com/copilot
you can@
your agent using the name of your application.
Test out the agent with the following commands!
Description | Prompt |
---|---|
User asking @agent how to configure a Copilot extension |
@agent How do I configure a copilot extension? |
User asking @agent what a Copilot extension looks like |
@agent What is the response format for a copilot extension? |