Skip to content

Latest commit

 

History

History
132 lines (90 loc) · 6.13 KB

README.md

File metadata and controls

132 lines (90 loc) · 6.13 KB
SambaNova logo

SambaNova Financial Assistant

Questions? Just message us on Discord Discord or create an issue in GitHub. We're happy to help live!

Welcome to the Sambanova Financial Insights application.

Table of Contents:

Overview

This app demonstrates the capabilities of large language models (LLMs) in extracting and analyzing financial data using function calling, web scraping, and retrieval-augmented generation (RAG).

Use the navigation menu to explore various features including:

  • Stock Data Analysis: Query and analyze stocks based on Yahoo Finance data.
  • Stock Database: Create and query an SQL database based on Yahoo Finance data.
  • Financial News Scraping: Scrape financial news articles from Yahoo Finance News.
  • Financial Filings Analysis: Query and analyze financial filings based on SEC EDGAR data.
  • Generate PDF Report: Generate a PDF report based on the saved answered queries or on the whole chat history.
  • Print Chat History: Print the whole chat history.

Before you begin

You have to set up your environment before you can run or customize the starter kit.

Clone this repository

Clone the starter kit repo.

git clone https://github.com/sambanova/ai-starter-kit.git

Set up the models, environment variables and config file

Set up the generative model

The next step is to set up your environment variables to use one of the inference models available from SambaNova. You can obtain a free API key through SambaNova Cloud. Alternatively, if you are a current SambaNova customer, you can deploy your models using SambaStudio.

  • SambaNova Cloud (Option 1): Follow the instructions here to set up your environment variables. Then, in the config file, set the llm api variable to "sncloud" and set the select_expert config depending on the model you want to use.

  • SambaStudio (Option 2): Follow the instructions here to set up your endpoint and environment variables. Then, in the config file, set the llm api variable to "sambastudio", and set the bundle and select_expert configs if you are using a bundle endpoint.

Set up the embedding model

You have the following options to set up your embedding model:

  • CPU embedding model (Option 1): In the config file, set the variable type in embedding_model to "cpu". This will make use of langchain_community.embeddings.sentence_transformer.SentenceTransformerEmbeddings.

  • SambaStudio embedding model (Option 2): To increase inference speed, you can use a SambaStudio embedding model endpoint instead of using the default (CPU) Hugging Face embedding. Follow the instructions here to set up your endpoint and environment variables. Then, in the config file, set the variable type in embedding_model to "sambastudio", and set the configs batch_size, bundle and select_expert according to your SambaStudio endpoint.

Windows requirements

  • If you are using Windows, make sure your system has Microsoft Visual C++ Redistributable installed. You can install it from Microsoft Visual C++ Build Tools and make sure to check all boxes regarding C++ section. (Compatible versions: 2015, 2017, 2019 or 2022)

Deploy the starter kit GUI

We recommend that you run the starter kit in a virtual environment or use a container. We also require the use of Python versions >= 3.10 and < 3.12."

Use a virtual environment

If you want to use a Python virtual environment:

  1. Install and update pip.

    cd ai-starter-kit/financial_assistant
    python3 -m venv financial_assistant_venv
    source financial_assistant_venv/bin/activate
    pip install -r requirements.txt
  2. Run the following command:

        streamlit run streamlit/app.py --browser.gatherUsageStats false 

Further settings

For the SEC-EDGAR functionalities, company name and email are used to form a user-agent of the form: USER_AGENT: <Company Name> <Email Address>.

# Your organization
SEC_API_ORGANIZATION="<your organization>"

# Your email address
SEC_API_EMAIL="<user@email_provider.com>"

For Weave users:

WANDB_API_KEY = "<your-wandb-api-key>"

Exit the app

Once you have finished using the app, you can exit the app by clicking on Exit at the top of the sidebar. This will clear the cache. Otherwise, the cache will be automatically cleared after a predefined time period.

Third-party tools and data sources

All the packages/tools are listed in the requirements.txt file in the project directory.