tests.system.providers.amazon.aws.example_bedrock_retrieve_and_generate

Module Contents

Functions

external_sources_rag_group()

External Sources were added in boto 1.34.90, skip this operator if the version is below that.

create_opensearch_policies(bedrock_role_arn, ...)

Create security, network and data access policies within Amazon OpenSearch Serverless.

create_collection(collection_name)

Call the Amazon OpenSearch Serverless API and create a collection with the provided name.

create_vector_index(index_name, collection_id, region)

Use the OpenSearchPy client to create the vector index for the Amazon Open Search Serverless Collection.

copy_data_to_s3(bucket)

Download some sample data and upload it to 3S.

get_collection_arn(collection_id)

Return a collection ARN for a given collection ID.

delete_data_source(knowledge_base_id, data_source_id)

Delete the Amazon Bedrock data source created earlier.

delete_knowledge_base(knowledge_base_id)

Delete the Amazon Bedrock knowledge base created earlier.

delete_vector_index(index_name, collection_id)

Delete the vector index created earlier.

delete_collection(collection_id)

Delete the OpenSearch collection created earlier.

delete_opensearch_policies(collection_name)

Delete the security, network and data access policies created earlier.

Attributes

CLAUDE_MODEL_ID

TITAN_MODEL_ID

ROLE_ARN_KEY

sys_test_context_task

DAG_ID

log

test_context

test_run

tests.system.providers.amazon.aws.example_bedrock_retrieve_and_generate.CLAUDE_MODEL_ID = 'anthropic.claude-v2'[source]
tests.system.providers.amazon.aws.example_bedrock_retrieve_and_generate.TITAN_MODEL_ID = 'amazon.titan-embed-text-v1'[source]
tests.system.providers.amazon.aws.example_bedrock_retrieve_and_generate.ROLE_ARN_KEY = 'ROLE_ARN'[source]
tests.system.providers.amazon.aws.example_bedrock_retrieve_and_generate.sys_test_context_task[source]
tests.system.providers.amazon.aws.example_bedrock_retrieve_and_generate.DAG_ID = 'example_bedrock_knowledge_base'[source]
tests.system.providers.amazon.aws.example_bedrock_retrieve_and_generate.log[source]
tests.system.providers.amazon.aws.example_bedrock_retrieve_and_generate.external_sources_rag_group()[source]

External Sources were added in boto 1.34.90, skip this operator if the version is below that.

tests.system.providers.amazon.aws.example_bedrock_retrieve_and_generate.create_opensearch_policies(bedrock_role_arn, collection_name, policy_name_suffix)[source]

Create security, network and data access policies within Amazon OpenSearch Serverless.

Parameters
  • bedrock_role_arn (str) – Arn of the Bedrock Knowledge Base Execution Role.

  • collection_name (str) – Name of the OpenSearch collection to apply the policies to.

  • policy_name_suffix (str) – EnvironmentID or other unique suffix to append to the policy name.

tests.system.providers.amazon.aws.example_bedrock_retrieve_and_generate.create_collection(collection_name)[source]

Call the Amazon OpenSearch Serverless API and create a collection with the provided name.

Parameters

collection_name (str) – The name of the Collection to create.

tests.system.providers.amazon.aws.example_bedrock_retrieve_and_generate.create_vector_index(index_name, collection_id, region)[source]

Use the OpenSearchPy client to create the vector index for the Amazon Open Search Serverless Collection.

Parameters
  • index_name (str) – The vector index name to create.

  • collection_id (str) – ID of the collection to be indexed.

  • region (str) – Name of the AWS region the collection resides in.

tests.system.providers.amazon.aws.example_bedrock_retrieve_and_generate.copy_data_to_s3(bucket)[source]

Download some sample data and upload it to 3S.

Parameters

bucket (str) – Name of the Amazon S3 bucket to send the data to.

tests.system.providers.amazon.aws.example_bedrock_retrieve_and_generate.get_collection_arn(collection_id)[source]

Return a collection ARN for a given collection ID.

Parameters

collection_id (str) – ID of the collection to be indexed.

tests.system.providers.amazon.aws.example_bedrock_retrieve_and_generate.delete_data_source(knowledge_base_id, data_source_id)[source]

Delete the Amazon Bedrock data source created earlier.

See also

For more information on how to use this sensor, take a look at the guide: Delete an Amazon Bedrock Data Source

Parameters
  • knowledge_base_id (str) – The unique identifier of the knowledge base which the data source is attached to.

  • data_source_id (str) – The unique identifier of the data source to delete.

tests.system.providers.amazon.aws.example_bedrock_retrieve_and_generate.delete_knowledge_base(knowledge_base_id)[source]

Delete the Amazon Bedrock knowledge base created earlier.

See also

For more information on how to use this sensor, take a look at the guide: Delete an Amazon Bedrock Knowledge Base

Parameters

knowledge_base_id (str) – The unique identifier of the knowledge base to delete.

tests.system.providers.amazon.aws.example_bedrock_retrieve_and_generate.delete_vector_index(index_name, collection_id)[source]

Delete the vector index created earlier.

Parameters
  • index_name (str) – The name of the vector index to delete.

  • collection_id (str) – ID of the collection to be indexed.

tests.system.providers.amazon.aws.example_bedrock_retrieve_and_generate.delete_collection(collection_id)[source]

Delete the OpenSearch collection created earlier.

Parameters

collection_id (str) – ID of the collection to be indexed.

tests.system.providers.amazon.aws.example_bedrock_retrieve_and_generate.delete_opensearch_policies(collection_name)[source]

Delete the security, network and data access policies created earlier.

Parameters

collection_name (str) – All policies in the given collection name will be deleted.

tests.system.providers.amazon.aws.example_bedrock_retrieve_and_generate.test_context[source]
tests.system.providers.amazon.aws.example_bedrock_retrieve_and_generate.test_run[source]

Was this entry helpful?