Skip to content

A curated collection of practical AI projects implementing OCR systems, RAG, AI agents, and other AI use cases.

audit: fix multi_agent_financial_analyst - add env comment, docstrings, swap to Orq.ai with qwen3.6-flash, add demo screenshot, improve README

Tiioluwania0831bf9abe7
diff --git a/ai_agents/multi_agent_financial_analyst/.env.example b/ai_agents/multi_agent_financial_analyst/.env.example
new file mode 100644
index 0000000..c38f7bc
--- /dev/null
+++ b/ai_agents/multi_agent_financial_analyst/.env.example
@@ -0,0 +1,3 @@
+# Orq.ai API key used to authenticate alibaba/qwen3.6-flash LLM requests for the financial analyst agents.
+# Get your key by creating an account at https://orq.ai
+ORQ_API_KEY=your_orq_api_key_here
diff --git a/ai_agents/multi_agent_financial_analyst/README.md b/ai_agents/multi_agent_financial_analyst/README.md
index 75ae4d1..b6a90c6 100644
--- a/ai_agents/multi_agent_financial_analyst/README.md
+++ b/ai_agents/multi_agent_financial_analyst/README.md
@@ -1,7 +1,25 @@
+<a id="top"></a>
# 🎯 Multi-Agent AI Financial Analyst
A powerful multi-agent system that performs comprehensive stock analysis and generates detailed financial reports.
+## Demo
+
+![Demo](assets/demo.png)
+
+## Tech Stack
+
+- **Provider:** Orq.ai
+- **Model:** alibaba/qwen3.6-flash via Orq.ai
+- **Agent framework:** CrewAI
+- **UI:** Streamlit
+- **Market data:** yfinance
+
+## Prerequisites
+
+- Python 3.10 or higher
+- An Orq.ai account and API key, available at https://orq.ai
+
## Features
- Stock Analysis Agent: Performs thorough analysis of stocks using fundamental and technical indicators
@@ -23,9 +41,9 @@ A powerful multi-agent system that performs comprehensive stock analysis and gen
pip install -r requirements.txt
```
-3. Create a `.env` file in the root directory and add your SambaNova API key:
+3. Create a `.env` file in the root directory and add your Orq.ai API key:
```bash
-SAMBANOVA_API_KEY=your_api_key_here
+ORQ_API_KEY=your_orq_api_key_here
```
## Usage
@@ -63,4 +81,6 @@ Contributions are welcome! Please feel free to submit a Pull Request.
## License
-This project is licensed under the MIT License - see the LICENSE file for details.
\ No newline at end of file
+This project is licensed under the MIT License - see the LICENSE file for details.
+
+[Back to top](#top)
\ No newline at end of file
diff --git a/ai_agents/multi_agent_financial_analyst/assets/demo.png b/ai_agents/multi_agent_financial_analyst/assets/demo.png
new file mode 100644
index 0000000..7b987b9
Binary files /dev/null and b/ai_agents/multi_agent_financial_analyst/assets/demo.png differ
diff --git a/ai_agents/multi_agent_financial_analyst/financial_analyst.py b/ai_agents/multi_agent_financial_analyst/financial_analyst.py
index f7eba00..e5b4fb5 100644
--- a/ai_agents/multi_agent_financial_analyst/financial_analyst.py
+++ b/ai_agents/multi_agent_financial_analyst/financial_analyst.py
@@ -1,3 +1,4 @@
+"""Streamlit app that runs a multi-agent CrewAI pipeline to analyze a stock and generate a markdown investment report."""
import streamlit as st
import os
import pandas as pd
@@ -23,17 +24,20 @@ class StockAnalysis(BaseModel):
technical_indicators: dict
fundamental_metrics: dict
-# Initialize SambaNova LLM
+# Initialize Orq.ai LLM
@st.cache_resource
def load_llm():
+ """Create and cache the Orq.ai LLM client used by the agents."""
return LLM(
- model="sambanova/Llama-4-Maverick-17B-128E-Instruct",
- api_key=os.getenv("SAMBANOVA_API_KEY"),
+ model="openai/alibaba/qwen3.6-flash",
+ base_url="https://api.orq.ai/v3/router",
+ api_key=os.getenv("ORQ_API_KEY"),
temperature=0.3
)
# Create agents and tasks
def create_agents_and_tasks(symbol: str):
+ """Build the stock analysis and report writing agents, their tasks, and the crew that runs them for the given symbol."""
llm = load_llm()
# Initialize tools
@@ -170,16 +174,6 @@ st.title("🎯 Multi-Agent AI Financial Analyst")
# Sidebar
with st.sidebar:
st.header("Configuration")
-
- # API Key input
- api_key = st.text_input(
- "SambaNova API Key",
- type="password",
- value=os.getenv("SAMBANOVA_API_KEY", ""),
- help="Enter your SambaNova API key"
- )
- if api_key:
- os.environ["SAMBANOVA_API_KEY"] = api_key
# Stock Symbol input
symbol = st.text_input(
diff --git a/ai_agents/multi_agent_financial_analyst/requirements.txt b/ai_agents/multi_agent_financial_analyst/requirements.txt
index 6d51798..ad7ec33 100644
--- a/ai_agents/multi_agent_financial_analyst/requirements.txt
+++ b/ai_agents/multi_agent_financial_analyst/requirements.txt
@@ -4,4 +4,6 @@ python-dotenv>=1.0.0
pydantic>=2.5.0
yfinance>=0.2.35
pandas>=2.1.0
-plotly>=5.18.0
\ No newline at end of file
+plotly>=5.18.0
+openai>=1.0.0
+litellm>=1.0.0
\ No newline at end of file
diff --git a/ai_agents/multi_agent_financial_analyst/tools/financial_tools.py b/ai_agents/multi_agent_financial_analyst/tools/financial_tools.py
index 71885ca..b9f42da 100644
--- a/ai_agents/multi_agent_financial_analyst/tools/financial_tools.py
+++ b/ai_agents/multi_agent_financial_analyst/tools/financial_tools.py
@@ -9,6 +9,7 @@ class StockInput(BaseModel):
symbol: str = Field(..., description="The stock symbol to analyze (e.g., 'AAPL', 'GOOGL')")
class YFinanceStockTool(BaseTool):
+ """CrewAI tool that fetches real-time and historical stock data from Yahoo Finance."""
name: str = "stock_data_tool"
description: str = """
A tool for getting real-time and historical stock market data.
@@ -22,6 +23,7 @@ class YFinanceStockTool(BaseTool):
args_schema: type[BaseModel] = StockInput
def _run(self, symbol: str) -> str:
+ """Fetch latest trading data, 52-week range, and key financial metrics for the given stock symbol."""
try:
stock = yf.Ticker(symbol)
@@ -70,5 +72,6 @@ class YFinanceStockTool(BaseTool):
return f"Error fetching data for {symbol}: {str(e)}"
def _arun(self, symbol: str) -> str:
+ """Async counterpart of _run, not implemented for this tool."""
# Async implementation if needed
raise NotImplementedError("Async version not implemented")
\ No newline at end of file