cite-agent 1.2.3__py3-none-any.whl → 1.2.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cite_agent/__version__.py +1 -0
- cite_agent/auth.py +1 -1
- cite_agent/cli.py +1 -1
- cite_agent/enhanced_ai_agent.py +84 -36
- cite_agent/updater.py +9 -6
- {cite_agent-1.2.3.dist-info → cite_agent-1.2.5.dist-info}/METADATA +1 -1
- {cite_agent-1.2.3.dist-info → cite_agent-1.2.5.dist-info}/RECORD +11 -10
- {cite_agent-1.2.3.dist-info → cite_agent-1.2.5.dist-info}/WHEEL +0 -0
- {cite_agent-1.2.3.dist-info → cite_agent-1.2.5.dist-info}/entry_points.txt +0 -0
- {cite_agent-1.2.3.dist-info → cite_agent-1.2.5.dist-info}/licenses/LICENSE +0 -0
- {cite_agent-1.2.3.dist-info → cite_agent-1.2.5.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.2.5"
|
cite_agent/auth.py
CHANGED
|
@@ -25,7 +25,7 @@ class AuthManager:
|
|
|
25
25
|
self.config_dir.mkdir(exist_ok=True)
|
|
26
26
|
|
|
27
27
|
self.session_file = self.config_dir / "session.json"
|
|
28
|
-
self.api_base = os.getenv("NOCTURNAL_AUTH_API", "https://api.
|
|
28
|
+
self.api_base = os.getenv("NOCTURNAL_AUTH_API", "https://cite-agent-api-720dfadd602c.herokuapp.com")
|
|
29
29
|
|
|
30
30
|
def login(self, email: str, password: str) -> Dict:
|
|
31
31
|
"""
|
cite_agent/cli.py
CHANGED
cite_agent/enhanced_ai_agent.py
CHANGED
|
@@ -2458,6 +2458,47 @@ class EnhancedNocturnalAgent:
|
|
|
2458
2458
|
"analysis_mode": analysis_mode # NEW: qualitative, quantitative, or mixed
|
|
2459
2459
|
}
|
|
2460
2460
|
|
|
2461
|
+
def _is_query_too_vague_for_apis(self, question: str) -> bool:
|
|
2462
|
+
"""
|
|
2463
|
+
Detect if query is too vague to warrant API calls
|
|
2464
|
+
Returns True if we should skip APIs and just ask clarifying questions
|
|
2465
|
+
"""
|
|
2466
|
+
question_lower = question.lower()
|
|
2467
|
+
|
|
2468
|
+
# Pattern 1: Multiple years without SPECIFIC topic (e.g., "2008, 2015, 2019")
|
|
2469
|
+
import re
|
|
2470
|
+
years_pattern = r'\b(19\d{2}|20\d{2})\b'
|
|
2471
|
+
years = re.findall(years_pattern, question)
|
|
2472
|
+
if len(years) >= 2:
|
|
2473
|
+
# Multiple years - check if there's a SPECIFIC topic beyond just "papers on"
|
|
2474
|
+
# Generic terms that don't add specificity
|
|
2475
|
+
generic_terms = ['papers', 'about', 'on', 'regarding', 'concerning', 'related to']
|
|
2476
|
+
# Remove generic terms and check what's left
|
|
2477
|
+
words = question_lower.split()
|
|
2478
|
+
content_words = [w for w in words if w not in generic_terms and not re.match(r'\d{4}', w)]
|
|
2479
|
+
# If fewer than 2 meaningful content words, it's too vague
|
|
2480
|
+
if len(content_words) < 2:
|
|
2481
|
+
return True # Too vague: "papers on 2008, 2015, 2019" needs topic
|
|
2482
|
+
|
|
2483
|
+
# Pattern 2: Market share without market specified
|
|
2484
|
+
if 'market share' in question_lower:
|
|
2485
|
+
market_indicators = ['analytics', 'software', 'government', 'data', 'cloud', 'sector', 'industry']
|
|
2486
|
+
if not any(indicator in question_lower for indicator in market_indicators):
|
|
2487
|
+
return True # Too vague: needs market specification
|
|
2488
|
+
|
|
2489
|
+
# Pattern 3: Comparison without metric (compare X and Y)
|
|
2490
|
+
if any(word in question_lower for word in ['compare', 'versus', 'vs', 'vs.']):
|
|
2491
|
+
metric_indicators = ['revenue', 'market cap', 'sales', 'growth', 'profit', 'valuation']
|
|
2492
|
+
if not any(indicator in question_lower for indicator in metric_indicators):
|
|
2493
|
+
return True # Too vague: needs metric specification
|
|
2494
|
+
|
|
2495
|
+
# Pattern 4: Ultra-short queries without specifics (< 4 words)
|
|
2496
|
+
word_count = len(question.split())
|
|
2497
|
+
if word_count <= 3 and '?' in question:
|
|
2498
|
+
return True # Too short and questioning - likely needs clarification
|
|
2499
|
+
|
|
2500
|
+
return False # Query seems specific enough for API calls
|
|
2501
|
+
|
|
2461
2502
|
async def process_request(self, request: ChatRequest) -> ChatResponse:
|
|
2462
2503
|
"""Process request with full AI capabilities and API integration"""
|
|
2463
2504
|
try:
|
|
@@ -2474,48 +2515,55 @@ class EnhancedNocturnalAgent:
|
|
|
2474
2515
|
if debug_mode:
|
|
2475
2516
|
print(f"🔍 Request analysis: {request_analysis}")
|
|
2476
2517
|
|
|
2518
|
+
# Check if query is too vague - skip API calls to save tokens
|
|
2519
|
+
is_vague = self._is_query_too_vague_for_apis(request.question)
|
|
2520
|
+
if debug_mode and is_vague:
|
|
2521
|
+
print(f"🔍 Query detected as VAGUE - skipping API calls, asking for clarification")
|
|
2522
|
+
|
|
2477
2523
|
# Call appropriate APIs (Archive, FinSight) - BOTH production and dev mode
|
|
2478
2524
|
api_results = {}
|
|
2479
2525
|
tools_used = []
|
|
2480
2526
|
|
|
2481
|
-
#
|
|
2482
|
-
if
|
|
2483
|
-
|
|
2484
|
-
if "
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
if "finsight" in request_analysis.get("apis", []):
|
|
2490
|
-
tickers = self._extract_tickers_from_text(request.question)
|
|
2491
|
-
if not tickers:
|
|
2492
|
-
# Try common company name mappings
|
|
2493
|
-
question_lower = request.question.lower()
|
|
2494
|
-
if "apple" in question_lower:
|
|
2495
|
-
tickers = ["AAPL"]
|
|
2496
|
-
elif "tesla" in question_lower:
|
|
2497
|
-
tickers = ["TSLA"]
|
|
2498
|
-
elif "microsoft" in question_lower:
|
|
2499
|
-
tickers = ["MSFT"]
|
|
2500
|
-
elif "google" in question_lower or "alphabet" in question_lower:
|
|
2501
|
-
tickers = ["GOOGL"]
|
|
2502
|
-
|
|
2503
|
-
if debug_mode:
|
|
2504
|
-
print(f"🔍 Extracted tickers: {tickers}")
|
|
2527
|
+
# Skip API calls if query is too vague
|
|
2528
|
+
if not is_vague:
|
|
2529
|
+
# Archive API for research
|
|
2530
|
+
if "archive" in request_analysis.get("apis", []):
|
|
2531
|
+
result = await self.search_academic_papers(request.question, 5)
|
|
2532
|
+
if "error" not in result:
|
|
2533
|
+
api_results["research"] = result
|
|
2534
|
+
tools_used.append("archive_api")
|
|
2505
2535
|
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2536
|
+
# FinSight API for financial data
|
|
2537
|
+
if "finsight" in request_analysis.get("apis", []):
|
|
2538
|
+
tickers = self._extract_tickers_from_text(request.question)
|
|
2539
|
+
if not tickers:
|
|
2540
|
+
# Try common company name mappings
|
|
2541
|
+
question_lower = request.question.lower()
|
|
2542
|
+
if "apple" in question_lower:
|
|
2543
|
+
tickers = ["AAPL"]
|
|
2544
|
+
elif "tesla" in question_lower:
|
|
2545
|
+
tickers = ["TSLA"]
|
|
2546
|
+
elif "microsoft" in question_lower:
|
|
2547
|
+
tickers = ["MSFT"]
|
|
2548
|
+
elif "google" in question_lower or "alphabet" in question_lower:
|
|
2549
|
+
tickers = ["GOOGL"]
|
|
2550
|
+
|
|
2511
2551
|
if debug_mode:
|
|
2512
|
-
print(f"🔍
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2552
|
+
print(f"🔍 Extracted tickers: {tickers}")
|
|
2553
|
+
|
|
2554
|
+
if tickers:
|
|
2555
|
+
# Call FinSight with proper endpoint format
|
|
2556
|
+
if debug_mode:
|
|
2557
|
+
print(f"🔍 Calling FinSight API: calc/{tickers[0]}/revenue")
|
|
2558
|
+
financial_data = await self._call_finsight_api(f"calc/{tickers[0]}/revenue")
|
|
2559
|
+
if debug_mode:
|
|
2560
|
+
print(f"🔍 FinSight returned: {list(financial_data.keys()) if financial_data else None}")
|
|
2561
|
+
if financial_data and "error" not in financial_data:
|
|
2562
|
+
api_results["financial"] = financial_data
|
|
2563
|
+
tools_used.append("finsight_api")
|
|
2564
|
+
else:
|
|
2565
|
+
if debug_mode and financial_data:
|
|
2566
|
+
print(f"🔍 FinSight error: {financial_data.get('error')}")
|
|
2519
2567
|
|
|
2520
2568
|
# PRODUCTION MODE: Send to backend LLM with API results
|
|
2521
2569
|
if self.client is None:
|
cite_agent/updater.py
CHANGED
|
@@ -54,6 +54,13 @@ class NocturnalUpdater:
|
|
|
54
54
|
except Exception:
|
|
55
55
|
pass
|
|
56
56
|
|
|
57
|
+
# Try version file
|
|
58
|
+
try:
|
|
59
|
+
from cite_agent.__version__ import __version__
|
|
60
|
+
return __version__
|
|
61
|
+
except Exception:
|
|
62
|
+
pass
|
|
63
|
+
|
|
57
64
|
# Fallback to pkg_resources (deprecated)
|
|
58
65
|
if pkg_resources:
|
|
59
66
|
try:
|
|
@@ -61,12 +68,8 @@ class NocturnalUpdater:
|
|
|
61
68
|
except Exception:
|
|
62
69
|
pass
|
|
63
70
|
|
|
64
|
-
# Last resort
|
|
65
|
-
|
|
66
|
-
import cite_agent
|
|
67
|
-
return getattr(cite_agent, '__version__', '1.0.0')
|
|
68
|
-
except ImportError:
|
|
69
|
-
return "1.0.0"
|
|
71
|
+
# Last resort
|
|
72
|
+
return "1.0.0"
|
|
70
73
|
|
|
71
74
|
def check_for_updates(self) -> Optional[Dict[str, Any]]:
|
|
72
75
|
"""Check if updates are available"""
|
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
cite_agent/__init__.py,sha256=wAXV2v8nNOmIAd0rh8196ItBl9hHWBVOBl5Re4VB77I,1645
|
|
2
|
+
cite_agent/__version__.py,sha256=jBmZf3HLbiQlWiolOsAA6J5-BbxXD2bqFqEqDH3lfqo,22
|
|
2
3
|
cite_agent/account_client.py,sha256=yLuzhIJoIZuXHXGbaVMzDxRATQwcy-wiaLnUrDuwUhI,5725
|
|
3
4
|
cite_agent/agent_backend_only.py,sha256=H4DH4hmKhT0T3rQLAb2xnnJVjxl3pOZaljL9r6JndFY,6314
|
|
4
5
|
cite_agent/ascii_plotting.py,sha256=lk8BaECs6fmjtp4iH12G09-frlRehAN7HLhHt2crers,8570
|
|
5
|
-
cite_agent/auth.py,sha256=
|
|
6
|
+
cite_agent/auth.py,sha256=YtoGXKwcLkZQbop37iYYL9BzRWBRPlt_D9p71VGViS4,9833
|
|
6
7
|
cite_agent/backend_only_client.py,sha256=WqLF8x7aXTro2Q3ehqKMsdCg53s6fNk9Hy86bGxqmmw,2561
|
|
7
|
-
cite_agent/cli.py,sha256=
|
|
8
|
+
cite_agent/cli.py,sha256=1yBfLhOuELx4OAQb7VKm9hC6VWF6H62SLWK8qblyHLQ,31858
|
|
8
9
|
cite_agent/cli_conversational.py,sha256=RAmgRNRyB8gQ8QLvWU-Tt23j2lmA34rQNT5F3_7SOq0,11141
|
|
9
10
|
cite_agent/cli_enhanced.py,sha256=EAaSw9qtiYRWUXF6_05T19GCXlz9cCSz6n41ASnXIPc,7407
|
|
10
11
|
cite_agent/cli_workflow.py,sha256=4oS_jW9D8ylovXbEFdsyLQONt4o0xxR4Xatfcc4tnBs,11641
|
|
11
12
|
cite_agent/dashboard.py,sha256=VGV5XQU1PnqvTsxfKMcue3j2ri_nvm9Be6O5aVays_w,10502
|
|
12
|
-
cite_agent/enhanced_ai_agent.py,sha256=
|
|
13
|
+
cite_agent/enhanced_ai_agent.py,sha256=TEj6qNCqidAAz5wzlLYR4enqRo0XCn3g3TOv34thIx0,149752
|
|
13
14
|
cite_agent/rate_limiter.py,sha256=-0fXx8Tl4zVB4O28n9ojU2weRo-FBF1cJo9Z5jC2LxQ,10908
|
|
14
15
|
cite_agent/session_manager.py,sha256=jD2v_owu7m0tS_Qly0g2XGnqupfE8Dv9sqkeoAeidj0,7999
|
|
15
16
|
cite_agent/setup_config.py,sha256=kNZNr5cZmCXr43rGWNenNJXZ1Kfz7PrdLXpAqxM7WgM,16404
|
|
16
17
|
cite_agent/streaming_ui.py,sha256=N6TWOo7GVQ_Ynfw73JCfrdGcLIU-PwbS3GbsHQHegmg,7810
|
|
17
18
|
cite_agent/telemetry.py,sha256=55kXdHvI24ZsEkbFtihcjIfJt2oiSXcEpLzTxQ3KCdQ,2916
|
|
18
19
|
cite_agent/ui.py,sha256=r1OAeY3NSeqhAjJYmEBH9CaennBuibFAz1Mur6YF80E,6134
|
|
19
|
-
cite_agent/updater.py,sha256=
|
|
20
|
+
cite_agent/updater.py,sha256=28Kgs6cKEB-3d-Eri411hYHv6CgywMHV0718XFw0PqI,8479
|
|
20
21
|
cite_agent/web_search.py,sha256=j-BRhT8EBC6BEPgACQPeVwB1SVGKDz4XLM7sowacvSc,6587
|
|
21
22
|
cite_agent/workflow.py,sha256=a0YC0Mzz4or1C5t2gZcuJBQ0uMOZrooaI8eLu2kkI0k,15086
|
|
22
23
|
cite_agent/workflow_integration.py,sha256=A9ua0DN5pRtuU0cAwrUTGvqt2SXKhEHQbrHx16EGnDM,10910
|
|
23
|
-
cite_agent-1.2.
|
|
24
|
+
cite_agent-1.2.5.dist-info/licenses/LICENSE,sha256=XJkyO4IymhSUniN1ENY6lLrL2729gn_rbRlFK6_Hi9M,1074
|
|
24
25
|
src/__init__.py,sha256=0eEpjRfjRjOTilP66y-AbGNslBsVYr_clE-bZUzsX7s,40
|
|
25
26
|
src/services/__init__.py,sha256=pTGLCH_84mz4nGtYMwQES5w-LzoSulUtx_uuNM6r-LA,4257
|
|
26
27
|
src/services/simple_enhanced_main.py,sha256=IJoOplCqcVUg3GvN_BRyAhpGrLm_WEPy2jmHcNCY6R0,9257
|
|
@@ -47,8 +48,8 @@ src/services/research_service/synthesizer.py,sha256=lCcu37PWhWVNphHKaJJDIC-JQ5OI
|
|
|
47
48
|
src/services/search_service/__init__.py,sha256=UZFXdd7r6wietQ2kESXEyGffdfBbpghquecQde7auF4,137
|
|
48
49
|
src/services/search_service/indexer.py,sha256=u3-uwdAfmahWWsdebDF9i8XIyp7YtUMIHzlmBLBnPPM,7252
|
|
49
50
|
src/services/search_service/search_engine.py,sha256=S9HqQ_mk-8W4d4MUOgBbEGQGV29-eSuceSFvVb4Xk-k,12500
|
|
50
|
-
cite_agent-1.2.
|
|
51
|
-
cite_agent-1.2.
|
|
52
|
-
cite_agent-1.2.
|
|
53
|
-
cite_agent-1.2.
|
|
54
|
-
cite_agent-1.2.
|
|
51
|
+
cite_agent-1.2.5.dist-info/METADATA,sha256=DJIKRMBV4lpjGLNH0EQTfuI02GHSsRoZ3yjVO3dKGN8,11657
|
|
52
|
+
cite_agent-1.2.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
53
|
+
cite_agent-1.2.5.dist-info/entry_points.txt,sha256=bJ0u28nFIxQKH1PWQ2ak4PV-FAjhoxTC7YADEdDenFw,83
|
|
54
|
+
cite_agent-1.2.5.dist-info/top_level.txt,sha256=TgOFqJTIy8vDZuOoYA2QgagkqZtfhM5Acvt_IsWzAKo,15
|
|
55
|
+
cite_agent-1.2.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|