aiwand


Nameaiwand JSON
Version 0.4.29 PyPI version JSON
download
home_pagehttps://github.com/onlyoneaman/aiwand
SummaryA simple AI toolkit for text processing using OpenAI and Gemini APIs
upload_time2025-08-02 14:10:32
maintainerNone
docs_urlNone
authorAman Kumar
requires_python>=3.8
licenseNone
keywords aiwand ai wand ai wand ai toolkit openai gemini llm pydantic provider switching structured output text processing call_ai extract summarization chat generate classification
VCS
bugtrack_url
requirements google-genai openai python-dotenv beautifulsoup4
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # AIWand 🪄

> **One API to rule them all** - Unified OpenAI and Gemini interface with automatic provider switching and structured data extraction from anywhere.

[![PyPI version](https://img.shields.io/pypi/v/aiwand.svg)](https://pypi.org/project/aiwand/)
[![Python versions](https://img.shields.io/pypi/pyversions/aiwand.svg)](https://pypi.org/project/aiwand/)
[![License](https://img.shields.io/pypi/l/aiwand.svg)](https://github.com/onlyoneaman/aiwand/blob/main/LICENSE)
[![Coverage Status](https://img.shields.io/badge/coverage-100%25-success)](https://github.com/onlyoneaman/aiwand/actions?query=workflow%3ACI)
[![Downloads](https://pepy.tech/badge/aiwand)](https://pepy.tech/project/aiwand)
[![Downloads](https://pepy.tech/badge/aiwand/month)](https://pepy.tech/project/aiwand/month)
[![Downloads](https://pepy.tech/badge/aiwand/week)](https://pepy.tech/project/aiwand/week)

## 🚀 **Stop Wrestling with AI APIs**

**Before:** Different APIs, manual JSON parsing, provider-specific code 😫  
**After:** One API, automatic everything ✨

```python
import aiwand
# Works with any model - provider auto-detected
response = aiwand.call_ai(model="gpt-4o", user_prompt="Explain quantum computing?")

# returns structured json data directly
data = aiwand.extract(content="John Doe, john@example.com, (555) 123-4567")
```

## 🔧 Installation & Setup

```bash
pip install aiwand
export OPENAI_API_KEY="your-key"     # Set either key (or both for fallback)
export GEMINI_API_KEY="your-key"     
```

## 💡 Core Features

### **`call_ai`** - Universal AI Interface
Same code works with OpenAI and Gemini - automatic provider detection:

```python
from pydantic import BaseModel

# Basic AI calls
response = aiwand.call_ai(model="gpt-4o", user_prompt="Explain quantum computing?")

# Structured output - get Pydantic objects directly
class BlogPost(BaseModel):
    title: str
    content: str
    tags: list[str]

blog = aiwand.call_ai(
    model="gemini-2.0-flash",
    user_prompt="Write a blog about AI",
    response_format=BlogPost    # Returns BlogPost object!
)
print(blog.title)  # Direct access, no JSON parsing

# Works with any model
for model in ["gpt-4o", "gemini-2.0-flash", "o3-mini"]:
    response = aiwand.call_ai(model=model, user_prompt=f"What makes {model} special?")
```

### **`extract`** - Smart Data Extraction  
Extract structured data from text, web links, documents, and images:

```python
from pydantic import BaseModel

class CompanyInfo(BaseModel):
    name: str
    founded: int
    employees: int
    technologies: list[str]

# Extract from individual sources
contact = aiwand.extract(content="John Doe, john@example.com, (555) 123-4567")
webpage = aiwand.extract(links=["https://company.com/about"])
docs = aiwand.extract(document_links=["resume.pdf", "report.docx"])
images = aiwand.extract(images=["chart.png", "diagram.jpg"])

# Or mix all sources together with custom structure
company = aiwand.extract(
    content="Research notes about tech companies...", 
    links=["https://company.com/about"],           # Web pages
    document_links=["annual_report.pdf"],          # Documents  
    images=["company_chart.png"],                  # Images
    response_format=CompanyInfo                    # Get typed object back
)

print(f"{company.name} founded in {company.founded}")  # Direct access
```

## ⚡ Quick Examples

```python
import aiwand

# Instant AI calls
summary = aiwand.summarize("Long article...", style="bullet-points")
response = aiwand.chat("What is machine learning?")
story = aiwand.generate_text("Write a haiku about coding")

# Smart classification  
grader = aiwand.create_binary_classifier(criteria="technical accuracy")
result = grader(question="What is 2+2?", answer="4", expected="4")
print(f"Accuracy: {result.score}/5")
```

## 🎨 CLI Magic

```bash
# Quick chat
aiwand "Explain quantum computing simply"

# Extract from anything
aiwand extract "Dr. Sarah Johnson, sarah@lab.com" --json
aiwand extract --links https://example.com --document-links resume.pdf --images chart.png

# Built-in functions
aiwand summarize "Long text..." --style concise
aiwand chat "Hello there!"
```

## ✨ Why Choose AIWand?

| 🔄 **Provider Agnostic** | Same code, OpenAI or Gemini |
|---|---|
| 🏗️ **Structured Output** | Pydantic objects, no JSON parsing |
| 🧠 **Smart Detection** | Automatic provider selection |
| 📄 **Universal Extraction** | Text, web links, documents, images |
| ⚡ **Zero Setup** | Just add API keys |
| 🎯 **Drop-in Ready** | Minimal code changes |

## 📚 Documentation

- **[API Reference](docs/api-reference.md)** - Complete function docs
- **[CLI Guide](docs/cli.md)** - Command line usage  
- **[Installation](docs/installation.md)** - Setup details
- **[Development](docs/development.md)** - Contributing guide

## 🤝 Contributing

We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.

## 📝 License

MIT License - see [LICENSE](LICENSE) file for details.

---

⭐ **Star this repo if AIWand makes your AI development easier!**

**Made with ❤️ by [Aman Kumar](https://x.com/onlyoneaman)** 

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/onlyoneaman/aiwand",
    "name": "aiwand",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "aiwand, ai, wand, ai wand, ai toolkit, openai, gemini, llm, pydantic, provider switching, structured output, text processing, call_ai, extract, summarization, chat, generate, classification",
    "author": "Aman Kumar",
    "author_email": "2000.aman.sinha@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/5d/5d/f96892ee572ad4c6d41d800fcf04dd724c8b266af9aac95c07f48119daf3/aiwand-0.4.29.tar.gz",
    "platform": null,
    "description": "# AIWand \ud83e\ude84\n\n> **One API to rule them all** - Unified OpenAI and Gemini interface with automatic provider switching and structured data extraction from anywhere.\n\n[![PyPI version](https://img.shields.io/pypi/v/aiwand.svg)](https://pypi.org/project/aiwand/)\n[![Python versions](https://img.shields.io/pypi/pyversions/aiwand.svg)](https://pypi.org/project/aiwand/)\n[![License](https://img.shields.io/pypi/l/aiwand.svg)](https://github.com/onlyoneaman/aiwand/blob/main/LICENSE)\n[![Coverage Status](https://img.shields.io/badge/coverage-100%25-success)](https://github.com/onlyoneaman/aiwand/actions?query=workflow%3ACI)\n[![Downloads](https://pepy.tech/badge/aiwand)](https://pepy.tech/project/aiwand)\n[![Downloads](https://pepy.tech/badge/aiwand/month)](https://pepy.tech/project/aiwand/month)\n[![Downloads](https://pepy.tech/badge/aiwand/week)](https://pepy.tech/project/aiwand/week)\n\n## \ud83d\ude80 **Stop Wrestling with AI APIs**\n\n**Before:** Different APIs, manual JSON parsing, provider-specific code \ud83d\ude2b  \n**After:** One API, automatic everything \u2728\n\n```python\nimport aiwand\n# Works with any model - provider auto-detected\nresponse = aiwand.call_ai(model=\"gpt-4o\", user_prompt=\"Explain quantum computing?\")\n\n# returns structured json data directly\ndata = aiwand.extract(content=\"John Doe, john@example.com, (555) 123-4567\")\n```\n\n## \ud83d\udd27 Installation & Setup\n\n```bash\npip install aiwand\nexport OPENAI_API_KEY=\"your-key\"     # Set either key (or both for fallback)\nexport GEMINI_API_KEY=\"your-key\"     \n```\n\n## \ud83d\udca1 Core Features\n\n### **`call_ai`** - Universal AI Interface\nSame code works with OpenAI and Gemini - automatic provider detection:\n\n```python\nfrom pydantic import BaseModel\n\n# Basic AI calls\nresponse = aiwand.call_ai(model=\"gpt-4o\", user_prompt=\"Explain quantum computing?\")\n\n# Structured output - get Pydantic objects directly\nclass BlogPost(BaseModel):\n    title: str\n    content: str\n    tags: list[str]\n\nblog = aiwand.call_ai(\n    model=\"gemini-2.0-flash\",\n    user_prompt=\"Write a blog about AI\",\n    response_format=BlogPost    # Returns BlogPost object!\n)\nprint(blog.title)  # Direct access, no JSON parsing\n\n# Works with any model\nfor model in [\"gpt-4o\", \"gemini-2.0-flash\", \"o3-mini\"]:\n    response = aiwand.call_ai(model=model, user_prompt=f\"What makes {model} special?\")\n```\n\n### **`extract`** - Smart Data Extraction  \nExtract structured data from text, web links, documents, and images:\n\n```python\nfrom pydantic import BaseModel\n\nclass CompanyInfo(BaseModel):\n    name: str\n    founded: int\n    employees: int\n    technologies: list[str]\n\n# Extract from individual sources\ncontact = aiwand.extract(content=\"John Doe, john@example.com, (555) 123-4567\")\nwebpage = aiwand.extract(links=[\"https://company.com/about\"])\ndocs = aiwand.extract(document_links=[\"resume.pdf\", \"report.docx\"])\nimages = aiwand.extract(images=[\"chart.png\", \"diagram.jpg\"])\n\n# Or mix all sources together with custom structure\ncompany = aiwand.extract(\n    content=\"Research notes about tech companies...\", \n    links=[\"https://company.com/about\"],           # Web pages\n    document_links=[\"annual_report.pdf\"],          # Documents  \n    images=[\"company_chart.png\"],                  # Images\n    response_format=CompanyInfo                    # Get typed object back\n)\n\nprint(f\"{company.name} founded in {company.founded}\")  # Direct access\n```\n\n## \u26a1 Quick Examples\n\n```python\nimport aiwand\n\n# Instant AI calls\nsummary = aiwand.summarize(\"Long article...\", style=\"bullet-points\")\nresponse = aiwand.chat(\"What is machine learning?\")\nstory = aiwand.generate_text(\"Write a haiku about coding\")\n\n# Smart classification  \ngrader = aiwand.create_binary_classifier(criteria=\"technical accuracy\")\nresult = grader(question=\"What is 2+2?\", answer=\"4\", expected=\"4\")\nprint(f\"Accuracy: {result.score}/5\")\n```\n\n## \ud83c\udfa8 CLI Magic\n\n```bash\n# Quick chat\naiwand \"Explain quantum computing simply\"\n\n# Extract from anything\naiwand extract \"Dr. Sarah Johnson, sarah@lab.com\" --json\naiwand extract --links https://example.com --document-links resume.pdf --images chart.png\n\n# Built-in functions\naiwand summarize \"Long text...\" --style concise\naiwand chat \"Hello there!\"\n```\n\n## \u2728 Why Choose AIWand?\n\n| \ud83d\udd04 **Provider Agnostic** | Same code, OpenAI or Gemini |\n|---|---|\n| \ud83c\udfd7\ufe0f **Structured Output** | Pydantic objects, no JSON parsing |\n| \ud83e\udde0 **Smart Detection** | Automatic provider selection |\n| \ud83d\udcc4 **Universal Extraction** | Text, web links, documents, images |\n| \u26a1 **Zero Setup** | Just add API keys |\n| \ud83c\udfaf **Drop-in Ready** | Minimal code changes |\n\n## \ud83d\udcda Documentation\n\n- **[API Reference](docs/api-reference.md)** - Complete function docs\n- **[CLI Guide](docs/cli.md)** - Command line usage  \n- **[Installation](docs/installation.md)** - Setup details\n- **[Development](docs/development.md)** - Contributing guide\n\n## \ud83e\udd1d Contributing\n\nWe welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.\n\n## \ud83d\udcdd License\n\nMIT License - see [LICENSE](LICENSE) file for details.\n\n---\n\n\u2b50 **Star this repo if AIWand makes your AI development easier!**\n\n**Made with \u2764\ufe0f by [Aman Kumar](https://x.com/onlyoneaman)** \n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A simple AI toolkit for text processing using OpenAI and Gemini APIs",
    "version": "0.4.29",
    "project_urls": {
        "Homepage": "https://github.com/onlyoneaman/aiwand"
    },
    "split_keywords": [
        "aiwand",
        " ai",
        " wand",
        " ai wand",
        " ai toolkit",
        " openai",
        " gemini",
        " llm",
        " pydantic",
        " provider switching",
        " structured output",
        " text processing",
        " call_ai",
        " extract",
        " summarization",
        " chat",
        " generate",
        " classification"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "0357d81e31084e133e4f297cdc215e9e8cbaa5f8a0554ce391c8d346c9bfcf8a",
                "md5": "639d2d767d693f3474b6482e5ad6e9a9",
                "sha256": "9046f235be1e1b44572c7c69e47682cf3ebf94d50e48bf40d9f5cd84a63fba1a"
            },
            "downloads": -1,
            "filename": "aiwand-0.4.29-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "639d2d767d693f3474b6482e5ad6e9a9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 36213,
            "upload_time": "2025-08-02T14:10:30",
            "upload_time_iso_8601": "2025-08-02T14:10:30.349721Z",
            "url": "https://files.pythonhosted.org/packages/03/57/d81e31084e133e4f297cdc215e9e8cbaa5f8a0554ce391c8d346c9bfcf8a/aiwand-0.4.29-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "5d5df96892ee572ad4c6d41d800fcf04dd724c8b266af9aac95c07f48119daf3",
                "md5": "2de02d19dde2d8c7821d4887d9a6aecc",
                "sha256": "f5222b5d0339b12d1be4d23397653cb9ee54fd7984d8fac7c8ccfa7fde06c488"
            },
            "downloads": -1,
            "filename": "aiwand-0.4.29.tar.gz",
            "has_sig": false,
            "md5_digest": "2de02d19dde2d8c7821d4887d9a6aecc",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 68934,
            "upload_time": "2025-08-02T14:10:32",
            "upload_time_iso_8601": "2025-08-02T14:10:32.098284Z",
            "url": "https://files.pythonhosted.org/packages/5d/5d/f96892ee572ad4c6d41d800fcf04dd724c8b266af9aac95c07f48119daf3/aiwand-0.4.29.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-02 14:10:32",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "onlyoneaman",
    "github_project": "aiwand",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "google-genai",
            "specs": [
                [
                    ">=",
                    "1.20.0"
                ]
            ]
        },
        {
            "name": "openai",
            "specs": [
                [
                    ">=",
                    "1.0.0"
                ]
            ]
        },
        {
            "name": "python-dotenv",
            "specs": [
                [
                    ">=",
                    "0.19.0"
                ]
            ]
        },
        {
            "name": "beautifulsoup4",
            "specs": [
                [
                    ">=",
                    "4.0"
                ]
            ]
        }
    ],
    "lcname": "aiwand"
}
        
Elapsed time: 1.64219s