Dataset
@dataclass
class Dataset:
id: str
created_at: str
metadata: Dict
name: Optional[str] = None
description: Optional[str] = None
items: Optional[List[DatasetItemDict]] = None
The unique identifier of the dataset. This is an immutable field generated when the dataset is created.
The date and time when the dataset was created, expressed in ISO 8601 format.
A dictionary containing additional data associated with the dataset. This can include user-defined key-value pairs that provide more context or details about the dataset.
An optional name for the dataset. This can be used to give a descriptive, human-readable title to the dataset for easier identification.
An optional description field that can provide more detailed information about the dataset, such as its purpose, contents, or specific characteristics.
items
Optional[List[DatasetItemDict]]
An optional list of items contained within the dataset. Each item in the list is a dictionary representing a specific data entry in the dataset.
Create a dataset
dataset = await sdk.api.create_dataset(
name="Foo", description="A dataset to store samples.", metadata={ "isDemo": True }
)
Params
An optional name for the dataset. This can be used to give a descriptive, human-readable title to the dataset for easier identification.
An optional description field that can provide more detailed information about the dataset, such as its purpose, contents, or specific characteristics.
A dictionary containing additional data associated with the dataset. This can include user-defined key-value pairs that provide more context or details about the dataset.
Response
Update a dataset
dataset = await sdk.api.update_dataset(
id="dataset_id", name="foo", description="bar", metadata={"demo": True}
)
Params
The unique identifier of the dataset. This is an immutable field generated when the dataset is created.
An optional name for the dataset. This can be used to give a descriptive, human-readable title to the dataset for easier identification.
An optional description field that can provide more detailed information about the dataset, such as its purpose, contents, or specific characteristics.
A dictionary containing additional data associated with the dataset. This can include user-defined key-value pairs that provide more context or details about the dataset.
Response
Get a dataset
dataset = await sdk.api.get_dataset(id="dataset_id")
Params
The unique identifier of the dataset. This is an immutable field generated when the dataset is created.
Response
Delete a dataset
await sdk.api.delete_dataset(id="dataset_id")
Params
The unique identifier of the dataset. This is an immutable field generated when the dataset is created.
Response
DatasetItem
@dataclass
class DatasetItem:
id: str
created_at: str
dataset_id: str
metadata: Dict
input: Dict
expected_output: Optional[Dict] = None
intermediary_steps: Optional[List[Dict]] = None
The unique identifier of the dataset item. Each item within a dataset has its own unique ID.
The date and time when the dataset item was created, expressed in ISO 8601 format.
The identifier of the dataset to which this item belongs. Links the item to its parent dataset.
A dictionary containing additional data associated with this dataset item. This can include specific details relevant to the item.
The input data for this dataset item. Typically contains the parameters or information that forms the LLM request.
The optional output data for this dataset item. Represents the result or outcome associated with the item’s input.
An optional list of intermediary steps involved in the output. This can include any processing steps or intermediate results. They are automatically generated when using “steps” to build a dataset.
Create a dataset item
dataset_item = await sdk.api.create_dataset_item(
dataset_id="dataset_id",
input={ "content": "What is Literal?" },
expected_output={ "content": "Literal is an observability solution." }
)
# Or directly through a Dataset
dataset_item = await dataset.create_dataset_item(
dataset_id="dataset_id",
input={ "content": "What is Literal?" },
expected_output={ "content": "Literal is an observability solution." }
)
Params
The identifier of the dataset to which this item belongs.
The input data for this dataset item. Typically contains the parameters or information that forms the LLM request.
The optional output data for this dataset item. Represents the result or outcome associated with the item’s input.
A dictionary containing additional data associated with this dataset item. This can include specific details relevant to the item.
Response
Add a step to a dataset
dataset_item = await sdk.api.add_step_to_dataset(dataset_id="dataset_id", step_id="step_id")
# Or directly through a Dataset
dataset_item = await dataset.add_step_to_dataset(dataset_id="dataset_id", step_id="step_id")
Params
The identifier of the dataset to which this item belongs.
The identifier of the step created beforehand.
A dictionary containing additional data associated with this dataset item. This can include specific details relevant to the item.
Response
Get a dataset item
dataset_item = await sdk.api.get_dataset_item(id="dataset_item_id")
Params
The unique identifier of the dataset item. Each item within a dataset has its own unique ID.
Response
Delete a dataset item
await sdk.api.delete_dataset_item(id="dataset_item_id")
# Or directly through a Dataset
await dataset.delete_dataset_item(id="dataset_item_id")
Params
The unique identifier of the dataset item. Each item within a dataset has its own unique ID.
Response