Metadata-Version: 2.3
Name: python-ai-sdk
Version: 0.0.2
Summary: A Python AI SDK inspired by the Vercel AI SDK with streaming support and multi-provider integration.
License: MIT
Keywords: ai,openai,google,streaming,sdk,llm
Author: David uche
Author-email: Daviduche176@gmail.com
Requires-Python: >=3.9,<4.0
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Provides-Extra: all
Provides-Extra: anthropic
Provides-Extra: fastapi
Requires-Dist: anthropic (>=0.25.0) ; extra == "anthropic" or extra == "all"
Requires-Dist: fastapi (>=0.100.0) ; extra == "fastapi" or extra == "all"
Requires-Dist: google-genai (>=1.0.0)
Requires-Dist: httpx (>=0.25.0)
Requires-Dist: openai (>=1.0.0)
Requires-Dist: pydantic (>=2.0.0)
Requires-Dist: uvicorn[standard] (>=0.20.0) ; extra == "fastapi" or extra == "all"
Project-URL: Documentation, https://github.com/Daviduche03/ai.py#readme
Project-URL: Homepage, https://github.com/Daviduche03/ai.py
Project-URL: Repository, https://github.com/Daviduche03/ai.py
Description-Content-Type: text/markdown

# Python AI SDK

A Python AI SDK inspired by the Vercel AI SDK, designed for building AI-powered backends with a focus on streaming and strict typing.

## Features

- Streaming-first API
- Multi-provider support (OpenAI, Google, etc.)
- FastAPI integration
- Pydantic-based structured data generation

## Installation

### Basic Installation
```bash
pip install python-ai-sdk
```

### With Optional Dependencies
```bash
# For FastAPI integration
pip install python-ai-sdk[fastapi]

# For Google Generative AI support
pip install python-ai-sdk google-genai
```

### Installing from Test PyPI
If you want to test the latest development version:
```bash
pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ python-ai-sdk
```

## Quick Start

```python
from ai import generate_text, LanguageModel
import openai

# Configure your model
model = LanguageModel(
    provider="openai",
    model="gpt-4",
    client=openai.OpenAI(api_key="your-api-key")
)

# Generate text
result = await generate_text(
    model=model,
    prompt="What is the capital of France?"
)

print(result.text)
```

## Streaming Example

```python
from ai import stream_text

async for chunk in stream_text(
    model=model,
    prompt="Tell me a story"
):
    if chunk.type == "text-delta":
        print(chunk.textDelta, end="")
```

## Development

```bash
# Install dependencies
poetry install

# Run tests
poetry run pytest

# Format code
poetry run ruff format

# Type checking
poetry run mypy ai/
```

