aiwand


Nameaiwand JSON
Version 0.4.34 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-24 22:14:11
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/2a/03/205e413726a7ccc49f468547d7414bd4e2548ff998a33299b24806a19622/aiwand-0.4.34.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.34",
    "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": "603129038489efbbbcd734ab31b29802957bb7fbe253a95847a8d0fe4d99e883",
                "md5": "a707493c810c9f402c3ab458142822d6",
                "sha256": "1d4556f427389916f5a48f1e036e33c2f61c8069dad74c1ee4fd7b8a9575d558"
            },
            "downloads": -1,
            "filename": "aiwand-0.4.34-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a707493c810c9f402c3ab458142822d6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 40558,
            "upload_time": "2025-08-24T22:14:10",
            "upload_time_iso_8601": "2025-08-24T22:14:10.209298Z",
            "url": "https://files.pythonhosted.org/packages/60/31/29038489efbbbcd734ab31b29802957bb7fbe253a95847a8d0fe4d99e883/aiwand-0.4.34-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "2a03205e413726a7ccc49f468547d7414bd4e2548ff998a33299b24806a19622",
                "md5": "dd72a3d7c1ace67ce6615533044f7318",
                "sha256": "dc1f3df5916c8853bb0055173bccb2e80e9757f9c6c35d5d5e5a0ecdb5870f8f"
            },
            "downloads": -1,
            "filename": "aiwand-0.4.34.tar.gz",
            "has_sig": false,
            "md5_digest": "dd72a3d7c1ace67ce6615533044f7318",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 76121,
            "upload_time": "2025-08-24T22:14:11",
            "upload_time_iso_8601": "2025-08-24T22:14:11.934579Z",
            "url": "https://files.pythonhosted.org/packages/2a/03/205e413726a7ccc49f468547d7414bd4e2548ff998a33299b24806a19622/aiwand-0.4.34.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-24 22:14:11",
    "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.97492s