Skip to main content
Version: PromptQL

GitHub Assistant

In this guide, you'll get hands on experience with PromptQL and the GitHub connector. We will be building a "Github Issues" assistant.

You will learn how to:

  • Set up PromptQL to work with a GitHub issues and pull requests.
    • You will be able to do natural language query to triage feature requests, bugs and other issues with your connected Github repository.
  • Create and configure the necessary API keys.
  • Run your PromptQL project in a local environment.
  • Ask your questions with PromptQL playground.

Prerequisites

Install the DDN CLI

Minimum version requirements

To use this guide, ensure you've installed/updated your CLI to at least v2.28.0.

Simply run the installer script in your terminal:

curl -L https://graphql-engine-cdn.hasura.io/ddn/cli/v4/get.sh | bash
ARM-based Linux Machines

Currently, the CLI does not support installation on ARM-based Linux systems.

Install Docker

The Docker-based workflow helps you iterate and develop locally without deploying any changes to Hasura DDN, making the development experience faster and your feedback loops shorter. You'll need Docker Compose v2.20 or later.

Validate the installation

You can verify that the DDN CLI is installed correctly by running:

ddn doctor

Build your PromptQL app

##ge# Clone the example project

The example project is already set up to connect PromptQL to any GitHub repo.

git clone git@github.com:hasura/example-promptql-github.git
cd example-promptql-github

Set up your .env file

Set up your .env file with your GitHub API token.

cp .env.example .env

Add GitHub API token to .env

For the Github integration. Create an API token from https://github.com/settings/tokens

# .env

...
GITHUB_API_TOKEN=<GITHUB_API_TOKEN>

This token only needs read access to the repo you are interested in.

Example: PromptQL on GitHub

Set up your GitHub repo

Head to app/connector/github/index.ts and change the org name and the repo name to something you'd like:

// index.ts

...
const manager = new GitHubIssueSyncManager('<org-name>', '<repo-name>');
if (!process.env.GITHUB_API_TOKEN) {
...

Setup your DDN project

This will create a Hasura DDN cloud project and set up PromptQL keys to connect to the PromptQL runtime.

ddn project init

Fire up your PromptQL project

Build your supergraph.

ddn supergraph build local

Then bring up the PromptQL API server, the engine and the connector

ddn run docker-start

You'll notice in amongst your Docker logs that your github synchronization has started.

Details

Docker logs [2024-01-01 12:00:01] Starting GitHub sync...


[2024-01-01 12:00:02] Fetching repository metadata...


[2024-01-01 12:00:03] Syncing issues and pull requests...


[2024-01-01 12:00:04] Loading repository contents...


[2024-01-01 12:00:05] GitHub sync complete

If the specified repo has many issues or comments it may take some time to get them all and you may be rate limited. That's ok, you can go ahead and try PromptQL without the process having fully finished yet.

If you notice some logs regarding GitHub permissions, check that your GitHub API token has the correct permissions for the repo you're trying to access.

Restarting the app

If you made a mis-step or want to start from scratch, simply restarting the docker containers will reset all state including any loaded data.

ddn run docker-start

Act on your data

Open the PromptQL playground

In another terminal, run

ddn console --local

Ask questions about your GitHub repo

The console is a web app hosted at console.hasura.io that connects to your local PromptQL API and data sources. Your data is processed in the DDN PromptQL runtime but isn't persisted externally.

Head over to the console and ask a few questions about your GitHub repo.

> What are the open pull requests?
> What kind of questions can I ask?