Our Python SDK got smarter. We developed a Typscript SDK too. We are updating our SDK code blocks. Python SDKhere.Typscript SDKhere.
Description

Upload Dataset

This endpoint allows you to create a dataset with a given name from a provided file. The dataset can contain the following attributes: - `evaluated_model_system_prompt` - text - `evaluated_model_retrieved_context` - text array - `evaluated_model_input` - text - `evaluated_model_output` - text - `evaluated_model_gold_answer` - text - `meta_evaluated_model_name` - text - `meta_evaluated_model_provider` -text - `meta_evaluated_model_selected_model` - text - `meta_evaluated_model_params` - map (string -> text | number) All attributes are optional, but in principle, at least `evaluated_model_input` or `evaluated_model_output` should be provided. Whether other fields are required depends on the evaluations you plan to perform. Some evaluators require retrieved context, so `evaluated_model_retrieved_context` must be provided for them. For exact field requirements, see the evaluators' documentation. #### File Format The uploaded file should be in _CSV_ or _JSONL_ format. - **CSV** file should contain a header row with the attributes defined above. Fields `evaluated_model_retrieved_context` and `meta_evaluated_model_params` must be JSON encoded. The CSV should use commas as separators. - **JSONL** file should have JSON-encoded objects with keys set to the attributes defined above. JSON objects should be separated by a new line. ### Limits The file size cannot be larger than 20 MiB. The file cannot contain more than 30 000 samples. ### Custom Field Mapping The `custom_field_mapping` field is optional. It should be a JSON-encoded string where the key is the standardized field name (as defined above) and the value is the custom field name present in the provided dataset file. This mapping allows for flexible field naming in your dataset. The mapping value can be also a list, in that way the fields will be concatenated depending on a field type. ### Example request ``` curl -X POST https://api.patronus.ai/v1/datasets \ -H "x-api-key: <your_api_key>" \ -F "file=@<path_to_your_file>" \ -F "dataset_name=<name for created dataset>" \ -F 'custom_field_mapping={"evaluated_model_output": ["my-custom-field-name", "another-field"]}' ```

POST
/v1/datasets
/v1/datasets

The Authorization access token

Authorization

X-API-KEY<token>

In: header

Request Body

multipart/form-dataRequired

file
Required
File

Format: "binary"

dataset_name
Required
Dataset Name

Minimum length: 1

dataset_descriptionDataset Description

custom_field_mappingCustom Field Mapping

curl -X POST "https://api.patronus.ai/v1/datasets" \
  -H "X-API-KEY: <token>" \
  -F file="string" \
  -F dataset_name="string" \
  -F dataset_description="string" \
  -F custom_field_mapping="string"

Successful Response

{
  "dataset_id": "string",
  "dataset": {
    "id": "string",
    "name": "string",
    "description": "string",
    "creation_date": "2019-08-24",
    "created_at": "2019-08-24T14:15:22Z",
    "criteria": [
      "string"
    ],
    "samples": 0,
    "labeled": true,
    "use_case": "string",
    "type": "Patronus Managed",
    "has_evaluated_model_system_prompts": "none",
    "has_evaluated_model_retrieved_contexts": "none",
    "has_evaluated_model_inputs": "none",
    "has_evaluated_model_outputs": "none",
    "has_evaluated_model_gold_answers": "none"
  }
}