| Name | Type | Description |
|---|---|---|
dataset_name | str | None | Default: NoneThe name of the dataset to update. Should specify exactly one of 'dataset_name' or 'dataset_id'. |
dataset_id | UUID | str | None | Default: NoneThe ID of the dataset to update. Should specify exactly one of 'dataset_name' or 'dataset_id'. |
updates | Sequence[ExampleUpdate | dict] | None | Default: None |
dangerously_allow_filesystem | bool | Default: False |
**kwargs | Any | Default: {} |
Update multiple examples.
Examples are expected to all be part of the same dataset.
Updated to ...
Example:
from langsmith import Client
client = Client()
dataset = client.create_dataset("agent-qa")
examples = [
{
"inputs": {"question": "what's an agent"},
"outputs": {"answer": "an agent is..."},
"metadata": {"difficulty": "easy"},
},
{
"inputs": {
"question": "can you explain the agent architecture in this diagram?"
},
"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 = response["example_ids"]
updates = [
{
"id": example_ids[0],
"inputs": {"question": "what isn't an agent"},
"outputs": {"answer": "an agent is not..."},
},
{
"id": example_ids[1],
"attachments_operations": [
{"rename": {"diagram": "agent_diagram"}, "retain": []}
],
},
]
response = client.update_examples(dataset_name="agent-qa", updates=updates)
# -> {"example_ids": [...The example updates. Overwrites any specified fields and does not update any unspecified fields.
Whether to allow using filesystem paths as attachments.
Legacy keyword args. Should not be specified if 'updates' is specified.