# ShadowAI
🚀 An AI-powered intelligent mock data generation library
[](https://badge.fury.io/py/shadowai)
[](https://github.com/KevinZhang19870314/shadowai/actions/workflows/ci.yml)
[](https://github.com/KevinZhang19870314/shadowai/actions/workflows/release.yml)
[](https://www.python.org/downloads/)
[](https://opensource.org/licenses/MIT)
ShadowAI is a powerful Python library that uses AI technology to generate high-quality simulated data. Through a flexible rule engine, you can easily generate structured JSON data.
## 🎯 Design Philosophy
ShadowAI provides flexible and easy-to-use API design, supporting various usage scenarios from simple to complex, allowing users to get started quickly while maintaining powerful customization capabilities.
## 🆚 Comparison with Traditional Mock Libraries
### Core Differences
| Feature | ShadowAI | Traditional Mock Libraries (like faker.js) |
|---------|--------|---------------------------------------------|
| **Generation Method** | AI-powered intelligent generation | Predefined algorithms |
| **Configuration Complexity** | Minimal (description-based) | Medium (requires API combination) |
| **Data Quality** | High (semantic understanding) | Medium (template-based) |
| **Business Relevance** | Strong (context-aware) | Weak (generic patterns) |
| **Generation Speed** | Slow (AI calls) | Very fast (local computation) |
| **Extensibility** | High (AI adaptation) | Medium (requires development) |
### ShadowAI's Unique Advantages
#### 🧠 Intelligent Understanding
```python
# ShadowAI - One line of code, intelligent understanding of business meaning
shadow_ai.generate("company_email") # Automatically generates company-formatted emails
# Traditional library - Requires manual combination of multiple APIs
faker.internet.email(
faker.person.firstName(),
faker.person.lastName(),
faker.internet.domainName()
)
```
#### 🎯 Business Scenario Driven
```python
# ShadowAI - Business rule packages ensure data logical consistency
developer_profile = RulePackage(
name="senior_developer",
rules=["name", "email", "programming_language", "years_experience", "github_username"]
)
# Generated data automatically maintains logical relationships: high experience corresponds to advanced programming languages
```
#### 🔧 Minimal Configuration
```python
# ShadowAI - Descriptive configuration
Rule(
name="medical_record_id",
description="Generate HIPAA-compliant patient ID",
constraints={"format": "anonymized"}
)
# Traditional library - Requires custom development
def generate_medical_id():
# Lots of custom logic...
```
### Use Case Selection
#### ✅ Recommended ShadowAI Scenarios
- **Complex business testing**: Requires logical relationships between data
- **Prototype demonstrations**: Needs highly realistic sample data
- **Industry-specific data**: Medical, financial, and other professional domains
- **API documentation examples**: Automatically generates business-compliant response examples
- **Rapid iteration**: Frequently adjusting data generation rules
#### ✅ Recommended Traditional Library Scenarios
- **High performance requirements**: Bulk generation of large amounts of data
- **CI/CD pipelines**: Automated testing environments
- **Simple standard data**: Basic names, emails, phone numbers
- **Offline environments**: No network connection restrictions
- **Cost-sensitive**: Avoiding AI API call costs
### 💡 Best Practice Recommendations
**Hybrid Usage Strategy** - Leverage the advantages of both:
```python
# 1. Use ShadowAI to design data templates
business_template = shadow_ai.generate(complex_business_package)
# 2. Use traditional libraries for bulk data population
for i in range(1000):
test_data = apply_template_with_faker(business_template)
```
**Selection Guide**:
- 🎯 Pursue **data quality** and **business relevance** → Choose **ShadowAI**
- ⚡ Pursue **generation speed** and **simplicity** → Choose **Traditional Mock Libraries**
- 🔄 Combine both → Get **best development experience**
## ✨ Features
- 🤖 **AI-driven**: Based on Agno framework, supports multiple LLM models
- 📝 **Flexible rules**: Supports rule records, rule combinations, and rule packages
- 📄 **Multi-format support**: Supports JSON and YAML format rule definitions
- 🎯 **Precise output**: Generates structured JSON data
- 📦 **Ready to use**: Built-in common rule packages
- ⚡ **Minimal configuration**: Descriptive configuration, quick start
## 📦 Installation
```bash
pip install shadowai
```
## 🚀 Quick Start
### Basic Usage
```python
from shadow_ai import ShadowAI
# Create ShadowAI instance
shadow_ai = ShadowAI()
# Use string directly
result = shadow_ai.generate("email")
print(result) # {"email": "john.doe@example.com"}
# Generate multiple fields
result = shadow_ai.generate(["email", "name", "age"])
print(result) # {"email": "...", "name": "...", "age": ...}
# Quick method
result = shadow_ai.quick("email", "name", "phone")
print(result) # {"email": "...", "name": "...", "phone": "..."}
```
### Creating Custom Rules
```python
from shadow_ai import Rule, RuleCombination, RulePackage
# Create single rule
email_rule = Rule(name="email")
company_rule = Rule(name="company_name")
# Generate data
result = shadow_ai.generate(email_rule)
print(result) # {"email": "user@example.com"}
# Create rule combination
user_combo = RuleCombination(
name="user_profile",
rules=["name", "email", "phone"]
)
# Create rule package
user_package = RulePackage(
name="user",
rules=["username", "email", "age", "location"]
)
result = shadow_ai.generate(user_package)
print(result) # Complete user information
```
### Using Pre-built Rules
```python
from shadow_ai.rules import email_rule, name_rule
from shadow_ai.rules.packages import person_package
# Use predefined rules
result = shadow_ai.generate(email_rule)
print(result) # {"email": "john.doe@example.com"}
# Use predefined packages
result = shadow_ai.generate(person_package)
print(result)
# {
# "fullname": "John Smith",
# "age": 25,
# "email": "john.smith@email.com"
# }
```
### Advanced Custom Rules
```python
from shadow_ai import Rule
# Detailed rule configuration
custom_rule = Rule(
name="company",
description="Generate a technology company name",
examples=["TechCorp", "DataFlow", "CloudByte"],
constraints={"type": "string", "style": "modern"}
)
result = shadow_ai.generate(custom_rule)
```
## 📖 Documentation
For detailed documentation, please check the [docs/](docs/) directory.
## 🤝 Contributing
Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md).
## 📄 License
MIT License - see [LICENSE](LICENSE) file.
Raw data
{
"_id": null,
"home_page": null,
"name": "shadowai",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "ai, mock, data, generation, testing, agno",
"author": null,
"author_email": "Kevin Zhang <kevinzhang19870314@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/a4/2a/6fdc02e67af55e0f36ac20825966c15e21606745f00b45d3e438be1d4d56/shadowai-0.1.5.tar.gz",
"platform": null,
"description": "# ShadowAI\n\n\ud83d\ude80 An AI-powered intelligent mock data generation library\n\n[](https://badge.fury.io/py/shadowai)\n[](https://github.com/KevinZhang19870314/shadowai/actions/workflows/ci.yml)\n[](https://github.com/KevinZhang19870314/shadowai/actions/workflows/release.yml)\n[](https://www.python.org/downloads/)\n[](https://opensource.org/licenses/MIT)\n\nShadowAI is a powerful Python library that uses AI technology to generate high-quality simulated data. Through a flexible rule engine, you can easily generate structured JSON data.\n\n## \ud83c\udfaf Design Philosophy\n\nShadowAI provides flexible and easy-to-use API design, supporting various usage scenarios from simple to complex, allowing users to get started quickly while maintaining powerful customization capabilities.\n\n## \ud83c\udd9a Comparison with Traditional Mock Libraries\n\n### Core Differences\n\n| Feature | ShadowAI | Traditional Mock Libraries (like faker.js) |\n|---------|--------|---------------------------------------------|\n| **Generation Method** | AI-powered intelligent generation | Predefined algorithms |\n| **Configuration Complexity** | Minimal (description-based) | Medium (requires API combination) |\n| **Data Quality** | High (semantic understanding) | Medium (template-based) |\n| **Business Relevance** | Strong (context-aware) | Weak (generic patterns) |\n| **Generation Speed** | Slow (AI calls) | Very fast (local computation) |\n| **Extensibility** | High (AI adaptation) | Medium (requires development) |\n\n### ShadowAI's Unique Advantages\n\n#### \ud83e\udde0 Intelligent Understanding\n```python\n# ShadowAI - One line of code, intelligent understanding of business meaning\nshadow_ai.generate(\"company_email\") # Automatically generates company-formatted emails\n\n# Traditional library - Requires manual combination of multiple APIs\nfaker.internet.email(\n faker.person.firstName(),\n faker.person.lastName(), \n faker.internet.domainName()\n)\n```\n\n#### \ud83c\udfaf Business Scenario Driven\n```python\n# ShadowAI - Business rule packages ensure data logical consistency\ndeveloper_profile = RulePackage(\n name=\"senior_developer\",\n rules=[\"name\", \"email\", \"programming_language\", \"years_experience\", \"github_username\"]\n)\n# Generated data automatically maintains logical relationships: high experience corresponds to advanced programming languages\n```\n\n#### \ud83d\udd27 Minimal Configuration\n```python\n# ShadowAI - Descriptive configuration\nRule(\n name=\"medical_record_id\", \n description=\"Generate HIPAA-compliant patient ID\",\n constraints={\"format\": \"anonymized\"}\n)\n\n# Traditional library - Requires custom development\ndef generate_medical_id():\n # Lots of custom logic...\n```\n\n### Use Case Selection\n\n#### \u2705 Recommended ShadowAI Scenarios\n- **Complex business testing**: Requires logical relationships between data\n- **Prototype demonstrations**: Needs highly realistic sample data \n- **Industry-specific data**: Medical, financial, and other professional domains\n- **API documentation examples**: Automatically generates business-compliant response examples\n- **Rapid iteration**: Frequently adjusting data generation rules\n\n#### \u2705 Recommended Traditional Library Scenarios\n- **High performance requirements**: Bulk generation of large amounts of data\n- **CI/CD pipelines**: Automated testing environments\n- **Simple standard data**: Basic names, emails, phone numbers\n- **Offline environments**: No network connection restrictions\n- **Cost-sensitive**: Avoiding AI API call costs\n\n### \ud83d\udca1 Best Practice Recommendations\n\n**Hybrid Usage Strategy** - Leverage the advantages of both:\n```python\n# 1. Use ShadowAI to design data templates\nbusiness_template = shadow_ai.generate(complex_business_package)\n\n# 2. Use traditional libraries for bulk data population \nfor i in range(1000):\n test_data = apply_template_with_faker(business_template)\n```\n\n**Selection Guide**:\n- \ud83c\udfaf Pursue **data quality** and **business relevance** \u2192 Choose **ShadowAI**\n- \u26a1 Pursue **generation speed** and **simplicity** \u2192 Choose **Traditional Mock Libraries**\n- \ud83d\udd04 Combine both \u2192 Get **best development experience**\n\n## \u2728 Features\n\n- \ud83e\udd16 **AI-driven**: Based on Agno framework, supports multiple LLM models\n- \ud83d\udcdd **Flexible rules**: Supports rule records, rule combinations, and rule packages\n- \ud83d\udcc4 **Multi-format support**: Supports JSON and YAML format rule definitions\n- \ud83c\udfaf **Precise output**: Generates structured JSON data\n- \ud83d\udce6 **Ready to use**: Built-in common rule packages\n- \u26a1 **Minimal configuration**: Descriptive configuration, quick start\n\n## \ud83d\udce6 Installation\n\n```bash\npip install shadowai\n```\n\n## \ud83d\ude80 Quick Start\n\n### Basic Usage\n\n```python\nfrom shadow_ai import ShadowAI\n\n# Create ShadowAI instance\nshadow_ai = ShadowAI()\n\n# Use string directly\nresult = shadow_ai.generate(\"email\")\nprint(result) # {\"email\": \"john.doe@example.com\"}\n\n# Generate multiple fields\nresult = shadow_ai.generate([\"email\", \"name\", \"age\"])\nprint(result) # {\"email\": \"...\", \"name\": \"...\", \"age\": ...}\n\n# Quick method\nresult = shadow_ai.quick(\"email\", \"name\", \"phone\")\nprint(result) # {\"email\": \"...\", \"name\": \"...\", \"phone\": \"...\"}\n```\n\n### Creating Custom Rules\n\n```python\nfrom shadow_ai import Rule, RuleCombination, RulePackage\n\n# Create single rule\nemail_rule = Rule(name=\"email\")\ncompany_rule = Rule(name=\"company_name\")\n\n# Generate data\nresult = shadow_ai.generate(email_rule)\nprint(result) # {\"email\": \"user@example.com\"}\n\n# Create rule combination\nuser_combo = RuleCombination(\n name=\"user_profile\",\n rules=[\"name\", \"email\", \"phone\"]\n)\n\n# Create rule package\nuser_package = RulePackage(\n name=\"user\", \n rules=[\"username\", \"email\", \"age\", \"location\"]\n)\n\nresult = shadow_ai.generate(user_package)\nprint(result) # Complete user information\n```\n\n### Using Pre-built Rules\n\n```python\nfrom shadow_ai.rules import email_rule, name_rule\nfrom shadow_ai.rules.packages import person_package\n\n# Use predefined rules\nresult = shadow_ai.generate(email_rule)\nprint(result) # {\"email\": \"john.doe@example.com\"}\n\n# Use predefined packages\nresult = shadow_ai.generate(person_package)\nprint(result)\n# {\n# \"fullname\": \"John Smith\", \n# \"age\": 25,\n# \"email\": \"john.smith@email.com\"\n# }\n```\n\n### Advanced Custom Rules\n\n```python\nfrom shadow_ai import Rule\n\n# Detailed rule configuration\ncustom_rule = Rule(\n name=\"company\",\n description=\"Generate a technology company name\",\n examples=[\"TechCorp\", \"DataFlow\", \"CloudByte\"],\n constraints={\"type\": \"string\", \"style\": \"modern\"}\n)\n\nresult = shadow_ai.generate(custom_rule)\n```\n\n## \ud83d\udcd6 Documentation\n\nFor detailed documentation, please check the [docs/](docs/) directory.\n\n## \ud83e\udd1d Contributing\n\nContributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md).\n\n## \ud83d\udcc4 License\n\nMIT License - see [LICENSE](LICENSE) file. \n",
"bugtrack_url": null,
"license": "MIT",
"summary": "AI-powered mock data generation library with flexible rule engine",
"version": "0.1.5",
"project_urls": {
"Bug Tracker": "https://github.com/KevinZhang19870314/shadowai/issues",
"Documentation": "https://github.com/KevinZhang19870314/shadowai#readme",
"Homepage": "https://github.com/KevinZhang19870314/shadowai",
"Repository": "https://github.com/KevinZhang19870314/shadowai"
},
"split_keywords": [
"ai",
" mock",
" data",
" generation",
" testing",
" agno"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "2ec929e50374ad9beb44043990dad215a6400d6a837f4dae93c97387a50b26ca",
"md5": "df3256f246dd4de56764a85e1d3f66c0",
"sha256": "8fa9e2c4e0c9dedd97df8e7f5faa410eb1552127bc37f52b2823c1467171b11a"
},
"downloads": -1,
"filename": "shadowai-0.1.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "df3256f246dd4de56764a85e1d3f66c0",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 22900,
"upload_time": "2025-08-06T09:57:36",
"upload_time_iso_8601": "2025-08-06T09:57:36.681749Z",
"url": "https://files.pythonhosted.org/packages/2e/c9/29e50374ad9beb44043990dad215a6400d6a837f4dae93c97387a50b26ca/shadowai-0.1.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "a42a6fdc02e67af55e0f36ac20825966c15e21606745f00b45d3e438be1d4d56",
"md5": "f11e2c68c4979f7ad20c8250b240bc45",
"sha256": "450d806fecd096772c720ebb0ce7d4ffd9f1653f34fd02c796f064ed74dc6cdf"
},
"downloads": -1,
"filename": "shadowai-0.1.5.tar.gz",
"has_sig": false,
"md5_digest": "f11e2c68c4979f7ad20c8250b240bc45",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 21692,
"upload_time": "2025-08-06T09:57:38",
"upload_time_iso_8601": "2025-08-06T09:57:38.104910Z",
"url": "https://files.pythonhosted.org/packages/a4/2a/6fdc02e67af55e0f36ac20825966c15e21606745f00b45d3e438be1d4d56/shadowai-0.1.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-06 09:57:38",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "KevinZhang19870314",
"github_project": "shadowai",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "agno",
"specs": [
[
">=",
"1.7.0"
]
]
},
{
"name": "pydantic",
"specs": [
[
">=",
"2.0.0"
]
]
},
{
"name": "pyyaml",
"specs": [
[
">=",
"6.0"
]
]
},
{
"name": "typing-extensions",
"specs": [
[
">=",
"4.0.0"
]
]
}
],
"lcname": "shadowai"
}