diff --git a/clients/client-bedrock-agent-runtime/src/commands/InvokeAgentCommand.ts b/clients/client-bedrock-agent-runtime/src/commands/InvokeAgentCommand.ts index 0ab98eb2be43..b1906e3c80de 100644 --- a/clients/client-bedrock-agent-runtime/src/commands/InvokeAgentCommand.ts +++ b/clients/client-bedrock-agent-runtime/src/commands/InvokeAgentCommand.ts @@ -36,10 +36,10 @@ export interface InvokeAgentCommandInput extends InvokeAgentRequest {} export interface InvokeAgentCommandOutput extends InvokeAgentResponse, __MetadataBearer {} /** - *

Sends a prompt for the agent to process and respond to. Use return control event type for function calling.

- * + * *

The CLI doesn't support InvokeAgent.

*
+ *

Sends a prompt for the agent to process and respond to. Note the following fields for the request:

* *

The response is returned in the bytes field of the chunk object.

@@ -66,6 +63,9 @@ export interface InvokeAgentCommandOutput extends InvokeAgentResponse, __Metadat *

If you set enableTrace to true in the request, you can trace the agent's steps and reasoning process that led it to the response.

* *
  • + *

    If the action predicted was configured to return control, the response returns parameters for the action, elicited from the user, in the returnControl field.

    + *
  • + *
  • *

    Errors are also surfaced in the response.

    *
  • * diff --git a/clients/client-bedrock-agent-runtime/src/commands/RetrieveAndGenerateCommand.ts b/clients/client-bedrock-agent-runtime/src/commands/RetrieveAndGenerateCommand.ts index 025d79ff0a42..7bfb69c9dbbc 100644 --- a/clients/client-bedrock-agent-runtime/src/commands/RetrieveAndGenerateCommand.ts +++ b/clients/client-bedrock-agent-runtime/src/commands/RetrieveAndGenerateCommand.ts @@ -111,6 +111,23 @@ export interface RetrieveAndGenerateCommandOutput extends RetrieveAndGenerateRes * promptTemplate: { // PromptTemplate * textPromptTemplate: "STRING_VALUE", * }, + * guardrailConfiguration: { // GuardrailConfiguration + * guardrailId: "STRING_VALUE", // required + * guardrailVersion: "STRING_VALUE", // required + * }, + * inferenceConfig: { // InferenceConfig + * textInferenceConfig: { // TextInferenceConfig + * temperature: Number("float"), + * topP: Number("float"), + * maxTokens: Number("int"), + * stopSequences: [ // RAGStopSequences + * "STRING_VALUE", + * ], + * }, + * }, + * additionalModelRequestFields: { // AdditionalModelRequestFields + * "": "DOCUMENT_VALUE", + * }, * }, * }, * externalSourcesConfiguration: { // ExternalSourcesRetrieveAndGenerateConfiguration @@ -132,6 +149,23 @@ export interface RetrieveAndGenerateCommandOutput extends RetrieveAndGenerateRes * promptTemplate: { * textPromptTemplate: "STRING_VALUE", * }, + * guardrailConfiguration: { + * guardrailId: "STRING_VALUE", // required + * guardrailVersion: "STRING_VALUE", // required + * }, + * inferenceConfig: { + * textInferenceConfig: { + * temperature: Number("float"), + * topP: Number("float"), + * maxTokens: Number("int"), + * stopSequences: [ + * "STRING_VALUE", + * ], + * }, + * }, + * additionalModelRequestFields: { + * "": "DOCUMENT_VALUE", + * }, * }, * }, * }, @@ -175,6 +209,7 @@ export interface RetrieveAndGenerateCommandOutput extends RetrieveAndGenerateRes * // ], * // }, * // ], + * // guardrailAction: "INTERVENED" || "NONE", * // }; * * ``` diff --git a/clients/client-bedrock-agent-runtime/src/models/models_0.ts b/clients/client-bedrock-agent-runtime/src/models/models_0.ts index bd03434586e5..6fa66132afcb 100644 --- a/clients/client-bedrock-agent-runtime/src/models/models_0.ts +++ b/clients/client-bedrock-agent-runtime/src/models/models_0.ts @@ -214,7 +214,7 @@ export class InternalServerException extends __BaseException { *

    This data type is used in the following API operations:

    * @@ -247,7 +247,7 @@ export type ResponseState = (typeof ResponseState)[keyof typeof ResponseState]; *

    This data type is used in the following API operations:

    * @@ -273,7 +273,7 @@ export interface ApiResult { apiPath?: string; /** - *

    The response body from the API operation. The key of the object is the content type. The response may be returned directly or from the Lambda function.

    + *

    The response body from the API operation. The key of the object is the content type (currently, only TEXT is supported). The response may be returned directly or from the Lambda function.

    * @public */ responseBody?: Record; @@ -296,7 +296,7 @@ export interface ApiResult { *

    This data type is used in the following API operations:

    * @@ -316,7 +316,7 @@ export interface FunctionResult { function?: string; /** - *

    The response from the function call using the parameters. The response may be returned directly or from the Lambda function.

    + *

    The response from the function call using the parameters. The key of the object is the content type (currently, only TEXT is supported). The response may be returned directly or from the Lambda function.

    * @public */ responseBody?: Record; @@ -329,12 +329,12 @@ export interface FunctionResult { } /** - *

    A result from the action group invocation.

    + *

    A result from the invocation of an action. For more information, see Return control to the agent developer and Control session context.

    *

    This data type is used in the following API operations:

    * @@ -409,13 +409,16 @@ export interface SessionState { promptSessionAttributes?: Record; /** - *

    Contains information about the results from the action group invocation.

    + *

    Contains information about the results from the action group invocation. For more information, see Return control to the agent developer and Control session context.

    + * + *

    If you include this field, the inputText field will be ignored.

    + *
    * @public */ returnControlInvocationResults?: InvocationResultMember[]; /** - *

    The identifier of the invocation.

    + *

    The identifier of the invocation of an action. This value must match the invocationId returned in the InvokeAgent response for the action whose results are provided in the returnControlInvocationResults field. For more information, see Return control to the agent developer and Control session context.

    * @public */ invocationId?: string; @@ -427,6 +430,9 @@ export interface SessionState { export interface InvokeAgentRequest { /** *

    Contains parameters that specify various attributes of the session. For more information, see Control session context.

    + * + *

    If you include returnControlInvocationResults in the sessionState field, the inputText field will be ignored.

    + *
    * @public */ sessionState?: SessionState; @@ -463,6 +469,9 @@ export interface InvokeAgentRequest { /** *

    The prompt text to send the agent.

    + * + *

    If you include returnControlInvocationResults in the sessionState field, the inputText field will be ignored.

    + *
    * @public */ inputText?: string; @@ -478,7 +487,7 @@ export interface InvokeAgentRequest { * *
  • *

    - * Retrieve response – in the span field

    + * InvokeAgent response – in the span field

    *
  • * * @public @@ -507,7 +516,7 @@ export interface Span { * *
  • *

    - * Retrieve response – in the textResponsePart field

    + * InvokeAgent response – in the textResponsePart field

    *
  • * * @public @@ -532,7 +541,7 @@ export interface TextResponsePart { * * @public @@ -590,7 +599,7 @@ export interface RetrievalResultContent { * *
  • *

    - * Retrieve response – in the s3Location field

    + * InvokeAgent response – in the s3Location field

    *
  • * * @public @@ -631,7 +640,7 @@ export type RetrievalResultLocationType = * *
  • *

    - * Retrieve response – in the locatino field

    + * InvokeAgent response – in the locatino field

    *
  • * * @public @@ -660,7 +669,7 @@ export interface RetrievalResultLocation { * *
  • *

    - * Retrieve response – in the retrievedReferences field

    + * InvokeAgent response – in the retrievedReferences field

    *
  • * * @public @@ -691,7 +700,7 @@ export interface RetrievedReference { *
      *
    • *

      - * Retrieve response – in the citations field

      + * InvokeAgent response – in the citations field

      *
    • *
    • *

      @@ -770,7 +779,7 @@ export class ResourceNotFoundException extends __BaseException { *

      @@ -814,7 +823,7 @@ export interface PropertyParameters { * @@ -833,7 +842,7 @@ export interface ApiRequestBody { *

      This data type is used in the following API operations:

      * @@ -876,7 +885,7 @@ export interface ApiInvocationInput { *

      This data type is used in the following API operations:

      * @@ -907,7 +916,7 @@ export interface FunctionParameter { *

      This data type is used in the following API operations:

      * @@ -934,11 +943,11 @@ export interface FunctionInvocationInput { } /** - *

      Contains details about the API operation or function that the agent predicts should be called.

      + *

      Contains details about the API operation or function that the agent predicts should be called.

      *

      This data type is used in the following API operations:

      * @@ -1002,7 +1011,7 @@ export namespace InvocationInputMember { * @@ -2232,6 +2241,79 @@ export interface RetrieveAndGenerateInput { text: string | undefined; } +/** + *

      The configuration details for the guardrail.

      + * @public + */ +export interface GuardrailConfiguration { + /** + *

      The unique identifier for the guardrail.

      + * @public + */ + guardrailId: string | undefined; + + /** + *

      The version of the guardrail.

      + * @public + */ + guardrailVersion: string | undefined; +} + +/** + *

      Configuration settings for text generation using a language model via the + * RetrieveAndGenerate operation. Includes parameters like temperature, top-p, maximum token + * count, and stop sequences.

      + * + *

      The valid range of maxTokens depends on the accepted values for your chosen + * model's inference parameters. To see the inference parameters for your model, see Inference + * parameters for foundation models. + *

      + *
      + * @public + */ +export interface TextInferenceConfig { + /** + *

      Controls the random-ness of text generated by the language model, influencing how much the model sticks to the most predictable next words versus exploring more surprising options. A lower temperature value (e.g. 0.2 or 0.3) makes model outputs more deterministic or predictable, while a higher temperature (e.g. 0.8 or 0.9) makes the outputs more creative or unpredictable.

      + * @public + */ + temperature?: number; + + /** + *

      A probability distribution threshold which controls what the model considers for the set of possible next tokens. The model will only consider the top p% of the probability distribution when generating the next token.

      + * @public + */ + topP?: number; + + /** + *

      The maximum number of tokens to generate in the output text. Do not use the minimum of 0 + * or the maximum of 65536. The limit values described here are arbitary values, for actual + * values consult the limits defined by your specific model.

      + * @public + */ + maxTokens?: number; + + /** + *

      A list of sequences of characters that, if generated, will cause the model to stop + * generating further tokens. Do not use a minimum length of 1 or a maximum length of 1000. The + * limit values described here are arbitary values, for actual values consult the limits defined + * by your specific model.

      + * @public + */ + stopSequences?: string[]; +} + +/** + *

      The configuration for inference settings when generating responses using RetrieveAndGenerate.

      + * @public + */ +export interface InferenceConfig { + /** + *

      Configuration settings specific to text generation while generating responses using RetrieveAndGenerate.

      + * @public + */ + textInferenceConfig?: TextInferenceConfig; +} + /** *

      Contains the template for the prompt that's sent to the model for response generation. For more information, see Knowledge base prompt templates.

      *

      This data type is used in the following API operations:

      @@ -2274,6 +2356,24 @@ export interface ExternalSourcesGenerationConfiguration { * @public */ promptTemplate?: PromptTemplate; + + /** + *

      The configuration details for the guardrail.

      + * @public + */ + guardrailConfiguration?: GuardrailConfiguration; + + /** + *

      Configuration settings for inference when using RetrieveAndGenerate to generate responses while using an external source.

      + * @public + */ + inferenceConfig?: InferenceConfig; + + /** + *

      Additional model parameters and their corresponding values not included in the textInferenceConfig structure for an external source. Takes in custom model parameters specific to the language model being used.

      + * @public + */ + additionalModelRequestFields?: Record; } /** @@ -2392,6 +2492,24 @@ export interface GenerationConfiguration { * @public */ promptTemplate?: PromptTemplate; + + /** + *

      The configuration details for the guardrail.

      + * @public + */ + guardrailConfiguration?: GuardrailConfiguration; + + /** + *

      Configuration settings for inference when using RetrieveAndGenerate to generate responses while using a knowledge base as a source.

      + * @public + */ + inferenceConfig?: InferenceConfig; + + /** + *

      Additional model parameters and corresponding values not included in the textInferenceConfig structure for a knowledge base. This allows users to provide custom model parameters specific to the language model being used.

      + * @public + */ + additionalModelRequestFields?: Record; } /** @@ -2467,6 +2585,20 @@ export interface RetrieveAndGenerateSessionConfiguration { kmsKeyArn: string | undefined; } +/** + * @public + * @enum + */ +export const GuadrailAction = { + INTERVENED: "INTERVENED", + NONE: "NONE", +} as const; + +/** + * @public + */ +export type GuadrailAction = (typeof GuadrailAction)[keyof typeof GuadrailAction]; + /** *

      Contains the response generated from querying the knowledge base.

      *

      This data type is used in the following API operations:

      @@ -2507,6 +2639,12 @@ export interface RetrieveAndGenerateResponse { * @public */ citations?: Citation[]; + + /** + *

      Specifies if there is a guardrail intervention in the response.

      + * @public + */ + guardrailAction?: GuadrailAction; } /** diff --git a/clients/client-bedrock-agent-runtime/src/protocols/Aws_restJson1.ts b/clients/client-bedrock-agent-runtime/src/protocols/Aws_restJson1.ts index fcd68151ecbc..d29305fee964 100644 --- a/clients/client-bedrock-agent-runtime/src/protocols/Aws_restJson1.ts +++ b/clients/client-bedrock-agent-runtime/src/protocols/Aws_restJson1.ts @@ -19,6 +19,7 @@ import { limitedParseFloat32 as __limitedParseFloat32, map, resolvedPath as __resolvedPath, + serializeFloat as __serializeFloat, take, withBaseException, } from "@smithy/smithy-client"; @@ -53,6 +54,8 @@ import { FilterAttribute, FunctionResult, GenerationConfiguration, + GuardrailConfiguration, + InferenceConfig, InferenceConfiguration, InternalServerException, InvocationResultMember, @@ -80,6 +83,7 @@ import { S3ObjectDoc, ServiceQuotaExceededException, SessionState, + TextInferenceConfig, ThrottlingException, Trace, TracePart, @@ -222,6 +226,7 @@ export const de_RetrieveAndGenerateCommand = async ( const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); const doc = take(data, { citations: (_) => de_Citations(_, context), + guardrailAction: __expectString, output: _json, sessionId: __expectString, }); @@ -620,6 +625,26 @@ const de_ValidationException_event = async (output: any, context: __SerdeContext }; return de_ValidationExceptionRes(parsedOutput, context); }; +/** + * serializeAws_restJson1AdditionalModelRequestFields + */ +const se_AdditionalModelRequestFields = (input: Record, context: __SerdeContext): any => { + return Object.entries(input).reduce((acc: Record, [key, value]: [string, any]) => { + if (value === null) { + return acc; + } + acc[key] = se_AdditionalModelRequestFieldsValue(value, context); + return acc; + }, {}); +}; + +/** + * serializeAws_restJson1AdditionalModelRequestFieldsValue + */ +const se_AdditionalModelRequestFieldsValue = (input: __DocumentType, context: __SerdeContext): any => { + return input; +}; + // se_ApiResult omitted. /** @@ -657,7 +682,20 @@ const se_ExternalSources = (input: ExternalSource[], context: __SerdeContext): a }); }; -// se_ExternalSourcesGenerationConfiguration omitted. +/** + * serializeAws_restJson1ExternalSourcesGenerationConfiguration + */ +const se_ExternalSourcesGenerationConfiguration = ( + input: ExternalSourcesGenerationConfiguration, + context: __SerdeContext +): any => { + return take(input, { + additionalModelRequestFields: (_) => se_AdditionalModelRequestFields(_, context), + guardrailConfiguration: _json, + inferenceConfig: (_) => se_InferenceConfig(_, context), + promptTemplate: _json, + }); +}; /** * serializeAws_restJson1ExternalSourcesRetrieveAndGenerateConfiguration @@ -667,7 +705,7 @@ const se_ExternalSourcesRetrieveAndGenerateConfiguration = ( context: __SerdeContext ): any => { return take(input, { - generationConfiguration: _json, + generationConfiguration: (_) => se_ExternalSourcesGenerationConfiguration(_, context), modelArn: [], sources: (_) => se_ExternalSources(_, context), }); @@ -692,7 +730,28 @@ const se_FilterValue = (input: __DocumentType, context: __SerdeContext): any => // se_FunctionResult omitted. -// se_GenerationConfiguration omitted. +/** + * serializeAws_restJson1GenerationConfiguration + */ +const se_GenerationConfiguration = (input: GenerationConfiguration, context: __SerdeContext): any => { + return take(input, { + additionalModelRequestFields: (_) => se_AdditionalModelRequestFields(_, context), + guardrailConfiguration: _json, + inferenceConfig: (_) => se_InferenceConfig(_, context), + promptTemplate: _json, + }); +}; + +// se_GuardrailConfiguration omitted. + +/** + * serializeAws_restJson1InferenceConfig + */ +const se_InferenceConfig = (input: InferenceConfig, context: __SerdeContext): any => { + return take(input, { + textInferenceConfig: (_) => se_TextInferenceConfig(_, context), + }); +}; // se_InvocationResultMember omitted. @@ -718,7 +777,7 @@ const se_KnowledgeBaseRetrieveAndGenerateConfiguration = ( context: __SerdeContext ): any => { return take(input, { - generationConfiguration: _json, + generationConfiguration: (_) => se_GenerationConfiguration(_, context), knowledgeBaseId: [], modelArn: [], retrievalConfiguration: (_) => se_KnowledgeBaseRetrievalConfiguration(_, context), @@ -743,6 +802,8 @@ const se_KnowledgeBaseVectorSearchConfiguration = ( // se_PromptTemplate omitted. +// se_RAGStopSequences omitted. + // se_ResponseBody omitted. /** @@ -799,6 +860,18 @@ const se_RetrieveAndGenerateConfiguration = (input: RetrieveAndGenerateConfigura // se_SessionState omitted. +/** + * serializeAws_restJson1TextInferenceConfig + */ +const se_TextInferenceConfig = (input: TextInferenceConfig, context: __SerdeContext): any => { + return take(input, { + maxTokens: [], + stopSequences: _json, + temperature: __serializeFloat, + topP: __serializeFloat, + }); +}; + // de_ActionGroupInvocationInput omitted. // de_ActionGroupInvocationOutput omitted. diff --git a/codegen/sdk-codegen/aws-models/bedrock-agent-runtime.json b/codegen/sdk-codegen/aws-models/bedrock-agent-runtime.json index 1f15c3e0a2c1..07d3a1193f3a 100644 --- a/codegen/sdk-codegen/aws-models/bedrock-agent-runtime.json +++ b/codegen/sdk-codegen/aws-models/bedrock-agent-runtime.json @@ -84,6 +84,27 @@ "smithy.api#sensitive": {} } }, + "com.amazonaws.bedrockagentruntime#AdditionalModelRequestFields": { + "type": "map", + "key": { + "target": "com.amazonaws.bedrockagentruntime#AdditionalModelRequestFieldsKey" + }, + "value": { + "target": "com.amazonaws.bedrockagentruntime#AdditionalModelRequestFieldsValue" + } + }, + "com.amazonaws.bedrockagentruntime#AdditionalModelRequestFieldsKey": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 100 + } + } + }, + "com.amazonaws.bedrockagentruntime#AdditionalModelRequestFieldsValue": { + "type": "document" + }, "com.amazonaws.bedrockagentruntime#AgentAliasId": { "type": "string", "traits": { @@ -850,7 +871,7 @@ } }, "traits": { - "smithy.api#documentation": "

      Contains information about the API operation that the agent predicts should be called.

      \n

      This data type is used in the following API operations:

      \n " + "smithy.api#documentation": "

      Contains information about the API operation that the agent predicts should be called.

      \n

      This data type is used in the following API operations:

      \n " } }, "com.amazonaws.bedrockagentruntime#ApiParameter": { @@ -876,7 +897,7 @@ } }, "traits": { - "smithy.api#documentation": "

      Information about a parameter to provide to the API request.

      \n

      This data type is used in the following API operations:

      \n " + "smithy.api#documentation": "

      Information about a parameter to provide to the API request.

      \n

      This data type is used in the following API operations:

      \n " } }, "com.amazonaws.bedrockagentruntime#ApiParameters": { @@ -902,7 +923,7 @@ } }, "traits": { - "smithy.api#documentation": "

      The request body to provide for the API request, as the agent elicited from the user.

      \n

      This data type is used in the following API operations:

      \n " + "smithy.api#documentation": "

      The request body to provide for the API request, as the agent elicited from the user.

      \n

      This data type is used in the following API operations:

      \n " } }, "com.amazonaws.bedrockagentruntime#ApiResult": { @@ -930,7 +951,7 @@ "responseBody": { "target": "com.amazonaws.bedrockagentruntime#ResponseBody", "traits": { - "smithy.api#documentation": "

      The response body from the API operation. The key of the object is the content type. The response may be returned directly or from the Lambda function.

      " + "smithy.api#documentation": "

      The response body from the API operation. The key of the object is the content type (currently, only TEXT is supported). The response may be returned directly or from the Lambda function.

      " } }, "httpStatusCode": { @@ -947,7 +968,7 @@ } }, "traits": { - "smithy.api#documentation": "

      Contains information about the API operation that was called from the action group and the response body that was returned.

      \n

      This data type is used in the following API operations:

      \n " + "smithy.api#documentation": "

      Contains information about the API operation that was called from the action group and the response body that was returned.

      \n

      This data type is used in the following API operations:

      \n " } }, "com.amazonaws.bedrockagentruntime#Attribution": { @@ -1049,7 +1070,7 @@ } }, "traits": { - "smithy.api#documentation": "

      An object containing a segment of the generated response that is based on a source in the knowledge base, alongside information about the source.

      \n

      This data type is used in the following API operations:

      \n " + "smithy.api#documentation": "

      An object containing a segment of the generated response that is based on a source in the knowledge base, alongside information about the source.

      \n

      This data type is used in the following API operations:

      \n " } }, "com.amazonaws.bedrockagentruntime#Citations": { @@ -1082,7 +1103,7 @@ } }, "traits": { - "smithy.api#documentation": "

      Contains the body of the API response.

      \n

      This data type is used in the following API operations:

      \n
        \n
      • \n

        In the returnControlInvocationResults field of the Retrieve request\n

        \n
      • \n
      " + "smithy.api#documentation": "

      Contains the body of the API response.

      \n

      This data type is used in the following API operations:

      \n " } }, "com.amazonaws.bedrockagentruntime#ContentMap": { @@ -1200,6 +1221,24 @@ "traits": { "smithy.api#documentation": "

      Contain the textPromptTemplate string for the external source wrapper object.

      " } + }, + "guardrailConfiguration": { + "target": "com.amazonaws.bedrockagentruntime#GuardrailConfiguration", + "traits": { + "smithy.api#documentation": "

      The configuration details for the guardrail.

      " + } + }, + "inferenceConfig": { + "target": "com.amazonaws.bedrockagentruntime#InferenceConfig", + "traits": { + "smithy.api#documentation": "

      Configuration settings for inference when using RetrieveAndGenerate to generate responses while using an external source.

      " + } + }, + "additionalModelRequestFields": { + "target": "com.amazonaws.bedrockagentruntime#AdditionalModelRequestFields", + "traits": { + "smithy.api#documentation": "

      Additional model parameters and their corresponding values not included in the textInferenceConfig structure for an external source. Takes in custom model parameters specific to the language model being used.

      " + } } }, "traits": { @@ -1345,7 +1384,7 @@ } }, "traits": { - "smithy.api#documentation": "

      Contains information about the function that the agent predicts should be called.

      \n

      This data type is used in the following API operations:

      \n " + "smithy.api#documentation": "

      Contains information about the function that the agent predicts should be called.

      \n

      This data type is used in the following API operations:

      \n " } }, "com.amazonaws.bedrockagentruntime#FunctionParameter": { @@ -1371,7 +1410,7 @@ } }, "traits": { - "smithy.api#documentation": "

      Contains information about a parameter of the function.

      \n

      This data type is used in the following API operations:

      \n " + "smithy.api#documentation": "

      Contains information about a parameter of the function.

      \n

      This data type is used in the following API operations:

      \n " } }, "com.amazonaws.bedrockagentruntime#FunctionParameters": { @@ -1399,7 +1438,7 @@ "responseBody": { "target": "com.amazonaws.bedrockagentruntime#ResponseBody", "traits": { - "smithy.api#documentation": "

      The response from the function call using the parameters. The response may be returned directly or from the Lambda function.

      " + "smithy.api#documentation": "

      The response from the function call using the parameters. The key of the object is the content type (currently, only TEXT is supported). The response may be returned directly or from the Lambda function.

      " } }, "responseState": { @@ -1410,7 +1449,7 @@ } }, "traits": { - "smithy.api#documentation": "

      Contains information about the function that was called from the action group and the response that was returned.

      \n

      This data type is used in the following API operations:

      \n " + "smithy.api#documentation": "

      Contains information about the function that was called from the action group and the response that was returned.

      \n

      This data type is used in the following API operations:

      \n " } }, "com.amazonaws.bedrockagentruntime#GeneratedResponsePart": { @@ -1424,7 +1463,7 @@ } }, "traits": { - "smithy.api#documentation": "

      Contains metadata about a part of the generated response that is accompanied by a citation.

      \n

      This data type is used in the following API operations:

      \n " + "smithy.api#documentation": "

      Contains metadata about a part of the generated response that is accompanied by a citation.

      \n

      This data type is used in the following API operations:

      \n " } }, "com.amazonaws.bedrockagentruntime#GenerationConfiguration": { @@ -1435,12 +1474,78 @@ "traits": { "smithy.api#documentation": "

      Contains the template for the prompt that's sent to the model for response generation.

      " } + }, + "guardrailConfiguration": { + "target": "com.amazonaws.bedrockagentruntime#GuardrailConfiguration", + "traits": { + "smithy.api#documentation": "

      The configuration details for the guardrail.

      " + } + }, + "inferenceConfig": { + "target": "com.amazonaws.bedrockagentruntime#InferenceConfig", + "traits": { + "smithy.api#documentation": "

      Configuration settings for inference when using RetrieveAndGenerate to generate responses while using a knowledge base as a source.

      " + } + }, + "additionalModelRequestFields": { + "target": "com.amazonaws.bedrockagentruntime#AdditionalModelRequestFields", + "traits": { + "smithy.api#documentation": "

      Additional model parameters and corresponding values not included in the textInferenceConfig structure for a knowledge base. This allows users to provide custom model parameters specific to the language model being used.

      " + } } }, "traits": { "smithy.api#documentation": "

      Contains configurations for response generation based on the knowledge base query results.

      \n

      This data type is used in the following API operations:

      \n " } }, + "com.amazonaws.bedrockagentruntime#GuadrailAction": { + "type": "enum", + "members": { + "INTERVENED": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "INTERVENED" + } + }, + "NONE": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "NONE" + } + } + } + }, + "com.amazonaws.bedrockagentruntime#GuardrailConfiguration": { + "type": "structure", + "members": { + "guardrailId": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "

      The unique identifier for the guardrail.

      ", + "smithy.api#length": { + "max": 64 + }, + "smithy.api#pattern": "^[a-z0-9]+$", + "smithy.api#required": {} + } + }, + "guardrailVersion": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "

      The version of the guardrail.

      ", + "smithy.api#length": { + "min": 1, + "max": 5 + }, + "smithy.api#pattern": "^(([1-9][0-9]{0,7})|(DRAFT))$", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#documentation": "

      The configuration details for the guardrail.

      " + } + }, "com.amazonaws.bedrockagentruntime#Identifier": { "type": "string", "traits": { @@ -1451,6 +1556,20 @@ "smithy.api#sensitive": {} } }, + "com.amazonaws.bedrockagentruntime#InferenceConfig": { + "type": "structure", + "members": { + "textInferenceConfig": { + "target": "com.amazonaws.bedrockagentruntime#TextInferenceConfig", + "traits": { + "smithy.api#documentation": "

      Configuration settings specific to text generation while generating responses using RetrieveAndGenerate.

      " + } + } + }, + "traits": { + "smithy.api#documentation": "

      The configuration for inference settings when generating responses using RetrieveAndGenerate.

      " + } + }, "com.amazonaws.bedrockagentruntime#InferenceConfiguration": { "type": "structure", "members": { @@ -1569,7 +1688,7 @@ } }, "traits": { - "smithy.api#documentation": "

      Contains details about the API operation or function that the agent predicts should be called.

      \n

      This data type is used in the following API operations:

      \n " + "smithy.api#documentation": "

      Contains details about the API operation or function that the agent predicts should be called.

      \n

      This data type is used in the following API operations:

      \n " } }, "com.amazonaws.bedrockagentruntime#InvocationInputs": { @@ -1601,7 +1720,7 @@ } }, "traits": { - "smithy.api#documentation": "

      A result from the action group invocation.

      \n

      This data type is used in the following API operations:

      \n " + "smithy.api#documentation": "

      A result from the invocation of an action. For more information, see Return control to the agent developer and Control session context.

      \n

      This data type is used in the following API operations:

      \n " } }, "com.amazonaws.bedrockagentruntime#InvocationType": { @@ -1665,7 +1784,7 @@ } ], "traits": { - "smithy.api#documentation": "

      Sends a prompt for the agent to process and respond to. Use return control event type for function calling.

      \n \n

      The CLI doesn't support InvokeAgent.

      \n
      \n
        \n
      • \n

        To continue the same conversation with an agent, use the same sessionId value in the request.

        \n
      • \n
      • \n

        To activate trace enablement, turn enableTrace to true. Trace enablement helps you follow the agent's reasoning process that led it to the information it processed, the actions it took, and the final result it yielded. For more information, see Trace enablement.

        \n
      • \n
      • \n

        End a conversation by setting endSession to true.

        \n
      • \n
      • \n

        In the sessionState object, you can include attributes for the session or prompt or parameters returned from the action group.

        \n
      • \n
      • \n

        Use return control event type for function calling.

        \n
      • \n
      \n

      The response is returned in the bytes field of the chunk object.

      \n
        \n
      • \n

        The attribution object contains citations for parts of the response.

        \n
      • \n
      • \n

        If you set enableTrace to true in the request, you can trace the agent's steps and reasoning process that led it to the response.

        \n
      • \n
      • \n

        Errors are also surfaced in the response.

        \n
      • \n
      ", + "smithy.api#documentation": "\n

      The CLI doesn't support InvokeAgent.

      \n
      \n

      Sends a prompt for the agent to process and respond to. Note the following fields for the request:

      \n
        \n
      • \n

        To continue the same conversation with an agent, use the same sessionId value in the request.

        \n
      • \n
      • \n

        To activate trace enablement, turn enableTrace to true. Trace enablement helps you follow the agent's reasoning process that led it to the information it processed, the actions it took, and the final result it yielded. For more information, see Trace enablement.

        \n
      • \n
      • \n

        End a conversation by setting endSession to true.

        \n
      • \n
      • \n

        In the sessionState object, you can include attributes for the session or prompt or, if you configured an action group to return control, results from invocation of the action group.

        \n
      • \n
      \n

      The response is returned in the bytes field of the chunk object.

      \n
        \n
      • \n

        The attribution object contains citations for parts of the response.

        \n
      • \n
      • \n

        If you set enableTrace to true in the request, you can trace the agent's steps and reasoning process that led it to the response.

        \n
      • \n
      • \n

        If the action predicted was configured to return control, the response returns parameters for the action, elicited from the user, in the returnControl field.

        \n
      • \n
      • \n

        Errors are also surfaced in the response.

        \n
      • \n
      ", "smithy.api#http": { "code": 200, "method": "POST", @@ -1679,7 +1798,7 @@ "sessionState": { "target": "com.amazonaws.bedrockagentruntime#SessionState", "traits": { - "smithy.api#documentation": "

      Contains parameters that specify various attributes of the session. For more information, see Control session context.

      " + "smithy.api#documentation": "

      Contains parameters that specify various attributes of the session. For more information, see Control session context.

      \n \n

      If you include returnControlInvocationResults in the sessionState field, the inputText field will be ignored.

      \n
      " } }, "agentId": { @@ -1721,7 +1840,7 @@ "inputText": { "target": "com.amazonaws.bedrockagentruntime#InputText", "traits": { - "smithy.api#documentation": "

      The prompt text to send the agent.

      " + "smithy.api#documentation": "

      The prompt text to send the agent.

      \n \n

      If you include returnControlInvocationResults in the sessionState field, the inputText field will be ignored.

      \n
      " } } }, @@ -1965,6 +2084,15 @@ "com.amazonaws.bedrockagentruntime#LambdaArn": { "type": "string" }, + "com.amazonaws.bedrockagentruntime#MaxTokens": { + "type": "integer", + "traits": { + "smithy.api#range": { + "min": 0, + "max": 65536 + } + } + }, "com.amazonaws.bedrockagentruntime#MaximumLength": { "type": "integer", "traits": { @@ -2388,6 +2516,24 @@ "smithy.api#documentation": "

      Contains the parameters in the request body.

      " } }, + "com.amazonaws.bedrockagentruntime#RAGStopSequences": { + "type": "list", + "member": { + "target": "smithy.api#String", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 1000 + } + } + }, + "traits": { + "smithy.api#length": { + "min": 0, + "max": 4 + } + } + }, "com.amazonaws.bedrockagentruntime#Rationale": { "type": "structure", "members": { @@ -2669,7 +2815,7 @@ } }, "traits": { - "smithy.api#documentation": "

      Contains the cited text from the data source.

      \n

      This data type is used in the following API operations:

      \n ", + "smithy.api#documentation": "

      Contains the cited text from the data source.

      \n

      This data type is used in the following API operations:

      \n ", "smithy.api#sensitive": {} } }, @@ -2691,7 +2837,7 @@ } }, "traits": { - "smithy.api#documentation": "

      Contains information about the location of the data source.

      \n

      This data type is used in the following API operations:

      \n ", + "smithy.api#documentation": "

      Contains information about the location of the data source.

      \n

      This data type is used in the following API operations:

      \n ", "smithy.api#sensitive": {} } }, @@ -2744,7 +2890,7 @@ } }, "traits": { - "smithy.api#documentation": "

      Contains the S3 location of the data source.

      \n

      This data type is used in the following API operations:

      \n " + "smithy.api#documentation": "

      Contains the S3 location of the data source.

      \n

      This data type is used in the following API operations:

      \n " } }, "com.amazonaws.bedrockagentruntime#Retrieve": { @@ -2970,6 +3116,12 @@ "traits": { "smithy.api#documentation": "

      A list of segments of the generated response that are based on sources in the knowledge base, alongside information about the sources.

      " } + }, + "guardrailAction": { + "target": "com.amazonaws.bedrockagentruntime#GuadrailAction", + "traits": { + "smithy.api#documentation": "

      Specifies if there is a guardrail intervention in the response.

      " + } } }, "traits": { @@ -3095,7 +3247,7 @@ } }, "traits": { - "smithy.api#documentation": "

      Contains metadata about a source cited for the generated response.

      \n

      This data type is used in the following API operations:

      \n " + "smithy.api#documentation": "

      Contains metadata about a source cited for the generated response.

      \n

      This data type is used in the following API operations:

      \n " } }, "com.amazonaws.bedrockagentruntime#RetrievedReferences": { @@ -3133,7 +3285,7 @@ } }, "traits": { - "smithy.api#documentation": "

      Contains information to return from the action group that the agent has predicted to invoke.

      \n

      This data type is used in the following API operations:

      \n ", + "smithy.api#documentation": "

      Contains information to return from the action group that the agent has predicted to invoke.

      \n

      This data type is used in the following API operations:

      \n ", "smithy.api#sensitive": {} } }, @@ -3229,13 +3381,13 @@ "returnControlInvocationResults": { "target": "com.amazonaws.bedrockagentruntime#ReturnControlInvocationResults", "traits": { - "smithy.api#documentation": "

      Contains information about the results from the action group invocation.

      " + "smithy.api#documentation": "

      Contains information about the results from the action group invocation. For more information, see Return control to the agent developer and Control session context.

      \n \n

      If you include this field, the inputText field will be ignored.

      \n
      " } }, "invocationId": { "target": "smithy.api#String", "traits": { - "smithy.api#documentation": "

      The identifier of the invocation.

      " + "smithy.api#documentation": "

      The identifier of the invocation of an action. This value must match the invocationId returned in the InvokeAgent response for the action whose results are provided in the returnControlInvocationResults field. For more information, see Return control to the agent developer and Control session context.

      " } } }, @@ -3292,7 +3444,7 @@ } }, "traits": { - "smithy.api#documentation": "

      Contains information about where the text with a citation begins and ends in the generated output.

      \n

      This data type is used in the following API operations:

      \n " + "smithy.api#documentation": "

      Contains information about where the text with a citation begins and ends in the generated output.

      \n

      This data type is used in the following API operations:

      \n " } }, "com.amazonaws.bedrockagentruntime#StopSequences": { @@ -3316,6 +3468,38 @@ } } }, + "com.amazonaws.bedrockagentruntime#TextInferenceConfig": { + "type": "structure", + "members": { + "temperature": { + "target": "com.amazonaws.bedrockagentruntime#Temperature", + "traits": { + "smithy.api#documentation": "

      Controls the random-ness of text generated by the language model, influencing how much the model sticks to the most predictable next words versus exploring more surprising options. A lower temperature value (e.g. 0.2 or 0.3) makes model outputs more deterministic or predictable, while a higher temperature (e.g. 0.8 or 0.9) makes the outputs more creative or unpredictable.

      " + } + }, + "topP": { + "target": "com.amazonaws.bedrockagentruntime#TopP", + "traits": { + "smithy.api#documentation": "

      A probability distribution threshold which controls what the model considers for the set of possible next tokens. The model will only consider the top p% of the probability distribution when generating the next token.

      " + } + }, + "maxTokens": { + "target": "com.amazonaws.bedrockagentruntime#MaxTokens", + "traits": { + "smithy.api#documentation": "

      The maximum number of tokens to generate in the output text. Do not use the minimum of 0\n or the maximum of 65536. The limit values described here are arbitary values, for actual\n values consult the limits defined by your specific model.

      " + } + }, + "stopSequences": { + "target": "com.amazonaws.bedrockagentruntime#RAGStopSequences", + "traits": { + "smithy.api#documentation": "

      A list of sequences of characters that, if generated, will cause the model to stop\n generating further tokens. Do not use a minimum length of 1 or a maximum length of 1000. The\n limit values described here are arbitary values, for actual values consult the limits defined\n by your specific model.

      " + } + } + }, + "traits": { + "smithy.api#documentation": "

      Configuration settings for text generation using a language model via the\n RetrieveAndGenerate operation. Includes parameters like temperature, top-p, maximum token\n count, and stop sequences.

      \n \n

      The valid range of maxTokens depends on the accepted values for your chosen\n model's inference parameters. To see the inference parameters for your model, see Inference\n parameters for foundation models.\n

      \n
      " + } + }, "com.amazonaws.bedrockagentruntime#TextPromptTemplate": { "type": "string", "traits": { @@ -3343,7 +3527,7 @@ } }, "traits": { - "smithy.api#documentation": "

      Contains the part of the generated text that contains a citation, alongside where it begins and ends.

      \n

      This data type is used in the following API operations:

      \n ", + "smithy.api#documentation": "

      Contains the part of the generated text that contains a citation, alongside where it begins and ends.

      \n

      This data type is used in the following API operations:

      \n ", "smithy.api#sensitive": {} } },