optimize_prompt¶
Operation¶
optimize_prompt
async
¶
optimize_prompt(input: OptimizePromptInput, plugins: list[Plugin] | None = None) -> OutputEventStream[OptimizedPromptStream, OptimizePromptOutput]
Optimizes a prompt for the task that you specify. For more information, see Optimize a prompt in the Amazon Bedrock User Guide.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input
|
OptimizePromptInput
|
An instance of |
required |
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
|
Returns:
| Type | Description |
|---|---|
OutputEventStream[OptimizedPromptStream, OptimizePromptOutput]
|
An |
Input¶
OptimizePromptInput
dataclass
¶
Dataclass for OptimizePromptInput structure.
Attributes¶
input
class-attribute
instance-attribute
¶
input: InputPrompt | None = None
Contains the prompt to optimize.
target_model_id
class-attribute
instance-attribute
¶
target_model_id: str | None = None
The unique identifier of the model that you want to optimize the prompt for.
Output¶
This operation returns an OutputEventStream for server-to-client streaming.
Event Stream Structure¶
Output Event Type¶
Initial Response Structure¶
OptimizePromptOutput
dataclass
¶
Dataclass for OptimizePromptOutput structure.