Skip to content

The brains of Walter. The AI powered market know-it-all that writes newsletters/blogs to keep subscribers updated of the latest market movements tailored to their portfolios.

Notifications You must be signed in to change notification settings

jwallace145/walter-backend

Repository files navigation

WalterBackend

Walter Python Version codecov

Walter is an artificially intelligent bot that creates and sends customized newsletters to subscribers at 7:00am sharp about the markets they're following. WalterAI gathers market data from various APIs for each user and their interested stocks and feeds the data into Bedrock to get AI insights from the LLM Meta Llama 3. This allows WalterAI to create tailored newsletters for each subscriber including information only about the markets relevant to the user's portfolio.

WalterAIBackend is the backend service that maintains the database of subscribers and their interested stocks as well as the service responsible for creating and sending the customized newsletters. WalterAIBackend is powered completely by AWS and runs on Lambda.

Table of Contents

Architecture

walter-architecture

Templates

WalterAIBackend uses email templates stored in S3 to create the emails to send to subscribers. Each email template is written in HTML and uses Jinja to parameterize the inputs. WalterAIBackend pulls the email templates from S3 and renders the template given the templatespec.yml and the template.jinja file. The templatespec.yml is the specification file that tells Walter the name of the parameters as well as the Bedrock prompts to use to get the parameter value. An example of a templatespec.yml file is given below:

version: 0.0

#########################
# DEFAULT TEMPLATE SPEC #
#########################

TemplateSpec:

  ###########
  # CONTEXT #
  ###########

  Context:
    User: {{ user }}
    PortfolioValue: {{ portfolio_value }}
    Stocks:
      {% for stock in stocks %}
      - Symbol: {{ stock.symbol }}
        Price: {{ stock.price }}
      {% endfor %}

  ########
  # KEYS #
  ########

  Keys:
    - Key: User
      Value: {{ user }}
    - Key: PortfolioValue
      Value: {{ portfolio_value }}
      
  ###########
  # PROMPTS #
  ###########

  Prompts:
    - Key: Newsletter
      Prompt: |
        Write a newsletter with business casual humor!
      MaxGenLength: 600

After getting the answers to the prompts given in the templatespec.yml file, Walter renders the template with Jinja and then sends the custom newsletter to the subscriber!

Dependencies

Contributions

About

The brains of Walter. The AI powered market know-it-all that writes newsletters/blogs to keep subscribers updated of the latest market movements tailored to their portfolios.

Topics

Resources

Stars

Watchers

Forks