BedrockAgentCoreControl / Client / add_dataset_examples

add_dataset_examples

BedrockAgentCoreControl.Client.add_dataset_examples(**kwargs)

Adds examples to the dataset’s DRAFT.

Validation: All examples are validated against the dataset’s schemaType before any writes occur. If any example fails validation, the entire batch is rejected with ValidationException — no examples are written (all-or-nothing semantics).

Asynchronous: Operates in-place on DRAFT. No version bump occurs. Use CreateDatasetVersion to publish DRAFT as a new numbered version.

State guard: Returns ConflictException (DATASET_NOT_READY) if the dataset status is not in {DRAFT, ACTIVE}.

Request size limit: Max 5 MB total request body. Max 1000 examples per call.

See also: AWS API Documentation

Request Syntax

response = client.add_dataset_examples(
    datasetId='string',
    clientToken='string',
    source={
        'inlineExamples': {
            'examples': [
                {...}|[...]|123|123.4|'string'|True|None,
            ]
        },
        's3Source': {
            's3Uri': 'string'
        }
    }
)
Parameters:
  • datasetId (string) –

    [REQUIRED]

    The unique identifier of the dataset to add examples to.

  • clientToken (string) –

    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.

  • source (dict) –

    [REQUIRED]

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

    Note

    This is a Tagged Union structure. Only one of the following top level keys can be set: inlineExamples, s3Source.

    • inlineExamples (dict) –

      Inline examples provided directly in the request body.

      • examples (list) – [REQUIRED]

        Examples to add. Each example is assigned an auto-generated UUID.

        • (document) –

    • s3Source (dict) –

      S3 URI pointing to a JSONL file in the customer’s bucket. The service reads this file using the caller’s FAS credentials.

      • s3Uri (string) – [REQUIRED]

        S3 URI of the JSONL file (e.g. s3://my-bucket/path/to/examples.jsonl).

Return type:

dict

Returns:

Response Syntax

{
    'datasetArn': 'string',
    'datasetId': 'string',
    'status': 'CREATING'|'UPDATING'|'DELETING'|'ACTIVE'|'CREATE_FAILED'|'UPDATE_FAILED'|'DELETE_FAILED',
    'addedCount': 123,
    'updatedAt': datetime(2015, 1, 1),
    'exampleIds': [
        'string',
    ]
}

Response Structure

  • (dict) –

    • datasetArn (string) –

      The Amazon Resource Name (ARN) of the dataset.

    • datasetId (string) –

      The unique identifier of the dataset.

    • status (string) –

      The current status of the dataset.

    • addedCount (integer) –

      The number of examples added.

    • updatedAt (datetime) –

      The timestamp when the examples were added.

    • exampleIds (list) –

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

      • (string) –

Exceptions

  • BedrockAgentCoreControl.Client.exceptions.ServiceQuotaExceededException

  • BedrockAgentCoreControl.Client.exceptions.ValidationException

  • BedrockAgentCoreControl.Client.exceptions.ConflictException

  • BedrockAgentCoreControl.Client.exceptions.AccessDeniedException

  • BedrockAgentCoreControl.Client.exceptions.ResourceNotFoundException

  • BedrockAgentCoreControl.Client.exceptions.ThrottlingException

  • BedrockAgentCoreControl.Client.exceptions.InternalServerException