> ## Documentation Index
> Fetch the complete documentation index at: https://docs.parea.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Collection

> Creates a dataset

<RequestExample>
  ```python python theme={null}
  p = Parea(api_key="PAREA_API_KEY")  # replace with your API key

  data = [
      {"problem": "1+2", "target": 3, "tags": ["easy"]},
      {"problem": "Solve the differential equation dy/dx = 3y.", "target": "y = c * e^(3x)", "tags": ["hard"]}
  ]

  # this will create a new dataset on Parea named "Math problems".
  # The dataset will have one column named "problem", and two columns using the reserved names "target" and "tags".
  # when using this dataset the expected prompt template should have a placeholder for the varible problem.
  p.create_test_collection(data, name="Math problems")
  ```

  ```typescript typescript theme={null}
  const p = new Parea("PAREA_API_KEY"); // replace with your API key

  const data = [
      { problem: '1+2', target: 3, tags: ['easy'] },
      { problem: 'Solve the differential equation dy/dx = 3y.', target: 'y = c * e^(3x)', tags: ['hard'] },
  ];

  // this will create a new dataset on Parea named "Math problems".
  // The dataset will have one column named "problem", and two columns using the reserved names "target" and "tags".
  // when using this dataset the expected prompt template should have a placeholder for the variable problem.
  p.createTestCollection(data, 'Math problems 2');
  ```

  ```bash cURL theme={null}
  curl --request POST \
    --url https://parea-ai-backend-us-9ac16cdbc7a7b006.onporter.run/api/parea/v1/collection \
    --header 'Content-Type: application/json' \
    --header 'x-user-id: <api-key>' \
    --data '{
      "name": "Math problems",
      "column_names": [
          "problem"
      ],
      "test_cases": [
          {
            "inputs": {
              "problem": "1+2"
            },
            "tags": [
              "easy"
            ],
            "target": "3"
          }
      ]
  }'
  ```
</RequestExample>


## OpenAPI

````yaml post /api/parea/v1/collection
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers: []
security: []
paths:
  /api/parea/v1/collection:
    post:
      summary: Create Collection
      description: Creates a dataset
      operationId: create_collection_api_parea_v1_collection_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateTestCaseCollectionRequestSchema'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateTestCaseCollectionResponseSchema'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
        - APIKeyHeader: []
        - APIKeyHeader: []
components:
  schemas:
    CreateTestCaseCollectionRequestSchema:
      properties:
        name:
          type: string
          title: Name
          description: Name of the dataset
        column_names:
          items:
            type: string
          type: array
          title: Column Names
          description: Column names for the dataset
        test_cases:
          anyOf:
            - items:
                $ref: '#/components/schemas/TestCaseSchema'
              type: array
            - type: 'null'
          title: Test Cases
          description: Name of test cases/samples in the dataset
      type: object
      required:
        - name
        - column_names
      title: CreateTestCaseCollectionRequestSchema
      examples:
        - column_names:
            - language
            - framework
          name: Hello World Programs
          test_cases:
            - inputs:
                framework: fastapi
                language: python
              tags:
                - easy
              target: a good program here
    CreateTestCaseCollectionResponseSchema:
      properties:
        id:
          type: integer
          title: Id
          description: Unique identifier for the dataset
        last_updated_at:
          type: string
          title: Last Updated At
          description: Timestamp when the dataset was last updated
        test_case_ids:
          items:
            type: integer
          type: array
          title: Test Case Ids
          description: List of created test case IDs in the dataset
      type: object
      required:
        - id
        - last_updated_at
        - test_case_ids
      title: CreateTestCaseCollectionResponseSchema
      examples:
        - id: 5000
          last_updated_at: '2021-06-01T00:00:00Z'
          test_case_ids:
            - 12345
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    TestCaseSchema:
      properties:
        inputs:
          additionalProperties:
            type: string
          type: object
          title: Inputs
          description: >-
            Dictionary mapping input names to values. Input names correspond to
            the column names of the test case collection.
        target:
          anyOf:
            - type: string
            - type: 'null'
          title: Target
          description: Optional target/ground truth value for the test case/inputs
        tags:
          items:
            type: string
          type: array
          title: Tags
          description: List of tags associated with the test case
          default: []
      type: object
      required:
        - inputs
      title: TestCaseSchema
      examples:
        - inputs:
            framework: fastapi
            language: python
          tags:
            - easy
          target: a good program here
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: x-user-id

````