Skip to content

add_dataset_examples

Operation

add_dataset_examples

add_dataset_examples(request: AddDatasetExamplesInput | AddDatasetExamplesInputDict | None = None, /, *, plugins: list[Plugin] | None = None, **kwargs: Unpack[AddDatasetExamplesInputDict]) -> AddDatasetExamplesOutput

Adds examples to the dataset's DRAFT. All examples are validated against the dataset's schema type before any writes occur. If any example fails validation, the entire batch is rejected (all-or-nothing semantics).

Parameters:

Name Type Description Default
request AddDatasetExamplesInput | AddDatasetExamplesInputDict | None

The input as a model or dictionary. Pass this or keyword arguments, not both.

None
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None
**kwargs Unpack[AddDatasetExamplesInputDict]

The input fields as keyword arguments.

{}

Returns:

Type Description
AddDatasetExamplesOutput

An instance of AddDatasetExamplesOutput.

add_dataset_examples async

add_dataset_examples(request: AddDatasetExamplesInput | AddDatasetExamplesInputDict | None = None, /, *, plugins: list[Plugin] | None = None, **kwargs: Unpack[AddDatasetExamplesInputDict]) -> AddDatasetExamplesOutput

Adds examples to the dataset's DRAFT. All examples are validated against the dataset's schema type before any writes occur. If any example fails validation, the entire batch is rejected (all-or-nothing semantics).

Parameters:

Name Type Description Default
request AddDatasetExamplesInput | AddDatasetExamplesInputDict | None

The input as a model or dictionary. Pass this or keyword arguments, not both.

None
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None
**kwargs Unpack[AddDatasetExamplesInputDict]

The input fields as keyword arguments.

{}

Returns:

Type Description
AddDatasetExamplesOutput

An instance of AddDatasetExamplesOutput.

Input

Pass the input as keyword arguments, a positional dictionary, or a positional model object. Pass plugins separately as a keyword argument.

AddDatasetExamplesInputDict

Bases: TypedDict

Dictionary form of AddDatasetExamplesInput.

Attributes

client_token instance-attribute
client_token: str | None

A unique, case-sensitive identifier to ensure that the API request completes no more than one time. If you don't specify this field, a value is randomly generated for you. If this token matches a previous request, the service ignores the request, but doesn't return an error. For more information, see Ensuring idempotency.

This field is autopopulated if not provided.

dataset_id instance-attribute
dataset_id: Required[str]

The unique identifier of the dataset to add examples to.

source instance-attribute

Source of examples to add. Provide either inline examples or an S3 URI pointing to a JSONL file.

AddDatasetExamplesInput dataclass

Bases: _SerdeShape

Dataclass for AddDatasetExamplesInput structure.

Attributes

client_token class-attribute instance-attribute
client_token: str | None = ...

A unique, case-sensitive identifier to ensure that the API request completes no more than one time. If you don't specify this field, a value is randomly generated for you. If this token matches a previous request, the service ignores the request, but doesn't return an error. For more information, see Ensuring idempotency.

This field is autopopulated if not provided.

dataset_id class-attribute instance-attribute
dataset_id: str | None = ...

The unique identifier of the dataset to add examples to.

source class-attribute instance-attribute
source: DataSourceType | None = ...

Source of examples to add. Provide either inline examples or an S3 URI pointing to a JSONL file.

Output

AddDatasetExamplesOutput dataclass

Bases: _SerdeShape

Dataclass for AddDatasetExamplesOutput structure.

Attributes

added_count instance-attribute
added_count: int

The number of examples added.

dataset_arn instance-attribute
dataset_arn: str

The Amazon Resource Name (ARN) of the dataset.

dataset_id instance-attribute
dataset_id: str

The unique identifier of the dataset.

example_ids instance-attribute
example_ids: list[str]

IDs of all added examples (auto-generated UUIDs).

response_metadata class-attribute instance-attribute
response_metadata: ResponseMetadata = ...

Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.

status instance-attribute
status: str

The current status of the dataset.

updated_at instance-attribute
updated_at: datetime

The timestamp when the examples were added.