Skip to content

Queries a knowledge base and retrieves information from it

Description

Queries a knowledge base and retrieves information from it.

Usage

bedrockagentruntime_retrieve(guardrailConfiguration, knowledgeBaseId,
  nextToken, retrievalConfiguration, retrievalQuery, userContext)

Arguments

  • guardrailConfiguration

    Guardrail settings.

  • knowledgeBaseId

    [required] The unique identifier of the knowledge base to query.

  • nextToken

    If there are more results than can fit in the response, the response returns a nextToken. Use this token in the nextToken field of another request to retrieve the next batch of results.

  • retrievalConfiguration

    Contains configurations for the knowledge base query and retrieval process. For more information, see Query configurations.

  • retrievalQuery

    [required] Contains the query to send the knowledge base.

  • userContext

    Contains information about the user making the request. This is used for access control filtering to ensure that retrieval results only include documents the user is authorized to access.

Value

A list with the following syntax:

list(
  guardrailAction = "INTERVENED"|"NONE",
  nextToken = "string",
  retrievalResults = list(
    list(
      content = list(
        audio = list(
          s3Uri = "string",
          transcription = "string"
        ),
        byteContent = "string",
        row = list(
          list(
            columnName = "string",
            columnValue = "string",
            type = "BLOB"|"BOOLEAN"|"DOUBLE"|"NULL"|"LONG"|"STRING"
          )
        ),
        text = "string",
        type = "TEXT"|"IMAGE"|"ROW"|"AUDIO"|"VIDEO",
        video = list(
          s3Uri = "string",
          summary = "string"
        )
      ),
      documentId = "string",
      location = list(
        confluenceLocation = list(
          url = "string"
        ),
        customDocumentLocation = list(
          id = "string"
        ),
        googleDriveLocation = list(
          url = "string"
        ),
        kendraDocumentLocation = list(
          uri = "string"
        ),
        oneDriveLocation = list(
          url = "string"
        ),
        s3Location = list(
          uri = "string"
        ),
        salesforceLocation = list(
          url = "string"
        ),
        sharePointLocation = list(
          url = "string"
        ),
        sqlLocation = list(
          query = "string"
        ),
        type = "S3"|"WEB"|"CONFLUENCE"|"SALESFORCE"|"SHAREPOINT"|"CUSTOM"|"KENDRA"|"SQL"|"ONEDRIVE"|"GOOGLEDRIVE",
        webLocation = list(
          url = "string"
        )
      ),
      metadata = list(
        list()
      ),
      score = 123.0
    )
  )
)

Request syntax

svc$retrieve(
  guardrailConfiguration = list(
    guardrailId = "string",
    guardrailVersion = "string"
  ),
  knowledgeBaseId = "string",
  nextToken = "string",
  retrievalConfiguration = list(
    managedSearchConfiguration = list(
      filter = list(
        andAll = list(
          list()
        ),
        equals = list(
          key = "string",
          value = list()
        ),
        greaterThan = list(
          key = "string",
          value = list()
        ),
        greaterThanOrEquals = list(
          key = "string",
          value = list()
        ),
        in = list(
          key = "string",
          value = list()
        ),
        lessThan = list(
          key = "string",
          value = list()
        ),
        lessThanOrEquals = list(
          key = "string",
          value = list()
        ),
        listContains = list(
          key = "string",
          value = list()
        ),
        notEquals = list(
          key = "string",
          value = list()
        ),
        notIn = list(
          key = "string",
          value = list()
        ),
        orAll = list(
          list()
        ),
        startsWith = list(
          key = "string",
          value = list()
        ),
        stringContains = list(
          key = "string",
          value = list()
        )
      ),
      numberOfResults = 123,
      rerankingConfiguration = list(
        bedrockRerankingConfiguration = list(
          metadataConfiguration = list(
            selectionMode = "SELECTIVE"|"ALL",
            selectiveModeConfiguration = list(
              fieldsToExclude = list(
                list(
                  fieldName = "string"
                )
              ),
              fieldsToInclude = list(
                list(
                  fieldName = "string"
                )
              )
            )
          ),
          modelConfiguration = list(
            additionalModelRequestFields = list(
              list()
            ),
            modelArn = "string"
          ),
          numberOfRerankedResults = 123
        ),
        type = "BEDROCK_RERANKING_MODEL"
      ),
      rerankingModelType = "CUSTOM"|"MANAGED"|"NONE"
    ),
    vectorSearchConfiguration = list(
      filter = list(
        andAll = list(
          list()
        ),
        equals = list(
          key = "string",
          value = list()
        ),
        greaterThan = list(
          key = "string",
          value = list()
        ),
        greaterThanOrEquals = list(
          key = "string",
          value = list()
        ),
        in = list(
          key = "string",
          value = list()
        ),
        lessThan = list(
          key = "string",
          value = list()
        ),
        lessThanOrEquals = list(
          key = "string",
          value = list()
        ),
        listContains = list(
          key = "string",
          value = list()
        ),
        notEquals = list(
          key = "string",
          value = list()
        ),
        notIn = list(
          key = "string",
          value = list()
        ),
        orAll = list(
          list()
        ),
        startsWith = list(
          key = "string",
          value = list()
        ),
        stringContains = list(
          key = "string",
          value = list()
        )
      ),
      implicitFilterConfiguration = list(
        metadataAttributes = list(
          list(
            description = "string",
            key = "string",
            type = "STRING"|"NUMBER"|"BOOLEAN"|"STRING_LIST"
          )
        ),
        modelArn = "string"
      ),
      numberOfResults = 123,
      overrideSearchType = "HYBRID"|"SEMANTIC",
      rerankingConfiguration = list(
        bedrockRerankingConfiguration = list(
          metadataConfiguration = list(
            selectionMode = "SELECTIVE"|"ALL",
            selectiveModeConfiguration = list(
              fieldsToExclude = list(
                list(
                  fieldName = "string"
                )
              ),
              fieldsToInclude = list(
                list(
                  fieldName = "string"
                )
              )
            )
          ),
          modelConfiguration = list(
            additionalModelRequestFields = list(
              list()
            ),
            modelArn = "string"
          ),
          numberOfRerankedResults = 123
        ),
        type = "BEDROCK_RERANKING_MODEL"
      )
    )
  ),
  retrievalQuery = list(
    image = list(
      format = "png"|"jpeg"|"gif"|"webp",
      inlineContent = raw
    ),
    text = "string",
    type = "TEXT"|"IMAGE"
  ),
  userContext = list(
    userId = "string"
  )
)