diff --git a/cdk/examples/generative_ai_rag/requirements.txt b/cdk/examples/generative_ai_rag/requirements.txt index 07d26daa..da6abfe6 100644 --- a/cdk/examples/generative_ai_rag/requirements.txt +++ b/cdk/examples/generative_ai_rag/requirements.txt @@ -5,4 +5,4 @@ boto3 aws-cdk.aws-lambda-python-alpha==2.156.0a0 cdklabs.generative-ai-cdk-constructs>=0.1.271 constructs>=10.0.0,<11.0.0 -setuptools>=75.1.0 \ No newline at end of file +setuptools>=75.1.0 diff --git a/cdk/examples/generative_ai_rag/web-app/pages/foundation_model.py b/cdk/examples/generative_ai_rag/web-app/pages/foundation_model.py index 84fe2ad5..620efa11 100644 --- a/cdk/examples/generative_ai_rag/web-app/pages/foundation_model.py +++ b/cdk/examples/generative_ai_rag/web-app/pages/foundation_model.py @@ -35,7 +35,7 @@ def get_parameter(name): # Use the native inference API to send a text message to Anthropic Claude. # Create a Bedrock Runtime client in the AWS Region of your choice. - client = boto3.client("bedrock-runtime", region_name="us-east-1") + client = boto3.client("bedrock-runtime") # Set the model ID, e.g., Claude 3 Haiku. model_id = "anthropic.claude-3-haiku-20240307-v1:0" diff --git a/cdk/examples/generative_ai_rag/web-app/pages/rag_integration.py b/cdk/examples/generative_ai_rag/web-app/pages/rag_integration.py index d87b5312..4837c45e 100644 --- a/cdk/examples/generative_ai_rag/web-app/pages/rag_integration.py +++ b/cdk/examples/generative_ai_rag/web-app/pages/rag_integration.py @@ -52,7 +52,7 @@ def get_parameter(name): msg = chunk['bytes'].decode('utf-8') st.session_state.messages.append( { - "role": "assistant", + "role": "assistant", "content": msg } ) @@ -60,7 +60,7 @@ def get_parameter(name): except Exception as e: print(f"Error: {e}") st.error("An error occurred while processing the agent's response. Please check the logs for details.") - + msg = "I encountered an issue while processing the response. Could you please rephrase your prompt or try a different question?" st.session_state.messages.append({"role": "assistant", "content": msg}) st.chat_message("assistant").write(msg)