cicboy commited on
Commit
d872892
·
1 Parent(s): 47d4895

Update analytics_tool.py

Browse files
Files changed (1) hide show
  1. tools/analytics_tool.py +12 -10
tools/analytics_tool.py CHANGED
@@ -1,23 +1,25 @@
1
  from crewai.tools import BaseTool
2
  from pydantic import BaseModel, Field
 
3
 
4
 
5
  # ---------- Input Schema ----------
6
  class AnalyticsInput(BaseModel):
7
- market_data: dict = Field(..., description="Structured JSON from MarketDataTool")
8
- historical_data: dict = Field(..., description="Structured JSON from HistoricalDataTool")
9
- sentiment_data: dict = Field(..., description="Structured JSON from SentimentTool")
10
 
11
 
12
  # ---------- Tool ----------
13
  class AnalyticsTool(BaseTool):
14
- name = "analytics_tool"
15
- description = (
16
- "Aggregates structured market, historical, and sentiment data to produce "
17
- "quantitative indicators including pct_change, volatility, trend, sentiment, "
18
- "alignment consistency, and a composite confidence score."
19
- )
20
- args_schema = AnalyticsInput
 
21
 
22
  def _run(self, market_data: dict, historical_data: dict, sentiment_data: dict) -> dict:
23
  try:
 
1
  from crewai.tools import BaseTool
2
  from pydantic import BaseModel, Field
3
+ from typing import Dict, Any, Type
4
 
5
 
6
  # ---------- Input Schema ----------
7
  class AnalyticsInput(BaseModel):
8
+ market_data: str | Dict[str, Any] = Field(..., description="Structured JSON from MarketDataTool")
9
+ historical_data: str | Dict[str, Any] = Field(..., description="Structured JSON from HistoricalDataTool")
10
+ sentiment_data: str | Dict[str, Any] = Field(..., description="Structured JSON from SentimentTool")
11
 
12
 
13
  # ---------- Tool ----------
14
  class AnalyticsTool(BaseTool):
15
+ args_schema: Type[BaseModel] = AnalyticsInput
16
+ class Config:
17
+ name = "analytics_tool"
18
+ description = (
19
+ "Aggregates structured market, historical, and sentiment data to produce "
20
+ "quantitative indicators including pct_change, volatility, trend, sentiment, "
21
+ "alignment consistency, and a composite confidence score."
22
+ )
23
 
24
  def _run(self, market_data: dict, historical_data: dict, sentiment_data: dict) -> dict:
25
  try: