Skip to main content

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)

Metadata

Release files for chkptai 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chkptai 0.1.3
File Size Uploaded
chkptai-0.1.3.tar.gz 7.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for chkptai 0.1.3
File Interpreter ABI Platform
chkptai-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 13.3 kB

Release files / chkptai-0.1.3.tar.gz

Download URL chkptai-0.1.3.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
76cd77fc2eb65390a44b497fad6eed00f6b87cf1a76d702a631b67dcac48b2f8
BLAKE2b-256 checksum
How to use checksums
9ab448fe7ec84015a47adc81de865eb61fab1d7a9cec23a081dd9a4deb0a198e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release files / chkptai-0.1.3-py3-none-any.whl

Download URL chkptai-0.1.3-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7af73e4e4c6ab5b5abc89665bd0e32b2150266aeb56ddad5c3672694d0bd8c77
BLAKE2b-256 checksum
How to use checksums
2cab3d0dc254d4e71ade1f6671ebc4460a8dcd94cc669410fb8a1d702a3acaee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page