GenAI with Stock Trading Website (Module 6)

Hui Yee Leong
3 min readJul 10, 2024

--

Module 6: Testing

In this module, we will perform end-to-end testing to ensure all components of our system work seamlessly together. We will test the chatbot by asking various queries and checking the logs in AWS CloudWatch to verify the responses.

Step 1: Test the Chatbot

6.1 Running the Chatbot

a. Run the Python Chatbot Script:

  • Ensure your chatbot script is running as shown in Module 5.
  • Start the script:
python3 chatbot.py

b. Interact with the Chatbot:

  • Ask the chatbot the following questions:
  • “What sort of question can I ask?”
  • “Tell me about New Zealand-based logistics company.”
  • “Capstone Copper’s company overview.”
  • “ESG Investing.”

Remember, the chatbot’s responses will be based on the data you provide. Ensuring the quality and relevance of the data is crucial for accurate and useful answers.

Sample Interaction:

  • The chatbot should respond appropriately to each query by sending the query to the API Gateway, which invokes the Lambda function to process the query and return a response.
sample chatbot output

Step 2: Verify Logs in AWS CloudWatch

6.2 Access CloudWatch Logs

a. Open CloudWatch Console: In the search bar, type “CloudWatch” and select it from the list of services.

b. Navigate to Logs:

  • Click on “Logs” in the left-hand menu.
  • Find the log group associated with your Lambda function (e.g., /aws/lambda/-asxlambda).
  • Click on the log group to view the log streams.

Summary

In this module, we performed end-to-end testing of the entire system. We ran the chatbot, asked several test questions, and verified the responses by checking the logs in AWS CloudWatch. This testing ensures that all components work together seamlessly, providing accurate and relevant responses to user queries.

Conclusion

Congratulations! You have successfully created and tested a conversational AI system using Amazon Kendra, AWS Bedrock, AWS Lambda, API Gateway, and a simple Python chatbot. This system can handle user queries related to stock trading and provide insightful responses. You can further enhance the system by adding more capabilities and improving the data sources.

Remember to clean up all the resources to prevent unnecessary costs.

Happy Learning Always Day 1

--

--