feat: add .env support for API keys, update docs, and add python-dotenv

This commit is contained in:
Jiayou Chao 2025-07-11 13:35:21 -04:00
parent a438acdbbd
commit 6b03425e8c
4 changed files with 26 additions and 6 deletions

14
.env.sample Normal file
View File

@ -0,0 +1,14 @@
# Finnhub API Key
FINNHUB_API_KEY="YOUR_FINNHUB_API_KEY"
# OpenAI API Key
OPENAI_API_KEY="YOUR_OPENAI_API_KEY"
# Data directory
DATA_DIR="/Users/yluo/Documents/Code/ScAI/FR1-data"
# LLM settings
LLM_PROVIDER="openai"
DEEP_THINK_LLM="o4-mini"
QUICK_THINK_LLM="gpt-4o-mini"
BACKEND_URL="https://api.openai.com/v1"

View File

@ -114,15 +114,15 @@ pip install -r requirements.txt
### Required APIs
You will also need the FinnHub API for financial data. All of our code is implemented with the free tier.
You will need API keys from FinnHub and OpenAI. You can provide them by creating a `.env` file in the root of the project. Rename the `.env.sample` file to `.env` and add your API keys:
```bash
export FINNHUB_API_KEY=$YOUR_FINNHUB_API_KEY
# .env
FINNHUB_API_KEY="YOUR_FINNHUB_API_KEY"
OPENAI_API_KEY="YOUR_OPENAI_API_KEY"
```
You will need the OpenAI API for all the agents.
```bash
export OPENAI_API_KEY=$YOUR_OPENAI_API_KEY
```
The application will automatically load these keys. Alternatively, you can still use environment variables if you prefer.
### CLI Usage

View File

@ -24,3 +24,5 @@ rich
questionary
langchain_anthropic
langchain-google-genai
python-dotenv

View File

@ -1,4 +1,8 @@
import os
from dotenv import load_dotenv
# Load environment variables from .env file
load_dotenv()
DEFAULT_CONFIG = {
"project_dir": os.path.abspath(os.path.join(os.path.dirname(__file__), ".")),