Create a dataset example in the LangSmith API.
Examples are rows in a dataset, containing the inputs and expected outputs (or other reference information) for a model or chain.
create_example(
self,
inputs: Optional[Mapping[str, Any]] = None,
dataset_id: Optional[ID_TYPE] = None,
dataset_name: Optional[str] = None,
created_at: Optional[datetime.datetime] = None,
outputs: Optional[Mapping[str, Any]] = None,
metadata: Optional[Mapping[str, Any]] = None,
split: Optional[str | list[str]] = None,
example_id: Optional[ID_TYPE] = None,
source_run_id: Optional[ID_TYPE] = None,
use_source_run_io: bool = False,
use_source_run_attachments: Optional[list[str]] = None,
attachments: Optional[ls_schemas.Attachments] = None
) -> ls_schemas.Example| Name | Type | Description |
|---|---|---|
inputs | Mapping[str, Any] | Default: NoneThe input values for the example. |
dataset_id | Optional[Union[UUID, str]] | Default: NoneThe ID of the dataset to create the example in. |
dataset_name | Optional[str] | Default: NoneThe name of the dataset to create the example in. |
created_at | Optional[datetime.datetime] | Default: NoneThe creation timestamp of the example. |
outputs | Optional[Mapping[str, Any]] | Default: NoneThe output values for the example. |
metadata | Optional[Mapping[str, Any]] | Default: NoneThe metadata for the example. |
split | Optional[str | List[str]] | Default: NoneThe splits for the example, which are divisions of your dataset such as 'train', 'test', or 'validation'. |
example_id | Optional[Union[UUID, str]] | Default: NoneThe ID of the example to create. If not provided, a new example will be created. |
source_run_id | Optional[Union[UUID, str]] | Default: NoneThe ID of the source run associated with this example. |
use_source_run_io | bool | Default: FalseWhether to use the inputs, outputs, and attachments from the source run. |
use_source_run_attachments | Optional[List[str]] | Default: NoneWhich attachments to use from the source run. If use_source_run_io is True, all attachments will be used regardless of this param. |
attachments | Optional[Attachments] | Default: NoneThe attachments for the example. |