| Name | Type | Description |
|---|---|---|
dataset_name | str | None | Default: NoneThe name of the dataset to create the examples in. Must specify exactly one of dataset_name or dataset_id. |
dataset_id | UUID | str | None | Default: NoneThe ID of the dataset to create the examples in. Must specify exactly one of dataset_name or dataset_id |
examples | Sequence[ExampleCreate | dict] | Default: None |
dangerously_allow_filesystem | bool | Default: False |
**kwargs | Any | Default: {} |
Create examples in a dataset.
Updated to take argument 'examples', a single list where each element is the full example to create. This should be used instead of the legacy 'inputs', 'reference_outputs', etc. arguments which split each example's attributes across arguments.
Updated to support creating examples with attachments.
Example:
from langsmith import Client
client = Client()
dataset = client.create_dataset("agent-qa")
examples = [
{
"inputs": {"question": "what's an agent"},
"reference_outputs": {"answer": "an agent is..."},
"metadata": {"difficulty": "easy"},
},
{
"inputs": {"question": "can you explain the agent architecture in this diagram?"},
"reference_outputs": {"answer": "this diagram shows..."},
"attachments": {"diagram": {"mime_type": "image/png", "data": b"..."}},
"metadata": {"difficulty": "medium"},
},
# more examples...
]
response = client.create_examples(dataset_name="agent-qa", examples=examples)
# -> {"example_ids": [...The examples to create.
Whether to allow uploading files from the filesystem.
Legacy keyword args. Should not be specified if 'examples' is specified.