Metadata-Version: 2.1
Name: predictionguard
Version: 2.0.0
Summary: Create controlled and compliant AI systems with PredictionGuard.
Author-email: Daniel Whitenack <dan@predictionguard.com>
Description-Content-Type: text/markdown
Classifier: License :: OSI Approved :: MIT License
Requires-Dist: tabulate >=0.8.10
Requires-Dist: requests >=2.27.1
Project-URL: Home, https://predictionguard.com

# Prediction Guard - Python Client

This package provides functionality developed to simplify interfacing with [Prediction Guard](https://www.predictionguard.com/) in Python 3.

## Documentation

See the [API documentation](https://docs.predictionguard.com/).

## Installation

The package can be installed with `pip`:

```bash
pip install predictionguard
```

### Requirements

- Python 3.6+

## Quick Start

To use this library, you must have an api key. You can set it two ways: as an environment variable name `PREDICTIONGUARD_API_KEY` or when creating the client object. API Keys can be acquired [here](https://mailchi.mp/predictionguard/getting-started). This is a basic example that:

1. Instantiates a Prediction Guard client
2. Defines some example model input/ output
3. Creates a request to the Prediction Guard API
4. Formats the API response in a clean, readable way.

```python
import json
import os

from predictionguard import PredictionGuard


# You can set you Prediction Guard API Key as an env variable,
# or when creating the client object
os.environ["PREDICTIONGUARD_API_KEY"]

client = PredictionGuard(
    api_key="<your Prediction Guard API Key"
)

messages = [
    {
        "role": "system",
        "content": "You are a helpful chatbot that helps people learn."
    },
    {
        "role": "user",
        "content": "What is a good way to learn to code?"
    }
]

result = client.chat.completions.create(
    "model": "Hermes-2-Pro-Llama-3-8B",
    "messages": messages,
    "max_tokens": 100
)

print(json.dumps(
    result,
    sort_keys=True,
    indent=4,
    separators=(',', ': ')
))
```
