Target Questions Generator Agent
An intelligent AI-powered agent for converting technical machine learning requirements into user-friendly, domain-aware questions for interactive interfaces.
🚀 Features
- AI-Powered Question Generation: Leverages advanced LLM models to convert technical parameters into contextual questions
- Domain-Aware: Questions are contextualized using domain knowledge and use case information
- Dataset-Informed: Uses dataset insights to generate appropriate defaults and suggestions
- Comprehensive Validation: Generates validation rules for each question
- Multiple Data Sources: Works with both SQL databases and pandas DataFrames
- 100% LLM-Powered: All question generation logic is handled by LLM, ensuring dynamic and intelligent conversion
📦 Installation
Prerequisites
- Python 3.11+
- Git
- uv package manager (recommended)
Setup
-
Clone the repository
git clone https://github.com/stepfnAI/target_questions_generator_agent.git cd target_questions_generator_agent/ git checkout dev
-
Set up the virtual environment and install dependencies
uv venv --python=3.11 venv source venv/bin/activate uv pip install -e ".[dev]"
-
Clone and install the blueprint dependency
cd .. git clone https://github.com/stepfnAI/sfn_blueprint.git cd sfn_blueprint git switch dev uv pip install -e . cd ../target_questions_generator_agent
-
Set up environment variables
# Copy the template and fill in your values cp env.template .env # Edit .env file with your actual API key # Or set environment variables directly: export LLM_PROVIDER="openai" # Optional (default: openai) export LLM_MODEL="gpt-4.1-mini" # Optional (default: gpt-4.1-mini) export LLM_API_KEY="your_llm_api_key" # REQUIRED
🛠️ Usage
Basic Usage
from target_questions_generator_agent import TargetQuestionsGeneratorAgent
from target_questions_generator_agent.models import (
TargetQuestionsGeneratorInput,
DomainInfo,
MLApproachInfo,
DatasetInsights
)
# Initialize agent
agent = TargetQuestionsGeneratorAgent()
# Prepare input data
input_data = TargetQuestionsGeneratorInput(
domain_info=DomainInfo(
business_domain_name="E-commerce",
business_domain_info="Online retail platform"
),
usecase_info={"name": "churn_prediction"},
ml_approach=MLApproachInfo(name="binary_classification"),
raw_requirements={
"max_depth": {
"type": "integer",
"description": "Maximum depth of decision tree",
"default": 10,
"min": 1,
"max": 100
}
},
dataset_insights=DatasetInsights(total_row_count=1000),
dataset_column_insights={}
)
# Generate questions
result = agent.generate_questions(input_data)
# Access generated questions
for question in result.questions:
print(f"Question: {question.question}")
print(f"Default: {question.default_value}")
print(f"Validation: {question.validation}")
Running the Example
python examples/basic_usage.py
🧪 Testing
Run the complete test suite:
pytest tests/ -s
Or run individual test files:
pytest tests/test_agent.py -s
🏗️ Architecture
The Target Questions Generator Agent is built with a modular architecture:
-
Core Components:
agent.py: Main agent class with centralized LLM callsmodels.py: Data models and schemas (Pydantic)utils.py: Utility functions for input preparationconstants.py: Prompt templates and formatting functionsconfig.py: Configuration settings
-
Dependencies:
sfn-blueprint: Core framework and utilities (centralized LLM handling)pandas: Data manipulationpydantic: Data validation and modelsscikit-learn: ML utilities
📋 Workflow Integration
This agent is part of the ML workflow pipeline:
- Methodology Suggestion Agent → Outputs ML approach + raw technical requirements
- Target Question Generator Agent → Converts requirements to user-friendly questions
- Target Prep Agent → Uses user answers to prepare targets
🔧 Configuration
The agent can be configured via environment variables or a config object:
from target_questions_generator_agent.config import TargetQuestionsGeneratorConfig
config = TargetQuestionsGeneratorConfig(
ai_provider="openai",
model_name="gpt-4",
temperature=0.2,
max_tokens=4000
)
agent = TargetQuestionsGeneratorAgent(config=config)
📝 Output Format
The agent returns structured questions with:
- Question text: User-friendly, domain-aware question
- UI type: Input type (currently "text")
- Options: Suggested values for help text
- Default value: Prefilled default based on dataset/domain
- Data type: string, integer, float, boolean, date
- Validation rules: min, max, required, pattern, allowed_values
- Help text: Contextual help with examples
🤝 Contributing
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📄 License
This project is licensed under the MIT License.
🙏 Acknowledgments
- Built using the
sfn-blueprintframework - Follows patterns from
target_synthesis_agentand other agents in the ecosystem
Metadata
Release files for target-questions-generator-agent 1.0.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| target_questions_generator_agent-1.0.9.tar.gz | 29.4 kB | Without provenance | Details for target_questions_generator_agent-1.0.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| target_questions_generator_agent-1.0.9-py3-none-any.whl | Python 3 | none | any | Details for target_questions_generator_agent-1.0.9-py3-none-any.whl |
Total release size: 56.7 kB
Release files / target_questions_generator_agent-1.0.9.tar.gz
| Download URL | target_questions_generator_agent-1.0.9.tar.gz |
|---|---|
| Size | 29.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
29b4a4484544f3c7494787a41b0207bdbb9a0ee15d51676c69ce8b7b002de8f5
|
|
BLAKE2b-256 checksum How to use checksums |
21973640aeb207b225485acf3d849c2ea6741261d3b914d9154d46b3ea81cd8f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Release files / target_questions_generator_agent-1.0.9-py3-none-any.whl
| Download URL | target_questions_generator_agent-1.0.9-py3-none-any.whl |
|---|---|
| Size | 27.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ad4808d7a59fb9a897545c4bbb9cf2ba9124ebf98985d6c778aa0f649c773c07
|
|
BLAKE2b-256 checksum How to use checksums |
56e9f9edb7aafce560d59a394b7f6b1a6cffc250415fcc57ad8d4e8555c49441
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Security for target-questions-generator-agent 1.0.9
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.