-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathschemas.py
More file actions
30 lines (22 loc) · 877 Bytes
/
schemas.py
File metadata and controls
30 lines (22 loc) · 877 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"""Pydantic models for structured agent input and output."""
from typing import Optional
from pydantic import BaseModel, Field
class DatasetInfo(BaseModel):
"""Metadata about the loaded dataset."""
filename: str
num_rows: int
num_columns: int
columns: list[str]
dtypes: dict[str, str]
sample_values: dict[str, list[str]]
class AnalysisResult(BaseModel):
"""Structured result from a data analysis query."""
query: str = Field(description="The original natural language query")
pandas_code: str = Field(description="The generated pandas code")
result_text: str = Field(description="Human-readable answer")
result_data: Optional[str] = Field(
default=None, description="Tabular result if applicable"
)
error: Optional[str] = Field(
default=None, description="Error message if execution failed"
)