Skip to main content
POST
/
api
/
experiments
/
create
{
  "columns": [
    {
      "id": "68a8b20d-f00b-4c10-9ae1-d64424da6e15",
      "model": "gpt-3.5-turbo",
      "name": "Prompt version generation - AAA",
      "temperature": 0.7,
      "max_completion_tokens": 256,
      "prompt_messages": [
        {
          "role": "system",
          "content": [{"text": "You are a helpful assistant", "type": "text"}]
        },
        {
          "role": "user",
          "content": [{"text": "{{input}}", "type": "text"}]
        }
      ]
    }
  ],
  "rows": [
    {
      "input": {
        "current_prompt_version": "v1",
        "prompt_versions_diff": "some_diff"
      },
      "results": [
        {
          "output": {
            "something": "output"
          }
        }
      ]
    }
  ],
  "name": "My Experiment",
  "description": "Experiment description"
}
{
  "id": "experiment_id_123",
  "name": "My Experiment",
  "description": "Experiment description"
}
Create a new experiment with columns and rows.

Authentication

  • API key: Authorization: Bearer <API key>

Request Body

{
  "columns": [
    {
      "id": "68a8b20d-f00b-4c10-9ae1-d64424da6e15",
      "model": "gpt-3.5-turbo",
      "name": "Prompt version generation - AAA",
      "temperature": 0.7,
      "max_completion_tokens": 256,
      "prompt_messages": [
        {
          "role": "system",
          "content": [{"text": "You are a helpful assistant", "type": "text"}]
        },
        {
          "role": "user",
          "content": [{"text": "{{input}}", "type": "text"}]
        }
      ]
    }
  ],
  "rows": [
    {
      "input": {
        "current_prompt_version": "v1",
        "prompt_versions_diff": "some_diff"
      },
      "results": [
        {
          "output": {
            "something": "output"
          }
        }
      ]
    }
  ],
  "name": "My Experiment",
  "description": "Experiment description"
}

Examples

import requests

url = "https://api.keywordsai.co/api/experiments/create"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
}

data = {
    "columns": [
        {
            "model": "gpt-3.5-turbo",
            "name": "Test Column",
            "prompt_messages": [
                {"role": "user", "content": [{"text": "{{input}}", "type": "text"}]}
            ]
        }
    ],
    "rows": [
        {
            "input": {"input": "test"}
        }
    ],
    "name": "My Experiment"
}

response = requests.post(url, headers=headers, json=data)
print(response.json())

Response

{
  "id": "experiment_id_123",
  "name": "My Experiment",
  "description": "Experiment description"
}