Metadata-Version: 2.1
Name: ai71
Version: 0.0.1
Summary: The official Python library for the AI71 API
Author: AI71 MarketPlace
Author-email: ai71marketplace@ai71.ai
Requires-Python: >=3.8,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: httpx (>=0.25.2,<0.26.0)
Requires-Dist: httpx-sse (>=0.3.1,<0.4.0)
Requires-Dist: pydantic (>=2.5.2,<3.0.0)
Description-Content-Type: text/markdown

Developers building Python 3.8+ apps can now interact seamlessly with the AI71 API thanks to the ai71 Python library. It includes built-in type checking for both requests and responses, and provides both synchronous and asynchronous HTTP clients powered by httpx.

# Documentation

The API documentation can be found [here](https://api.ai71.ai/redoc).

# Installation
```
pip install ai71
```

# Usage
Define `AI71_API_KEY` environment variable or provide `api_key` in `AI71` and `AsyncAI71`.

```
import os
from ai71 import AI71

client = AI71()

chat_completion = client.chat.completions.create(
    messages=[{"role": "user", "content": "What is your name?"}],
    model="tiiuae/falcon-180B-chat",
)
```

# Async Usage
```
import asyncio

from ai71 import AsyncAI71

client = AsyncAI71()


async def main():
    stream = await client.chat.completions.create(
        messages=[{"role": "user", "content": "What is your name?"}],
        model="tiiuae/falcon-180B-chat",
        stream=True,
    )
    async for chunk in stream:
        print(chunk.choices[0].delta.content or "", end="")


asyncio.run(main())
```
