Skip to content

Commit 23e977d

Browse files
committed
tidy
1 parent 944943d commit 23e977d

File tree

3 files changed

+11
-21
lines changed

3 files changed

+11
-21
lines changed

vizro-ai/src/vizro_ai/_vizro_ai.py

-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ def __init__(self, model: Optional[Union[BaseChatModel, str]] = None):
4848
4949
"""
5050
self.model = _get_llm_model(model=model)
51-
# self.components_instances = {} # TODO: This line is not used anywhere?
52-
5351
self.chart_type_enum = create_chart_type_enum()
5452
self.chart_type_examples = [member.value for member in self.chart_type_enum]
5553
print(f"Available chart types: {self.chart_type_examples}")

vizro-ai/src/vizro_ai/plot/_response_models.py

+11-5
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,17 @@ def __new__(
231231
validate_code: bool = True,
232232
chart_type_examples: Optional[list[str]] = None,
233233
) -> type[BaseChartPlan]:
234-
"""Creates a chart plan model with additional validation."""
235-
# Use provided examples or fallback to defaults
234+
"""Creates a chart plan model with additional enrichments.
235+
236+
Args:
237+
data_frame: DataFrame to use for validation.
238+
chart_plan: Chart plan model to run extended validation against. Defaults to ChartPlan.
239+
validate_code: Whether to validate the code.
240+
chart_type_examples: List of chart type examples.
241+
242+
Returns:
243+
Chart plan model with additional enrichments.
244+
"""
236245
examples = chart_type_examples or []
237246
description = f"""
238247
{chart_plan.model_fields["chart_type"].description}
@@ -242,15 +251,12 @@ def __new__(
242251
you may choose a different chart type if it better suits the user's needs.
243252
"""
244253

245-
# Create field with examples but keep original description
246254
chart_type_field = Field(description=description, examples=examples)
247255

248-
# Set up validators
249256
validators = {}
250257
if validate_code:
251258
validators = {"validator1": field_validator("chart_code")(_test_execute_chart_code(data_frame))}
252259

253-
# Create and return the dynamic model
254260
return create_model(
255261
"ChartPlanDynamic",
256262
__base__=chart_plan,

vizro-ai/src/vizro_ai/utils/helper.py

-14
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,6 @@
2323
}
2424

2525

26-
# def _get_code_templates() -> dict[str, str]:
27-
# """Get code templates using the vizro_visual_vocabulary package.
28-
29-
# Returns:
30-
# Dictionary mapping chart types to their example code.
31-
# """
32-
# return vv_get_code_templates()
33-
34-
35-
# def create_chart_type_enum() -> type[Enum]:
36-
# """Create a dynamic Enum from the available chart types using vizro_visual_vocabulary."""
37-
# return vv_create_chart_type_enum()
38-
39-
4026
def _get_df_info(df: pd.DataFrame, n_sample: int = 5) -> tuple[str, str]:
4127
"""Get the dataframe schema and head info as string."""
4228
formatted_pairs = [f"{col_name}: {dtype}" for col_name, dtype in df.dtypes.items()]

0 commit comments

Comments
 (0)