aiecs 1.2.2__py3-none-any.whl → 1.3.3__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.

Potentially problematic release.


This version of aiecs might be problematic. Click here for more details.

Files changed (55) hide show
  1. aiecs/__init__.py +1 -1
  2. aiecs/llm/clients/vertex_client.py +22 -2
  3. aiecs/main.py +2 -2
  4. aiecs/scripts/tools_develop/README.md +111 -2
  5. aiecs/scripts/tools_develop/TOOL_AUTO_DISCOVERY.md +234 -0
  6. aiecs/scripts/tools_develop/validate_tool_schemas.py +80 -21
  7. aiecs/scripts/tools_develop/verify_tools.py +347 -0
  8. aiecs/tools/__init__.py +94 -30
  9. aiecs/tools/apisource/__init__.py +106 -0
  10. aiecs/tools/apisource/intelligence/__init__.py +20 -0
  11. aiecs/tools/apisource/intelligence/data_fusion.py +378 -0
  12. aiecs/tools/apisource/intelligence/query_analyzer.py +387 -0
  13. aiecs/tools/apisource/intelligence/search_enhancer.py +384 -0
  14. aiecs/tools/apisource/monitoring/__init__.py +12 -0
  15. aiecs/tools/apisource/monitoring/metrics.py +308 -0
  16. aiecs/tools/apisource/providers/__init__.py +114 -0
  17. aiecs/tools/apisource/providers/base.py +684 -0
  18. aiecs/tools/apisource/providers/census.py +412 -0
  19. aiecs/tools/apisource/providers/fred.py +575 -0
  20. aiecs/tools/apisource/providers/newsapi.py +402 -0
  21. aiecs/tools/apisource/providers/worldbank.py +346 -0
  22. aiecs/tools/apisource/reliability/__init__.py +14 -0
  23. aiecs/tools/apisource/reliability/error_handler.py +362 -0
  24. aiecs/tools/apisource/reliability/fallback_strategy.py +420 -0
  25. aiecs/tools/apisource/tool.py +814 -0
  26. aiecs/tools/apisource/utils/__init__.py +12 -0
  27. aiecs/tools/apisource/utils/validators.py +343 -0
  28. aiecs/tools/langchain_adapter.py +95 -17
  29. aiecs/tools/search_tool/__init__.py +102 -0
  30. aiecs/tools/search_tool/analyzers.py +583 -0
  31. aiecs/tools/search_tool/cache.py +280 -0
  32. aiecs/tools/search_tool/constants.py +127 -0
  33. aiecs/tools/search_tool/context.py +219 -0
  34. aiecs/tools/search_tool/core.py +773 -0
  35. aiecs/tools/search_tool/deduplicator.py +123 -0
  36. aiecs/tools/search_tool/error_handler.py +257 -0
  37. aiecs/tools/search_tool/metrics.py +375 -0
  38. aiecs/tools/search_tool/rate_limiter.py +177 -0
  39. aiecs/tools/search_tool/schemas.py +297 -0
  40. aiecs/tools/statistics/data_loader_tool.py +2 -2
  41. aiecs/tools/statistics/data_transformer_tool.py +1 -1
  42. aiecs/tools/task_tools/__init__.py +8 -8
  43. aiecs/tools/task_tools/report_tool.py +1 -1
  44. aiecs/tools/tool_executor/__init__.py +2 -0
  45. aiecs/tools/tool_executor/tool_executor.py +284 -14
  46. aiecs/utils/__init__.py +11 -0
  47. aiecs/utils/cache_provider.py +698 -0
  48. aiecs/utils/execution_utils.py +5 -5
  49. {aiecs-1.2.2.dist-info → aiecs-1.3.3.dist-info}/METADATA +1 -1
  50. {aiecs-1.2.2.dist-info → aiecs-1.3.3.dist-info}/RECORD +54 -22
  51. aiecs/tools/task_tools/search_tool.py +0 -1123
  52. {aiecs-1.2.2.dist-info → aiecs-1.3.3.dist-info}/WHEEL +0 -0
  53. {aiecs-1.2.2.dist-info → aiecs-1.3.3.dist-info}/entry_points.txt +0 -0
  54. {aiecs-1.2.2.dist-info → aiecs-1.3.3.dist-info}/licenses/LICENSE +0 -0
  55. {aiecs-1.2.2.dist-info → aiecs-1.3.3.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,114 @@
1
+ """
2
+ API Providers Module
3
+
4
+ Contains all API provider implementations for the APISource tool.
5
+ """
6
+
7
+ from aiecs.tools.apisource.providers.base import BaseAPIProvider, RateLimiter
8
+ from aiecs.tools.apisource.providers.fred import FREDProvider
9
+ from aiecs.tools.apisource.providers.worldbank import WorldBankProvider
10
+ from aiecs.tools.apisource.providers.newsapi import NewsAPIProvider
11
+ from aiecs.tools.apisource.providers.census import CensusProvider
12
+
13
+ import logging
14
+ from typing import Dict, List, Optional, Type, Any
15
+
16
+ logger = logging.getLogger(__name__)
17
+
18
+ # Global provider registry
19
+ PROVIDER_REGISTRY: Dict[str, Type[BaseAPIProvider]] = {}
20
+ PROVIDER_INSTANCES: Dict[str, BaseAPIProvider] = {}
21
+
22
+
23
+ def register_provider(provider_class: Type[BaseAPIProvider]):
24
+ """
25
+ Register a provider class.
26
+
27
+ Args:
28
+ provider_class: Provider class to register
29
+ """
30
+ # Instantiate to get name
31
+ temp_instance = provider_class()
32
+ provider_name = temp_instance.name
33
+
34
+ PROVIDER_REGISTRY[provider_name] = provider_class
35
+ logger.debug(f"Registered provider: {provider_name}")
36
+
37
+
38
+ def get_provider(name: str, config: Optional[Dict] = None) -> BaseAPIProvider:
39
+ """
40
+ Get a provider instance by name.
41
+
42
+ Args:
43
+ name: Provider name
44
+ config: Optional configuration for the provider
45
+
46
+ Returns:
47
+ Provider instance
48
+
49
+ Raises:
50
+ ValueError: If provider is not registered
51
+ """
52
+ if name not in PROVIDER_REGISTRY:
53
+ raise ValueError(
54
+ f"Provider '{name}' not found. "
55
+ f"Available providers: {', '.join(PROVIDER_REGISTRY.keys())}"
56
+ )
57
+
58
+ # Return cached instance or create new one with config
59
+ if config is None and name in PROVIDER_INSTANCES:
60
+ return PROVIDER_INSTANCES[name]
61
+
62
+ provider_instance = PROVIDER_REGISTRY[name](config)
63
+
64
+ if config is None:
65
+ PROVIDER_INSTANCES[name] = provider_instance
66
+
67
+ return provider_instance
68
+
69
+
70
+ def list_providers() -> List[Dict[str, Any]]:
71
+ """
72
+ List all registered providers.
73
+
74
+ Returns:
75
+ List of provider metadata dictionaries
76
+ """
77
+ providers = []
78
+ for name, provider_class in PROVIDER_REGISTRY.items():
79
+ try:
80
+ # Get or create instance to access metadata
81
+ provider = get_provider(name)
82
+ providers.append(provider.get_metadata())
83
+ except Exception as e:
84
+ logger.warning(f"Failed to get metadata for provider {name}: {e}")
85
+ providers.append({
86
+ 'name': name,
87
+ 'description': 'Provider metadata unavailable',
88
+ 'operations': [],
89
+ 'error': str(e)
90
+ })
91
+
92
+ return providers
93
+
94
+
95
+ # Auto-register all providers
96
+ register_provider(FREDProvider)
97
+ register_provider(WorldBankProvider)
98
+ register_provider(NewsAPIProvider)
99
+ register_provider(CensusProvider)
100
+
101
+
102
+ __all__ = [
103
+ 'BaseAPIProvider',
104
+ 'RateLimiter',
105
+ 'FREDProvider',
106
+ 'WorldBankProvider',
107
+ 'NewsAPIProvider',
108
+ 'CensusProvider',
109
+ 'register_provider',
110
+ 'get_provider',
111
+ 'list_providers',
112
+ 'PROVIDER_REGISTRY'
113
+ ]
114
+