DocsGetting started

Getting started

In this getting started 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.
  • Install all required prerequisites.
  • Create and configure the necessary API keys.
  • Run your PromptQL project in a local environment.
  • Ask your questions with PromptQL playground.

Setup

Install the DDN CLI

bash copy curl -L https://graphql-engine-cdn.hasura.io/ddn/cli/v4/get.sh | bash

Install Docker

Follow the instructions on the Docker website to install Docker on your machine.

Log in with the CLI

Logging in allows you to connect to the PromptQL runtime which is necessary for development. It also allows you to deploy your project to Hasura DDN.

ddn auth login

You will be redirected to DDN signup/login page.

Validate the installation

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

ddn doctor

Build your PromptQL app

Clone the example project

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

git clone [email protected]: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.

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

Browser support: PromptQL playground is supported on all browsers except Firefox and Safari. Support for these browsers should be available shortly.

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?