This project is a Financial Report Generator that uses AI-powered analysis to create comprehensive financial reports based on company data and competitor information.
- Analyzes financial data from CSV files
- Researches and compares competitor performance
- Generates detailed financial reports
- Uses AI to provide insights and critiques
- Implements a multi-step workflow for report generation
- Provides a Streamlit-based web interface for easy interaction
- os
- pandas
- io
- dotenv
- langchain_openai
- langgraph
- tavily
- langchain_core
- pydantic
- streamlit
It's recommended to use a virtual environment for this project. Here's how to set it up:
-
Create a virtual environment:
python -m venv .venv
-
Activate the virtual environment:
- On Windows:
.venv\Scripts\activate
- On macOS and Linux:
source .venv/bin/activate
- On Windows:
-
Your command prompt should now show the name of your virtual environment, indicating it's active.
-
Install the required dependencies in the virtual environment:
pip install pandas python-dotenv langchain-openai langgraph tavily-python langchain-core pydantic streamlit
-
When you're done working on the project, you can deactivate the virtual environment:
deactivate
- Set up your environment variables:
- Create a
.env
file in the project root - Add your API keys:
OPENAI_API_KEY=your_openai_api_key TAVILY_API_KEY=your_tavily_api_key
- Create a
The Financial Report Generator uses a graph-based workflow to process and analyze financial data:
- Gather Financials: Extracts financial data from the provided CSV file.
- Analyze Data: Performs initial analysis on the financial data.
- Research Competitors: Gathers information about specified competitors.
- Compare Performance: Compares the company's performance with competitors.
- Collect Feedback: Generates feedback on the performance comparison.
- Research Critique: Performs additional research based on the feedback.
- Write Report: Generates the final financial report.
The workflow is implemented using langgraph
, allowing for conditional processing and multiple revision cycles.
Ensure your virtual environment is activated, then run the Streamlit app:
streamlit run finance_agent.py
In the web interface:
- Enter the analysis task.
- Specify competitors (comma-separated).
- Set the maximum number of revision cycles.
- Upload a CSV file containing the company's financial data.
- Click "Generate Report" to start the analysis process.
The app will display the progress of each step and present the final report when completed.
You can modify the system prompts for each step of the analysis by updating the corresponding prompt variables (e.g., GATHER_FINANCIALS_PROMPT
, ANALYZE_DATA_PROMPT
, etc.).