Use the OpenPipe SDK as a drop-in replacement for the generic OpenAI package. We currently support logging OpenAI calls and support for more LLM providers will be added soon.

  • Python

  • NodeJS

Find the SDK at https://pypi.org/project/openpipe/

Simple Integration

Add OPENPIPE_API_KEY to your environment variables.

export OPENPIPE_API_KEY=opk-<your-api-key>
# Or you can set it in your code, as shown in the example below

Replace this line

from openai import OpenAI

with this one

from openpipe import OpenAI

Adding Searchable Tags

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:

from openpipe import OpenAI
import os

client = OpenAI(
    # defaults to os.environ.get("OPENAI_API_KEY")
    api_key="My API Key",
    openpipe={
        # defaults to os.environ.get("OPENPIPE_API_KEY")
        "api_key": "My OpenPipe API Key",
    }
)

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