Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing utility error + more refactoring #493

Merged
merged 1 commit into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Amazon Bedrock Knowledge Bases - End to end example using multiple data sources as data source(s)\n",
"# Amazon Bedrock Knowledge Bases - End to end example using multiple data source(s)\n",
"\n",
"This notebook provides sample code for building an empty OpenSearch Serverless (OSS) index,Amazon Bedrock Knowledge Bases and ingest documents into the index from various data sources (S3, Confluence, Sharepoint, Salesforce, and Web). Please note that you can add upto 5 data sources.\n",
"This notebook provides sample code for building an end-to-end example for building a RAG application using Amazon Bedrock Knowledge Bases and ingest documents into the index from various data sources (S3, Confluence, Sharepoint, Salesforce, and Web). Please note that you can add upto 5 data sources.\n",
"\n",
"\n",
"#### Notebook Walkthrough\n",
Expand All @@ -17,7 +17,7 @@
"- Ingestion - Knowledge base will split them into smaller chunks (based on the strategy selected), generate embeddings and store it in the associated vectore store.\n",
"\n",
"<!-- ![data_ingestion.png](./images/data_ingestion.png) -->\n",
"<img src=\"../images/data_ingestion.png\" width=50% height=20% />\n",
"<img src=\"./images/data_ingestion.png\" width=50% height=20% />\n",
"\n",
"\n",
"#### Steps: \n",
Expand All @@ -39,7 +39,7 @@
"source": [
"\n",
"<div class=\"alert alert-block alert-info\">\n",
"<b>Note:</b> Please make sure to enable `Anthropic Claude 3 Sonnet` and, `Titan Text Embeddings V2` model access in Amazon Bedrock Console.\n",
"<b>Note:</b> Please make sure to enable `amazon.nova-micro-v1:0`, `Anthropic Claude 3 Sonnet`, `amazon.titan-text-express-v1`, `anthropic.claude-3-haiku-20240307-v1:0` and, `Titan Text Embeddings V2` model access in Amazon Bedrock Console.\n",
"<br> ------------------------------------------------------------------------------------------------------------------------------------------------------- </br>\n",
" \n",
"Please run the notebook cell by cell instead of using \"Run All Cells\" option.\n",
Expand All @@ -56,13 +56,13 @@
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"tags": []
},
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%pip install --force-reinstall -q -r ../requirements.txt"
"%pip install --upgrade pip --quiet\n",
"%pip install -r ../requirements.txt --no-deps --quiet\n",
"%pip install -r ../requirements.txt --upgrade --quiet"
]
},
{
Expand All @@ -83,7 +83,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -93,7 +93,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -138,7 +138,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -180,7 +180,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -328,7 +328,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -341,7 +341,7 @@
"metadata": {},
"outputs": [],
"source": [
"foundation_model = \"anthropic.claude-3-sonnet-20240229-v1:0\"\n",
"foundation_model = \"amazon.nova-micro-v1:0\"\n",
"\n",
"response = bedrock_agent_runtime_client.retrieve_and_generate(\n",
" input={\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@
},
"outputs": [],
"source": [
"%pip install --force-reinstall -q -r ../requirements.txt"
"%pip install --upgrade pip --quiet\n",
"%pip install -r ../requirements.txt --no-deps --quiet\n",
"%pip install -r ../requirements.txt --upgrade --quiet"
]
},
{
Expand Down Expand Up @@ -137,8 +139,8 @@
},
"outputs": [],
"source": [
"# %store -r kb_id\n",
"kb_id = \"<<knowledge_base_id>>\" # Replace with your knowledge base id here."
"%store -r kb_id\n",
"# kb_id = \"<<knowledge_base_id>>\" # Replace with your knowledge base id here."
]
},
{
Expand Down Expand Up @@ -1085,7 +1087,7 @@
],
"instance_type": "ml.t3.medium",
"kernelspec": {
"display_name": "Python 3",
"display_name": "bedrock_env",
"language": "python",
"name": "python3"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"\n",
"\n",
"<!-- ![data_ingestion](./images/data_ingestion.png) -->\n",
"<img src=\"../images/data_ingestion.png\" width=50% height=20% />\n",
"<img src=\"./images/data_ingestion.png\" width=50% height=20% />\n",
"\n",
"\n",
"#### Notebook Walkthrough\n",
Expand Down Expand Up @@ -77,7 +77,9 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install --force-reinstall -q -r ../requirements.txt"
"%pip install --upgrade pip --quiet\n",
"%pip install -r ../requirements.txt --no-deps --quiet\n",
"%pip install -r ../requirements.txt --upgrade --quiet"
]
},
{
Expand Down Expand Up @@ -1074,9 +1076,9 @@
],
"instance_type": "ml.t3.medium",
"kernelspec": {
"display_name": "Python 3 (Data Science 3.0)",
"display_name": "bedrock_env",
"language": "python",
"name": "python3__SAGEMAKER_INTERNAL__arn:aws:sagemaker:us-west-2:236514542706:image/sagemaker-data-science-310-v1"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -1088,7 +1090,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
"version": "3.10.13"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install --force-reinstall -q -r ../requirements.txt"
"%pip install --upgrade pip --quiet\n",
"%pip install -r ../requirements.txt --no-deps --quiet\n",
"%pip install -r ../requirements.txt --upgrade --quiet"
]
},
{
Expand Down
Loading