Skip to main content

Checkpoint-AI Python SDK

Project description

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:

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:

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:

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chkptai-0.1.3.tar.gz (7.5 kB view hashes)

Uploaded Source

Built Distribution

chkptai-0.1.3-py3-none-any.whl (5.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page