Skip to content

create_retrieval_instruction_version async

create_retrieval_instruction_version(
    retrieval_instruction_id: RetrievalInstructionId,
    *,
    config_overrides: Optional[AsyncBedrockAgentClientConfig] = None,
    description: Optional[RetrievalInstructionDescription] = None,
    client_token: Optional[ClientToken] = None,
) -> CreateRetrievalInstructionVersionResponse

Creates an immutable numbered version from the retrieval instruction's current reviewed content. The service creates the version synchronously.

The service numbers versions from 1 and assigns them in order, never reusing a number.

Parameters:

  • retrieval_instruction_id (RetrievalInstructionId) –

    The identifier of the retrieval instruction to version.

  • description (Optional[RetrievalInstructionDescription], default: None ) –

    A description of this version. Independent of the retrieval instruction's own description.

  • client_token (Optional[ClientToken], default: None ) –

    A caller-supplied token that makes a retried call return the version created by the first call rather than a second version. The window is 8 hours.

Raises:

Source code in docs_src/capo_bedrock_agent/_services/async_bedrock_agent.py
async def create_retrieval_instruction_version(
    self,
    retrieval_instruction_id: "capo_bedrock_agent.types.retrieval_instruction_id.RetrievalInstructionId",
    *,
    config_overrides: Optional[AsyncBedrockAgentClientConfig] = None,
    description: Optional[
        "capo_bedrock_agent.types.retrieval_instruction_description.RetrievalInstructionDescription"
    ] = None,
    client_token: Optional[
        "capo_bedrock_agent.types.client_token.ClientToken"
    ] = None,
) -> "capo_bedrock_agent.types.create_retrieval_instruction_version_response.CreateRetrievalInstructionVersionResponse":
    """<p>Creates an immutable numbered version from the retrieval instruction's current reviewed content. The service creates the version synchronously.</p> <p>The service numbers versions from 1 and assigns them in order, never reusing a number.</p>

    Args:
        retrieval_instruction_id: <p>The identifier of the retrieval instruction to version.</p>
        description: <p>A description of this version. Independent of the retrieval instruction's own description.</p>
        client_token: <p>A caller-supplied token that makes a retried call return the version created by the first call rather than a second version. The window is 8 hours.</p>

    Raises:
        capo_bedrock_agent.errors.access_denied_exception.AccessDeniedException: <p>The request is denied because of missing access permissions.</p>
        capo_bedrock_agent.errors.conflict_exception.ConflictException: <p>There was a conflict performing an operation.</p>
        capo_bedrock_agent.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry your request.</p>
        capo_bedrock_agent.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.</p>
        capo_bedrock_agent.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The number of requests exceeds the service quota. Resubmit your request later.</p>
        capo_bedrock_agent.errors.throttling_exception.ThrottlingException: <p>The number of requests exceeds the limit. Resubmit your request later.</p>
        capo_bedrock_agent.errors.validation_exception.ValidationException: <p>Input validation failed. Check your request parameters and retry the request.</p>
        capo_bedrock_agent.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_bedrock_agent.types.create_retrieval_instruction_version_request.CreateRetrievalInstructionVersionRequest]",
    ) -> AsyncOperationResponse[
        "capo_bedrock_agent.types.create_retrieval_instruction_version_response.CreateRetrievalInstructionVersionResponse"
    ]:
        import capo_bedrock_agent._operations.amazon_bedrock_agent_build_time_lambda.create_retrieval_instruction_version

        (
            output,
            http_response,
        ) = await capo_bedrock_agent._operations.amazon_bedrock_agent_build_time_lambda.create_retrieval_instruction_version.async_create_retrieval_instruction_version(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_bedrock_agent.types.create_retrieval_instruction_version_request.CreateRetrievalInstructionVersionRequest",
    ) -> dict[str, Any]:
        import capo_bedrock_agent.types.create_retrieval_instruction_version_request

        return capo_bedrock_agent.types.create_retrieval_instruction_version_request.redact_sensitive(
            input_
        )

    def _redact_output(
        output: "capo_bedrock_agent.types.create_retrieval_instruction_version_response.CreateRetrievalInstructionVersionResponse",
    ) -> dict[str, Any]:
        import capo_bedrock_agent.types.create_retrieval_instruction_version_response

        return capo_bedrock_agent.types.create_retrieval_instruction_version_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "CreateRetrievalInstructionVersion",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_bedrock_agent.types.create_retrieval_instruction_version_request.CreateRetrievalInstructionVersionRequest = {
        "retrieval_instruction_id": retrieval_instruction_id
    }
    if description is not None:
        input_["description"] = description
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output