Bedrock / Client / create_advanced_prompt_optimization_job
create_advanced_prompt_optimization_job¶
- Bedrock.Client.create_advanced_prompt_optimization_job(**kwargs)¶
Creates an advanced prompt optimization job. The job optimizes your prompt templates for specific models using your evaluation dataset and criteria.
See also: AWS API Documentation
Request Syntax
response = client.create_advanced_prompt_optimization_job( jobName='string', jobDescription='string', clientToken='string', inputConfig={ 's3Uri': 'string' }, outputConfig={ 's3Uri': 'string' }, encryptionKeyArn='string', tags=[ { 'key': 'string', 'value': 'string' }, ], modelConfigurations=[ { 'modelId': 'string', 'inferenceConfig': { 'maxTokens': 123, 'temperature': ..., 'topP': ..., 'stopSequences': [ 'string', ] }, 'additionalModelRequestFields': { 'string': {...}|[...]|123|123.4|'string'|True|None } }, ] )
- Parameters:
jobName (string) –
[REQUIRED]
A name for the advanced prompt optimization job.
jobDescription (string) – A description of the advanced prompt optimization job.
clientToken (string) –
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.
This field is autopopulated if not provided.
inputConfig (dict) –
[REQUIRED]
Specifies the S3 location of your JSONL input file containing prompt templates and evaluation samples.
s3Uri (string) – [REQUIRED]
The S3 URI of the JSONL input file containing prompt templates and evaluation samples.
outputConfig (dict) –
[REQUIRED]
Specifies the S3 location where optimization results will be stored.
s3Uri (string) – [REQUIRED]
The S3 URI prefix where the optimization results will be written.
encryptionKeyArn (string) – The Amazon Resource Name (ARN) of the KMS key used for encrypting the output data. If not specified, the output is encrypted with an Amazon-owned KMS key.
tags (list) –
Tags to associate with the advanced prompt optimization job.
(dict) –
Definition of the key/value pair for a tag.
key (string) – [REQUIRED]
Key for the tag.
value (string) – [REQUIRED]
Value for the tag.
modelConfigurations (list) –
[REQUIRED]
A list of model configurations specifying the target models for prompt optimization. You can specify up to 5 models.
(dict) –
Contains the configuration for a model used in an advanced prompt optimization job, including the model ID and inference parameters.
modelId (string) – [REQUIRED]
The ID of the model to use for optimization.
inferenceConfig (dict) –
The inference configuration for the model, including parameters such as maximum tokens, temperature, and top-p.
maxTokens (integer) –
The maximum number of tokens to allow in the generated response. The default value is the maximum allowed value for the model that you are using.
temperature (float) –
The likelihood of the model selecting higher-probability options while generating a response. A lower value makes the model more likely to choose higher-probability options, while a higher value makes the model more likely to choose lower-probability options.
topP (float) –
The percentage of most-likely candidates that the model considers for the next token. For example, if you choose a value of 0.8 for
topP, the model selects from the top 80% of the probability distribution of tokens that could be next in the sequence.stopSequences (list) –
A list of stop sequences. A stop sequence is a sequence of characters that causes the model to stop generating the response.
(string) –
additionalModelRequestFields (dict) –
Additional model request fields. Use this to pass model-specific parameters that are not included in the standard inference configuration.
(string) –
(document) –
- Return type:
dict
- Returns:
Response Syntax
{ 'jobArn': 'string' }
Response Structure
(dict) –
Create Advanced Prompt Optimization Job Response
jobArn (string) –
The Amazon Resource Name (ARN) of the created advanced prompt optimization job.
Exceptions
Bedrock.Client.exceptions.ResourceNotFoundExceptionBedrock.Client.exceptions.AccessDeniedExceptionBedrock.Client.exceptions.ValidationExceptionBedrock.Client.exceptions.ConflictExceptionBedrock.Client.exceptions.InternalServerExceptionBedrock.Client.exceptions.TooManyTagsExceptionBedrock.Client.exceptions.ServiceQuotaExceededExceptionBedrock.Client.exceptions.ThrottlingException