Conversation
…ription-output-structure
AnilSorathiya
left a comment
There was a problem hiding this comment.
For consistency purpose, we are using the user_instructions an input in run_task function, while the instructions has been used as params. Also, the names are different as well.
Just wondering, can we bring consistency?
result = vm.experimental.agents.run_task(
task="code_explainer",
input={
"source_code": source_code,
"user_instructions": user_instructions
}
)
result.log(content_id=content_id)
return result
```
Actually, I was thinking that perhaps we could consider consolidating the context parameters into a single dictionary, similar to inputs. This would logically group all context elements that drive the description customization: Current approach: Alternative approach: Regarding the naming of parameters, I am open to suggestions. Perhaps With respect to the code explainer, perhaps we could follow a similar approach, where we separate "what to process" ( @AnilSorathiya @johnwalz97 @cachafla @kristof87 Any thoughts? |
I like the idea keeping llm parameters/inputs in a separate dictionary format. It allows us to add more parameters without changing the How about the following:
This is up for discussion so please put forward your opinions as well @cachafla, @juanmleng and @johnwalz97. |
|
Ah, removing my approval since I didn't see @AnilSorathiya's suggestion. Reading... |
|
Can we change the filename to |
|
Great addition! |
Good point @validbeck. Done |
PR SummaryThis PR introduces enhanced customization options for LLM-generated test descriptions in the ValidMind Library. The changes allow users to supply additional context through new parameters such as Key functional changes include:
Overall, the PR improves the flexibility of how test outputs are explained by the LLM and provides users an easier way to incorporate business logic and formatting requirements directly into the test result description generation workflow. Test Suggestions
|
Pull Request Description
What
This PR adds comprehensive context management capabilities to
run_test()by introducing a newcontextparameter that accepts a dictionary with three optional keys:test_description: Allows users to override a test's built-in docstring with custom documentationadditional_context: Provides business context, thresholds, decision criteria, and any background informationinstructions: Controls output formatting and presentation styleWhy
Users now have complete control over all aspects of context that drive LLM test description generation.
test_descriptionParameter:Addresses the need for domain-specific and regulatory-compliant test documentation. By default, ValidMind tests include technical documentation about their statistical methodology, but for generic tests like histograms or descriptive statistics, this mechanical explanation often provides less value than understanding what variables or features are being analyzed and their business significance. This parameter allows users to replace generic methodology descriptions with meaningful explanations of the data being examined, override ValidMind's built-in documentation when different terminology or structure is preferred, and ensure regulatory compliance by using specific required language for test definitions.
additional_contextParameter:Allows users to provide any background information necessary for intelligent interpretation of test results. Rather than generating generic assessments, this parameter enables the LLM to understand the specific context that matters for each use case. Users can include business rules like performance thresholds and decision criteria, organizational context such as risk tolerances and regulatory requirements, real-time information like current dates or risk indicators, stakeholder priorities, model purpose and operational constraints, or any other background information that helps the LLM interpret results within their specific business context. This flexible parameter serves as a catch-all for contextual information, allowing users to provide whatever background details are most relevant to their situation.
instructionsParameter:The instructions parameter gives users complete control over how test descriptions are formatted. This addresses the reality that different tests, document sections or audiences may need different formats, such as concise summaries with clear recommendations, detailed methodology discussions, or regulatory audiences expect specific compliance-focused language. Users can create structured templates that ensure consistent organizational reporting standards, combine hardcoded mandatory text (such as policy references and disclaimers) with dynamic LLM analysis, and implement sophisticated formatting requirements that maintain professional presentation while leveraging AI-generated insights.
How to test
All three parameters working together
Backwards compatibility - environment variable still works (temporary)
Parameter overrides environment variable when both provided
What needs special review?
We need to decide the backwards compatibility period. When are we removing the use of the environmental variable?
Dependencies, breaking changes, and deployment notes
notebooks/how_to/add_context_to_llm_descriptions.ipynbhas been removed and replaced bynotebooks/how_to/custom_test_result_descriptions.ipynbDependencies:
https://github.com/validmind/backend/pull/1963
Release notes
This release introduces comprehensive context management for test descriptions through a new
contextparameter inrun_test()that accepts a dictionary with three optional keys:test_descriptionfor overriding test documentation with domain-specific contentadditional_contextfor providing business context, real-time information or any other background information relevant for the analysis of test resultsinstructionsfor controlling output formatting and styleThese parameters give users complete control over how LLM-generated test descriptions are created. The existing environment variable approach (
VALIDMIND_LLM_DESCRIPTIONS_CONTEXT) remains fully supported for backwards compatibility, with the instructions parameter taking precedence when both are provided. Users are encouraged to migrate to the new parameter-based approach, as environment variable support will be deprecated in future releases.Checklist