This week is about connecting a simple AI chatbot with some custom prompting to an LLM hosted on AWS Bedrock, specifically using the Llama 3 70B Instruct model. The bot acts as a financial advisor that offers actionable and clear financial advice based on user input.
boto3
SDK.Conversational Financial Advice
The AI responds to queries about budgeting, saving, investing, retirement planning, debt management, and more — all in plain, understandable language.
Persistent Conversation History
The chat keeps track of the conversation flow by storing messages in a list (conversation_history
) and passing them back to the model with each new message.
Memory Management
Limits the number of stored messages (default: last 6 exchanges = 12 messages) to avoid hitting model token limits and reduce latency/cost.