docsGuidesHave an existing DDN project?

Have an existing DDN project?

In this tutorial we’ll see how to add promptql to an existing DDN project.

Run codemod command using DDN

Make sure you have the latest version of cli.
sudo ddn update-cli

From the latest cli, run the following command from your project directory:

ddn codemod enable-promptql

This will make the following changes to your project:

  1. Changes to context.yaml:

    • Update the context.yaml file’s definition, to add a promptQL: true entry.
    • Add a new docker-start-promptql script to the context.yaml.
  2. Changes to docker compose file used to run Hasura engine:

    • Add a new service called promptql-playground.
    • Optionally add ENABLE_SQL_INTERFACE environment variable in engine service (if not present)
    • Optionally add io.hasura.ddn.service-name label in engine service (if not present)
  3. Enable promptQL for the DDN project (if the local project is linked to a DDN cloud project), and generate a PromptQL API key.

Add your API key

Add your api keys to the root level .env file as environment variable. This is used by the compose.yaml file above.

echo 'ANTHROPIC_API_KEY=your-anthropic-api-key' >> .env

Start your assistant

Open a new terminal window, and run the following command from the project directory:

ddn run docker-start-promptql

This command will execute the script found in your .hasura/context.yaml file.

When you run this command, Docker will start the engine, promptql-playground, and any other services present in the docker compose file.

Then run the following command to open the DDN console:

ddn console --local

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

This should open up your browser (or print a browser URL) for opening up your console. It’ll typically be something like: https://console.hasura.io/local?engine=localhost:3280&promptql=localhost:3282.