Skip to main content

Python client library for the OpenPipe service

Project description

OpenPipe Python Client

This client allows you automatically report your OpenAI calls to OpenPipe. OpenPipe

Installation

pip install openpipe

Usage

  1. Create a project at https://app.openpipe.ai
  2. Find your project's API key at https://app.openpipe.ai/project/settings
  3. Configure the OpenPipe client as shown below.
from openpipe import openai, configure_openpipe
import os

# Set the OpenPipe API key you got in step (2) above.
# If you have the `OPENPIPE_API_KEY` environment variable set we'll read from it by default.
configure_openpipe(api_key=os.getenv("OPENPIPE_API_KEY"))

# Configure OpenAI the same way you would normally
openai.api_key = os.getenv("OPENAI_API_KEY")

You can now use your new OpenAI client, which functions identically to the generic OpenAI client while also reporting calls to your OpenPipe instance.

Special Features

Tagging

OpenPipe has a concept of "tagging." This is very useful for grouping a certain set of completions together. When you're using a dataset for fine-tuning, you can select all the prompts that match a certain set of tags. Here's how you can use the tagging feature:

completion = openai.ChatCompletion.create(
    model="gpt-3.5-turbo",
    messages=[{"role": "system", "content": "count to 10"}],
    openpipe={
        "tags": {"prompt_id": "counting"},
        "log_request": True, # Enable/disable data collection. Defaults to True.
    },
)

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

openpipe-3.3.3.tar.gz (26.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openpipe-3.3.3-py3-none-any.whl (55.6 kB view details)

Uploaded Python 3

File details

Details for the file openpipe-3.3.3.tar.gz.

File metadata

  • Download URL: openpipe-3.3.3.tar.gz
  • Upload date:
  • Size: 26.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.11 Darwin/22.5.0

File hashes

Hashes for openpipe-3.3.3.tar.gz
Algorithm Hash digest
SHA256 4429c9bf4dd7535f40f5b00245a5febcca21570397152c64c2238cd5d1fe1ab3
MD5 08507482905f322be291c29b1d3e6743
BLAKE2b-256 9c061454f055ad8aa3880102c4d416c99c40c95c0674f7492ba1258859950b96

See more details on using hashes here.

File details

Details for the file openpipe-3.3.3-py3-none-any.whl.

File metadata

  • Download URL: openpipe-3.3.3-py3-none-any.whl
  • Upload date:
  • Size: 55.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.11 Darwin/22.5.0

File hashes

Hashes for openpipe-3.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 cd236a7aa0aacf70136045b37dc79a8f74594e1779a6b428997b9d085e0c90a3
MD5 708484787a03d9c4d00be2015d10baee
BLAKE2b-256 97cdcdbc53173e21a552e9f10bae735e57c2d3329248c02af5b1642d920aa190

See more details on using hashes here.

Supported by

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