From 1e105a3f4bcebb1ac9f6ed8319b1c88166c21208 Mon Sep 17 00:00:00 2001 From: Kaushik Yadav Date: Tue, 25 Nov 2025 23:55:21 +0530 Subject: [PATCH] fix : Improve fallback vendor result collection and logging Enhanced fallback vendor handling by collecting results from all successful attempts and providing detailed logging. --- tradingagents/dataflows/interface.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/tradingagents/dataflows/interface.py b/tradingagents/dataflows/interface.py index 82a9c3d7..4eba8641 100644 --- a/tradingagents/dataflows/interface.py +++ b/tradingagents/dataflows/interface.py @@ -208,15 +208,27 @@ def route_to_vendor(method: str, *args, **kwargs): print(f"DEBUG: Trying FALLBACK vendor '{vendor}'") + vendor_results = [] for impl_func in vendor_methods: try: result = impl_func(*args, **kwargs) + vendor_results.append(result) print(f"SUCCESS: Fallback vendor '{vendor}' succeeded via {impl_func.__name__}") - return result - + except AlphaVantageRateLimitError as e: + print(f"RATE_LIMIT: Fallback vendor '{vendor}' exceeded rate limit, trying next fallback vendor.") + print(f"DEBUG: {e}") + vendor_results = [] # Discard partial results for this vendor + break except Exception as e: - print(f"FAILED: Fallback vendor '{vendor}' - {e}") + print(f"FAILED: Fallback vendor '{vendor}' via {impl_func.__name__} - {e}") continue + if vendor_results: + print(f"SUCCESS: Fallback vendor '{vendor}' succeeded with {len(vendor_results)} result(s).") + if len(vendor_results) == 1: + return vendor_results[0] + else: + return '\n'.join(str(r) for r in vendor_results) + # If all vendors fail raise RuntimeError(f"All vendors failed for method '{method}'")