Create a Dataset

  • Method: POST

  • Endpoint: https://api.athina.ai/api/v1/dataset_v2

  • Headers:

    • athina-api-key: YOUR_ATHINA_API_KEY
    • Content-Type: application/json
  • Body: See the full list of request body parameters here.

Sample Request Body

{
  // required fields
  "source": "api",
  "name": "Demo Dataset",

  // all the fields below are optional
  "description": "This is a sample demo dataset",
  "language_model_id": "gpt-4",
  "prompt_template": [
    {
      "role": "system",
      "content": "You are an AI that answers user queries given the information from the context"
    },
    {
      "role": "user",
      "content": "Given this context {context}, Answer this query: {query}"
    }
  ],
  "dataset_rows": [
    {
      "query": "When did Virgin Australia start operating?",
      "context": [
        "\"Virgin Australia, the trading name of Virgin Australia Airlines Pty Ltd, is an Australian-based airline. It is the largest airline by fleet size to use the Virgin brand. It commenced services on 31 August 2000 as Virgin Blue, with two aircraft on a single route. It suddenly found itself as a major airline in Australia's domestic market after the collapse of Ansett Australia in September 2001. The airline has since grown to directly serve 32 cities in Australia, from hubs in Brisbane, Melbourne and Sydney.\""
      ],
      "response": "Virgin Australia commenced services on 31 August 2000 as Virgin Blue, with two aircraft on a single route.",
      "expected_response": "Virgin Australia started services in August 2000"
    },
    {
      "query": "When was Tomoaki Komorida born?",
      "context": [
        "\"Komorida was born in Kumamoto Prefecture on July 10, 1981. After graduating from high school, he joined the J1 League club Avispa Fukuoka in 2000. Although he debuted as a midfielder in 2001, he did not play much and the club was relegated to the J2 League at the end of the 2001 season. In 2002, he moved to the J2 club Oita Trinita. He became a regular player as a defensive midfielder and the club won the championship in 2002 and was promoted in 2003. He played many matches until 2005. In September 2005, he moved to the J2 club Montedio Yamagata. In 2006, he moved to the J2 club Vissel Kobe. Although he became a regular player as a defensive midfielder, his gradually was played less during the summer. In 2007, he moved to the Japan Football League club Rosso Kumamoto (later Roasso Kumamoto) based in his local region. He played as a regular player and the club was promoted to J2 in 2008. Although he did not play as much, he still played in many matches. In 2010, he moved to Indonesia and joined Persela Lamongan. In July 2010, he returned to Japan and joined the J2 club Giravanz Kitakyushu. He played often as a defensive midfielder and center back until 2012 when he retired.\""
      ],
      "response": "Tomoaki Komorida was born on July 10,1981.",
      "expected_response": "Tomoaki Komorida was born in July, 1981"
    }
  ]
}

Sample Response

{
  "status": "success",
  "data": {
    "dataset": {
      "id": "5583b2fd-8940-4a8a-bcf4-e83da95b25a5",
      "source": "api",
      "user_id": "91cfffe9-03f1-4d50-acee-07c4115de42f",
      "org_id": "athina",
      "name": "Demo Dataset",
      "description": "This is a sample demo dataset",
      "language_model_id": "gpt-4",
      "prompt_template": [
        {
          "role": "system",
          "content": "You are an AI that answers user queries given the information from the context"
        },
        {
          "role": "user",
          "content": "Given this context {context}, Answer this query: {query}"
        }
      ],
      "created_at": "2024-04-12T23:35:24.792Z",
      "updated_at": "2024-04-12T23:35:24.792Z"
    }
  }
}

Add Rows to a Dataset

First head to https://app.athina.ai/develop and create a dataset.

Then, you can use the dataset ID to add rows to the dataset.

  • Method: POST

  • Endpoint: https://api.athina.ai/api/v1/dataset_v2/:dataset_id/add-rows

  • Headers:

    • athina-api-key: YOUR_ATHINA_API_KEY
    • Content-Type: application/json

You can get the dataset_id from the dataset URL in the browser, or from the response of the create request.

Sample Request Body

{
  "dataset_rows": [
    {
      "query": "When did Virgin Australia start operating?",
      "context": [
        "Virgin Australia, the trading name of Virgin Australia Airlines Pty Ltd, is an Australian-based airline. It is the largest airline by fleet size to use the Virgin brand. It commenced services on 31 August 2000 as Virgin Blue, with two aircraft on a single route. It suddenly found itself as a major airline in Australia's domestic market after the collapse of Ansett Australia in September 2001. The airline has since grown to directly serve 32 cities in Australia, from hubs in Brisbane, Melbourne and Sydney."
      ],
      "response": "Virgin Australia commenced services on 31 August 2000 as Virgin Blue, with two aircraft on a single route.",
      "expected_response": "Virgin Australia started services in August 2000"
    },
    {
      "query": "When was Tomoaki Komorida born?",
      "context": [
        "Komorida was born in Kumamoto Prefecture on July 10, 1981. After graduating from high school, he joined the J1 League club Avispa Fukuoka in 2000. Although he debuted as a midfielder in 2001, he did not play much and the club was relegated to the J2 League at the end of the 2001 season. In 2002, he moved to the J2 club Oita Trinita. He became a regular player as a defensive midfielder and the club won the championship in 2002 and was promoted in 2003. He played many matches until 2005. In September 2005, he moved to the J2 club Montedio Yamagata. In 2006, he moved to the J2 club Vissel Kobe. Although he became a regular player as a defensive midfielder, his gradually was played less during the summer. In 2007, he moved to the Japan Football League club Rosso Kumamoto (later Roasso Kumamoto) based in his local region. He played as a regular player and the club was promoted to J2 in 2008. Although he did not play as much, he still played in many matches. In 2010, he moved to Indonesia and joined Persela Lamongan. In July 2010, he returned to Japan and joined the J2 club Giravanz Kitakyushu. He played often as a defensive midfielder and center back until 2012 when he retired."
      ],
      "response": "Tomoaki Komorida was born on July 10,1981.",
      "expected_response": "Tomoaki Komorida was born in July, 1981"
    }
  ]
}

Sample Response

{
  "status": "success",
  "data": {
    "message": "Dataset rows added successfully"
  }
}

A dataset can have a maximum of 1000 rows. If the number of rows > 1000, the API will throw a 400 exception.

A dataset row can have any key-value pairs. Support data types for value are:

  • integer
  • string
  • boolean
  • object
  • array

Each field must be of the same type across all rows in the dataset.

For example, if one of the fields in a row is called query and is of type string, then all rows with the field query must be of type string.