Metadata-Version: 2.1
Name: chkptai
Version: 0.1.3
Summary: Checkpoint-AI Python SDK
Author-email: Checkpoint-AI <mail@checkpoint-ai.com>
License: proprietary
Project-URL: homepage, https://checkpoint-ai.com
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: openai
Requires-Dist: typing_extensions
Provides-Extra: dev
Requires-Dist: mypy; extra == "dev"
Requires-Dist: flake8; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Requires-Dist: black; extra == "dev"
Requires-Dist: pylint; extra == "dev"

# Checkpoint-AI Python-SDK

`chkptai` is a Python library that acts as a proxy to OpenAI's API, enhancing the standard functionalities with custom processing logic for signal collection. The library allows users to interact with OpenAI services in a reliable way and seamlessly collect signals from their customers.

## Features

- **Proxy Client**: Wraps OpenAI API client methods to introduce custom behaviors.
- **Chat Completions**: Modifies chat completion responses to include additional validation and processing.
- **Image Generation**: Enhances image generation results with custom validation.
- **Feedback Integration**: Directly send feedback to Checkpoint-AI's services for model alignment.

## Installation

You can install `chkptai` using pip:

```bash
pip install chkptai
```

# Usage

To use chkptai, you will need to instantiate a ChkptAI object with your API key. Here's how to start interacting with OpenAI's API through chkptai:

```python
from chkptai import ChkptAI

API_KEY = "CHKPTAI_API_KEY"
chkptai = ChkptAI(API_KEY)

completion = chkptai.client.chat.completions.create(
  model="gpt-3.5-turbo",
  messages=[
    {"role": "user", "content": "Hello!"}
  ],
  top_logprobs=2
)

print(completion.choices[0].message)
```

# Sending Feedback

You can also send feedback directly to the Checkpoint-AI platform using the feedback method:

``` python
from chkptai import ChkptAI

API_KEY = "CHKPTAI_API_KEY"
chkptai = ChkptAI(API_KEY)

completion = client.chat.completions.create(
  model="gpt-3.5-turbo",
  messages=[
    {"role": "user", "content": "Hello!"}
  ],
  logprobs=True,
  top_logprobs=2
)

chkptAI.send_feedback(completion, "like", 1, 0)
```


