sofhiaazzhr Claude Opus 4.7 commited on
Commit
4bb7623
·
1 Parent(s): 6981ed3

fix(tools): align analyze_descriptive required args + normalize Timestamp in aggregate

Browse files
src/tools/analytics/aggregation.py CHANGED
@@ -28,7 +28,13 @@ class UnsupportedAggregationError(ValueError):
28
 
29
 
30
  def _clean(value: object) -> object:
31
- """Convert numpy scalars to plain Python so the output is JSON-clean."""
 
 
 
 
 
 
32
  if hasattr(value, "item"):
33
  return value.item()
34
  return value
 
28
 
29
 
30
  def _clean(value: object) -> object:
31
+ """Convert numpy/pandas scalars to plain Python so the output is JSON-clean.
32
+
33
+ A `group_by` over a datetime column yields `pandas.Timestamp` group keys,
34
+ which (like numpy scalars) are not JSON-serializable — normalise those too.
35
+ """
36
+ if isinstance(value, pd.Timestamp):
37
+ return value.isoformat()
38
  if hasattr(value, "item"):
39
  return value.item()
40
  return value
src/tools/registry.py CHANGED
@@ -41,7 +41,7 @@ ANALYTICS_TOOLS: list[ToolSpec] = [
41
  name="analyze_descriptive",
42
  category="analytics.descriptive",
43
  input_schema={
44
- "required": ["data"],
45
  "properties": {
46
  "data": {"type": "string"},
47
  "column_ids": {"type": "array"},
 
41
  name="analyze_descriptive",
42
  category="analytics.descriptive",
43
  input_schema={
44
+ "required": ["data", "column_ids"],
45
  "properties": {
46
  "data": {"type": "string"},
47
  "column_ids": {"type": "array"},