A curated collection of practical AI projects implementing OCR systems, RAG, AI agents, and other AI use cases.
resolved conflicts with main
Omee979dc7e72c607a
diff --cc finagent/__pycache__/financial_agents.cpython-313.pycindex 4c044dd,1c14e10..2ef7b9eBinary files differdiff --cc finagent/financial_agents.pyindex 451e3ab,b2f306e..4f293e8--- a/finagent/financial_agents.py+++ b/finagent/financial_agents.py@@@ -1,10 -1,75 +1,9 @@@-#!/usr/bin/env python3--import json+import osimport re-from dataclasses import dataclass, field-from typing import List, Optional, Dict-import logging-import sys--try:- import google.generativeai as genai- from google.generativeai.types import HarmCategory, HarmBlockThreshold- import yfinance as yf- import pandas as pd-except ImportError as e:- print(f"Required packages not installed: {e}\nInstall with: pip install google-generativeai yfinance pandas", file=sys.stderr)- raise--logger = logging.getLogger(__name__)--@dataclass-class QueryInfo:- symbol: str- analysis_type: str = "comprehensive"- time_period: str = "6m"- additional_symbols: List[str] = field(default_factory=list)- indicators: List[str] = field(default_factory=list)--@dataclass-class NewsItem:- title: str- summary: str- url: str--@dataclass-class AnalysisResult:- query: QueryInfo- insights: str- code: str- recommendations: str- news: List[NewsItem] = field(default_factory=list)--class FinancialTools:- def __init__(self, firecrawl_api_key: Optional[str] = None):- self.firecrawl_api_key = firecrawl_api_key-- def get_stock_data(self, symbol: str, period: str = "6mo") -> pd.DataFrame:- try:- return yf.Ticker(symbol).history(period=period)- except Exception as e:- logger.error(f"Error fetching data for {symbol}: {e}")- return pd.DataFrame()-- def get_stock_info(self, symbol: str) -> Dict:- try:- return yf.Ticker(symbol).info- except Exception as e:- logger.error(f"Error fetching info for {symbol}: {e}")- return {}-- def get_stock_news(self, symbol: str, limit: int = 5) -> List[Dict]:- try:- ticker = yf.Ticker(symbol)- news = getattr(ticker, 'news', [])- return [{'title': item.get('title', item.get('summary', '')),- 'url': item.get('link') or item.get('url', ''),- 'content': item.get('summary') or item.get('content', '')}- for item in news[:limit] if isinstance(item, dict)]- except Exception as e:- logger.error(f"Error fetching news for {symbol}: {e}")- return []+import json+import yfinance as yf+import google.generativeai as genai-def _normalize_period(period: str) -> str:if not period:return '6mo'