How austin-starks/finangpt works
Main Components
• Command Line / Entry Point: The process is started with either chat.py (which accepts a --use-ollama flag) or main.py. This is the application’s entry point that parses input and triggers further execution.
• API Communication Modules:
• simfin.py: Handles interactions with the SimFin API to retrieve financial data.
• openai.py: Contains the logic to call the OpenAI API to generate text analysis.
• ollama.py: Provides the functionality to call the Ollama open-source model as an alternative to OpenAI.
• Configuration & Environment Handling: The application relies on environment variables (loaded from a .env file) for keys and settings. Although not explicitly a “module,” this is a key cross-cutting concern.
• Business Logic: The main script (likely chat.py or main.py) ties together the flow: it retrieves data, chooses the analysis service based on provided flags, and produces formatted financial insights.
Relationships and Interactions
• The entry point (chat.py/main.py) starts the process and loads configuration.
• Simultaneously, simfin.py is used to query and pull the financial information for the targeted company.
• Once the data is retrieved, it is passed along to the analysis module, which then formats and returns the analysis (summary, recommendations, etc.). The output is then presented to the user (console output).
Architectural Patterns and Design Principles
• Modularity: Despite the relatively flat structure, the system is organized into separate files handling different responsibilities (data retrieval vs. analysis generation).
• Clear Separation of Concerns: Each module is focused on a single external service, which makes the selection between OpenAI and Ollama straightforward.
• External Integration: The design shows integration with external APIs (SimFin, OpenAI, and optionally Ollama) and illustrates how environmental configuration drives the integration process.