This project is a simple chat application built using Streamlit that interfaces with Amazon Bedrock's Anthropic Claude model to generate responses to user input. The application allows users to type a message and receive a generated response using the power of AI.
- Real-time Chat: Interact with an AI model to generate responses based on user input.
- Streamlit Interface: Provides an easy-to-use web interface for inputting text and viewing responses.
- Amazon Bedrock Integration: Leverages AWS's Bedrock service to invoke the Claude model for text generation.
Before you begin, ensure you have met the following requirements:
- AWS Account: You need an AWS account with access to the Bedrock service.
- AWS CLI Configured: Ensure that your AWS CLI is configured with the appropriate credentials and region (e.g.,
us-east-1
). - Python 3.x: This project is built with Python, so you'll need Python installed on your system.
- Streamlit: Install Streamlit using pip:
pip install streamlit
-
Clone the Repository:
git clone <repository_url> cd <repository_directory>
-
Install Dependencies: Install the required Python packages:
pip install -r requirements.txt
-
Configure AWS Credentials: Ensure your AWS credentials are configured in your environment. You can do this by running:
aws configure
To run the application, execute the following command:
streamlit run app.py
This will launch a local web server, and you can interact with the chat interface in your browser.
- generate_response(prompt): This function takes a user's input (
prompt
) and sends a request to the Anthropic Claude model using Amazon Bedrock. It returns the model's response text. - Streamlit Interface:
- The user input is captured using
st.text_input
. - Upon pressing the "Send" button, the
generate_response
function is invoked, and the generated response is displayed.
- The user input is captured using
The function includes a try-except block to catch and print any errors during the API call to Bedrock.
- Error Logging: Implement better error logging and handling.
- Model Selection: Allow users to choose from different models available in Bedrock.
- Styling Improvements: Enhance the UI/UX of the Streamlit app.
This project is licensed under the MIT License. See the LICENSE
file for details.