Skip to content

Create prompt sets ​

Save a reusable project-update prompt, then test it with sample input. At the end you will have a draft template and a compiled preview you can inspect.

Prerequisites ​

  • A session token and an existing workspace you can access.
  • Prompt Lab access for your account and workspace.
  • curl and jq installed.

Follow Prerequisites to set TOKEN, then set WORKSPACE_ID to your actual workspace identifier.

Prompt Lab Flow ​

Create a draft → provide sample input → inspect the compiled preview. Previewing does not run an AI model.

Step 1: Create a Prompt Template ​

The template uses as the substitution point. Use the prompt field for its text.

TEMPLATE_RESPONSE="$(curl --fail-with-body -sS -X POST \
  "https://api.chainabit.com/api/v1/workspaces/$WORKSPACE_ID/ai/prompt-lab/templates" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name":"Project update","prompt":"Summarize this project update in two sentences: {{input}}"}')"
printf '%s\n' "$TEMPLATE_RESPONSE" | jq .
export TEMPLATE_ID="$(printf '%s\n' "$TEMPLATE_RESPONSE" | jq -er '.data.id')"

A successful request returns 201 Created. Its data object contains id, name, prompt, version, and status. The template starts as a draft. The command saves the real returned identifier for the next step.

Step 2: Test the Template ​

Supply the text to substitute with the required input field.

curl --fail-with-body -sS -X POST \
  "https://api.chainabit.com/api/v1/workspaces/$WORKSPACE_ID/ai/prompt-lab/templates/$TEMPLATE_ID/test" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"input":"The first milestone is complete. The review is scheduled for Friday."}' \
  | jq .

A successful request returns 201 Created with data.template, data.compiledPrompt, and data.tokenEstimate. Check the compiled text for your sample update and review whether the surrounding instructions are clear.

The preview does not contain a generated summary, measured model latency, or billed token usage. Its token estimate describes the compiled text.

Step 3: Publish the Template ​

The public workflow documented here ends with the draft preview. Earlier versions of this guide included a publishing request; it is no longer part of this public API walkthrough. If your goal is an AI-generated answer, continue with the AI session quickstart.

Summary ​

You created a draft, retained its returned identifier, and compiled a preview with sample input. If the preview is empty or unexpected, confirm that you used prompt during creation and input during testing.

Next Steps ​

Built with purpose. chainabit.com