From 480e7e6b2d1f8d790e2258ede05944b09bd1c816 Mon Sep 17 00:00:00 2001 From: Juan Date: Fri, 21 Nov 2025 15:02:11 +0100 Subject: [PATCH 1/2] Include test parameters in LLM description generation --- validmind/ai/test_descriptions.py | 9 ++++++++- validmind/tests/data_validation/TooManyZeroValues.py | 4 ++-- validmind/tests/run.py | 1 + 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/validmind/ai/test_descriptions.py b/validmind/ai/test_descriptions.py index 617843c40..1b4960c24 100644 --- a/validmind/ai/test_descriptions.py +++ b/validmind/ai/test_descriptions.py @@ -5,7 +5,7 @@ import json import os from concurrent.futures import ThreadPoolExecutor -from typing import List, Optional, Union +from typing import Any, Dict, List, Optional, Union import tiktoken @@ -76,6 +76,7 @@ def generate_description( title: Optional[str] = None, instructions: Optional[str] = None, additional_context: Optional[str] = None, + params: Optional[Dict[str, Any]] = None, ): """Generate the description for the test results.""" from validmind.api_client import generate_test_result_description @@ -126,6 +127,7 @@ def generate_description( ], "additional_context": additional_context, "instructions": instructions, + "params": params, } )["content"] @@ -139,6 +141,7 @@ def background_generate_description( title: Optional[str] = None, instructions: Optional[str] = None, additional_context: Optional[str] = None, + params: Optional[Dict[str, Any]] = None, ): def wrapped(): try: @@ -152,6 +155,7 @@ def wrapped(): title=title, instructions=instructions, additional_context=additional_context, + params=params, ), True, ) @@ -183,6 +187,7 @@ def get_result_description( title: Optional[str] = None, instructions: Optional[str] = None, additional_context: Optional[str] = None, + params: Optional[Dict[str, Any]] = None, ): """Get the metadata dictionary for a test or metric result. @@ -206,6 +211,7 @@ def get_result_description( should_generate (bool): Whether to generate the description or not. Defaults to True. instructions (Optional[str]): Instructions for the LLM to generate the description. additional_context (Optional[str]): Additional context for the LLM to generate the description. + params (Optional[Dict[str, Any]]): Test parameters used to customize test behavior. Returns: str: The description to be logged with the test results. @@ -234,6 +240,7 @@ def get_result_description( title=title, instructions=_instructions, additional_context=additional_context, + params=params, ) else: diff --git a/validmind/tests/data_validation/TooManyZeroValues.py b/validmind/tests/data_validation/TooManyZeroValues.py index adc04381d..98ae90974 100644 --- a/validmind/tests/data_validation/TooManyZeroValues.py +++ b/validmind/tests/data_validation/TooManyZeroValues.py @@ -23,14 +23,14 @@ def TooManyZeroValues( The 'TooManyZeroValues' test is utilized to identify numerical columns in the dataset that may present a quantity of zero values considered excessive. The aim is to detect situations where these may implicate data sparsity or a lack of variation, limiting their effectiveness within a machine learning model. The definition of 'too many' is - quantified as a percentage of total values, with a default set to 3%. + quantified as a percentage of total values, with a default set to 0.03%. ### Test Mechanism This test is conducted by looping through each column in the dataset and categorizing those that pertain to numerical data. On identifying a numerical column, the function computes the total quantity of zero values and their ratio to the total row count. Should the proportion exceed a pre-set threshold parameter, set by default at - 0.03 or 3%, the column is considered to have failed the test. The results for each column are summarized and + 0.03%, the column is considered to have failed the test. The results for each column are summarized and reported, indicating the count and percentage of zero values for each numerical column, alongside a status indicating whether the column has passed or failed the test. diff --git a/validmind/tests/run.py b/validmind/tests/run.py index 3fd50059c..bd688affb 100644 --- a/validmind/tests/run.py +++ b/validmind/tests/run.py @@ -461,6 +461,7 @@ def run_test( # noqa: C901 title=title, instructions=instructions, additional_context=additional_context, + params=result.params, ) if show: From cf48b45a2957af74d04e0e43e40dbba28e4aed26 Mon Sep 17 00:00:00 2001 From: Juan Date: Fri, 21 Nov 2025 22:58:56 +0100 Subject: [PATCH 2/2] 2.10.5 --- pyproject.toml | 2 +- validmind/__version__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 0a2b3a989..bcb0c3801 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "validmind" -version = "2.10.4" +version = "2.10.5" description = "ValidMind Library" readme = "README.pypi.md" requires-python = ">=3.9,<3.13" diff --git a/validmind/__version__.py b/validmind/__version__.py index e3b571e0f..0d040b30c 100644 --- a/validmind/__version__.py +++ b/validmind/__version__.py @@ -1 +1 @@ -__version__ = "2.10.4" +__version__ = "2.10.5"