Questions? Just message us on Discord or create an issue in GitHub. We're happy to help live!
Welcome to the Sambanova Financial Insights application.
Table of Contents:
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.
You have to set up your environment before you can run or customize the starter kit.
Clone the starter kit repo.
git clone https://github.com/sambanova/ai-starter-kit.git
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 theselect_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 thebundle
andselect_expert
configs if you are using a bundle endpoint.
You have the following options to set up your embedding model:
-
CPU embedding model (Option 1): In the config file, set the variable
type
inembedding_model
to"cpu"
. This will make use oflangchain_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
inembedding_model
to"sambastudio"
, and set the configsbatch_size
,bundle
andselect_expert
according to your SambaStudio endpoint.
- 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)
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
."
If you want to use a Python virtual environment:
-
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
-
Run the following command:
streamlit run streamlit/app.py --browser.gatherUsageStats false
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>"
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.
All the packages/tools are listed in the requirements.txt
file in the project directory.