Stock Market Bot

This is an example chatbot for retrieving live stock prices for the stock of a specified company or organization. This bot also provides answers to queries related to the stock market and stocks. Here, the Yahoo Finance API is used for getting the stock prices of a stock. This bot only answers the questions related to stock prices and the stock market and does not have the ability to answer any off-topic queries.

Note

We use yfinance to extract market capital and yahoo-fin to extract real-time stock prices. If you’re seeing issues with packages, you can build the stock plugin using Alpha Vantage or a similar API to get this information and integrate it with the existing bot.

The Stock Market Bot uses the following ACE Agent features:

  • Answering questions from a Knowledge Base

  • Plugin Server for fetching live stock prices

  • Handling profane questions

  • Handling off-topic questions

  • Answering contextual questions

  • Colang 1.0 based bot

  • Chat Engine Server Architecture

Docker-based bot deployment

The Stock Market sample bot utilizes mixtral-8x7b-instruct-v0.1 from the NVIDIA API Catalog. This sample is present in the quickstart directory at ./samples/stock_bot.

  1. Set the API key for the NVIDIA API Catalog.

    export NVIDIA_API_KEY=...
    
  2. Prepare the environment for the Docker compose commands.

    export BOT_PATH=./samples/stock_bot/
    source deploy/docker/docker_init.sh
    
  3. Deploy the Speech and NLP models required for the bot. This might take 20-40 minutes for the first time. With the Stock Market sample bot, Riva ASR (Automatic Speech Recognition) and TTS (Text to Speech) models will be deployed.

    docker compose -f deploy/docker/docker-compose.yml up model-utils-speech
    
  4. Deploy the ACE Agent microservices. Deploy the Chat Controller, Chat Engine, Plugin server, and NLP server microservices.

    docker compose -f deploy/docker/docker-compose.yml up speech-bot -d
    
  5. Wait for a few minutes for all services to be ready. You can check the Docker logs for individual microservices to confirm. You will see log print Server listening on 0.0.0.0:50055 in the Docker logs for the Chat Controller container.

  6. Try out the bot using a web browser. You can deploy a sample frontend application with voice capture and playback support as well as with text input-output support using the following command.

    docker compose -f deploy/docker/docker-compose.yml up frontend-speech
    
  7. Interact with the bot using the URL http://<workstation IP>:9001/. For accessing the mic on the browser, we need to either convert http to https endpoint by adding SSL validation or update your chrome://flags/ or edge://flags/ to allow http://<workstation IP>:9001 as a secure endpoint.

Stock Market bot sample conversation