Skip to content

create_prompt

Operation

create_prompt

create_prompt(request: CreatePromptInput | CreatePromptInputDict | None = None, /, *, plugins: list[Plugin] | None = None, **kwargs: Unpack[CreatePromptInputDict]) -> CreatePromptOutput

Creates a prompt in your prompt library that you can add to a flow. For more information, see Prompt management in Amazon Bedrock, Create a prompt using Prompt management and Prompt flows in Amazon Bedrock in the Amazon Bedrock User Guide.

Parameters:

Name Type Description Default
request CreatePromptInput | CreatePromptInputDict | 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[CreatePromptInputDict]

The input fields as keyword arguments.

{}

Returns:

Type Description
CreatePromptOutput

An instance of CreatePromptOutput.

create_prompt async

create_prompt(request: CreatePromptInput | CreatePromptInputDict | None = None, /, *, plugins: list[Plugin] | None = None, **kwargs: Unpack[CreatePromptInputDict]) -> CreatePromptOutput

Creates a prompt in your prompt library that you can add to a flow. For more information, see Prompt management in Amazon Bedrock, Create a prompt using Prompt management and Prompt flows in Amazon Bedrock in the Amazon Bedrock User Guide.

Parameters:

Name Type Description Default
request CreatePromptInput | CreatePromptInputDict | 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[CreatePromptInputDict]

The input fields as keyword arguments.

{}

Returns:

Type Description
CreatePromptOutput

An instance of CreatePromptOutput.

Input

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

CreatePromptInputDict

Bases: TypedDict

Dictionary form of CreatePromptInput.

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 this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error. For more information, see Ensuring idempotency.

This field is autopopulated if not provided.

customer_encryption_key_arn instance-attribute
customer_encryption_key_arn: str | None

The Amazon Resource Name (ARN) of the KMS key to encrypt the prompt.

default_variant instance-attribute
default_variant: str | None

The name of the default variant for the prompt. This value must match the name field in the relevant PromptVariant object.

description instance-attribute
description: str | None

A description for the prompt.

name instance-attribute
name: Required[str]

A name for the prompt.

tags instance-attribute
tags: Mapping[str, str] | None

Any tags that you want to attach to the prompt. For more information, see Tagging resources in Amazon Bedrock.

variants instance-attribute

A list of objects, each containing details about a variant of the prompt.

CreatePromptInput dataclass

Bases: _SerdeShape

Dataclass for CreatePromptInput 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 this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error. For more information, see Ensuring idempotency.

This field is autopopulated if not provided.

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

The Amazon Resource Name (ARN) of the KMS key to encrypt the prompt.

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

The name of the default variant for the prompt. This value must match the name field in the relevant PromptVariant object.

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

A description for the prompt.

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

A name for the prompt.

tags class-attribute instance-attribute
tags: dict[str, str] | None = ...

Any tags that you want to attach to the prompt. For more information, see Tagging resources in Amazon Bedrock.

variants class-attribute instance-attribute
variants: list[PromptVariant] | None = ...

A list of objects, each containing details about a variant of the prompt.

Output

CreatePromptOutput dataclass

Bases: _SerdeShape

Dataclass for CreatePromptOutput structure.

Attributes

arn instance-attribute
arn: str

The Amazon Resource Name (ARN) of the prompt.

created_at instance-attribute
created_at: datetime

The time at which the prompt was created.

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

The Amazon Resource Name (ARN) of the KMS key that you encrypted the prompt with.

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

The name of the default variant for your prompt.

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

The description of the prompt.

id instance-attribute
id: str

The unique identifier of the prompt.

name instance-attribute
name: str

The name of the prompt.

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.

updated_at instance-attribute
updated_at: datetime

The time at which the prompt was last updated.

variants class-attribute instance-attribute
variants: list[PromptVariant] | None = ...

A list of objects, each containing details about a variant of the prompt.

version instance-attribute
version: str

The version of the prompt. When you create a prompt, the version created is the DRAFT version.