0.46.0 • Published 4 months ago

openpipe v0.46.0

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
4 months ago

OpenPipe Node API Library

NPM version

This library wraps TypeScript or Javascript OpenAI API calls and logs additional data to the configured OPENPIPE_BASE_URL for further processing.

It is fully compatible with OpenAI's sdk and logs both streaming and non-streaming requests and responses.

Installation

npm install --save openpipe
# or
yarn add openpipe

Import

ESM

// import OpenAI from "openai"
import OpenAI from "openpipe/openai";

CJS

// const OpenAI = require("openai")
const OpenAI = require("openpipe/openai").default;

Usage

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

// Fully compatible with original OpenAI initialization
const openai = new OpenAI({
  apiKey: "my api key", // defaults to process.env["OPENAI_API_KEY"]
  // openpipe key is optional
  openpipe: {
    apiKey: "my api key", // defaults to process.env["OPENPIPE_API_KEY"]
    baseUrl: "my url", // defaults to process.env["OPENPIPE_BASE_URL"] or https://api.openpipe.ai/api/v1 if not set
  },
});

async function main() {
  // Allows optional openpipe object
  const completion = await openai.chat.completions.create({
    messages: [{ role: "user", content: "Say this is a test" }],
    model: "gpt-4o",
    // optional
    store: true,
    metadata: {
      prompt_id: "extract_user_intent",
      any_key: "any_value",
    },
  });

  console.log(completion.choices);
}

main();
0.43.0

5 months ago

0.41.0

6 months ago

0.38.0

7 months ago

0.36.0

7 months ago

0.34.0

8 months ago

0.46.0

4 months ago

0.44.0

5 months ago

0.42.0

5 months ago

0.40.0

7 months ago

0.39.0

7 months ago

0.37.0

7 months ago

0.35.0

7 months ago

0.33.0

8 months ago

0.32.0

8 months ago

0.31.0

8 months ago

0.30.0

8 months ago

0.27.0

9 months ago

0.25.0

10 months ago

0.28.0

9 months ago

0.26.0

9 months ago

0.20.0

11 months ago

0.19.0

12 months ago

0.15.0

1 year ago

0.17.0

1 year ago

0.23.0

11 months ago

0.21.0

11 months ago

0.16.0

1 year ago

0.18.0

12 months ago

0.24.0

10 months ago

0.22.0

11 months ago

0.14.0

1 year ago

0.13.0

1 year ago

0.12.0

1 year ago

0.11.0

1 year ago

0.10.0

1 year ago

0.8.4

1 year ago

0.8.3

1 year ago

0.8.1

1 year ago

0.8.2

1 year ago

0.8.0

1 year ago

0.7.2

1 year ago

0.7.1

1 year ago

0.7.0

1 year ago

0.6.6

2 years ago

0.6.5

2 years ago

0.6.4

2 years ago

0.6.3

2 years ago

0.4.5

2 years ago

0.6.2

2 years ago

0.4.4

2 years ago

0.4.6

2 years ago

0.5.0

2 years ago

0.6.1

2 years ago

0.5.2

2 years ago

0.4.3

2 years ago

0.6.0

2 years ago

0.5.1

2 years ago

0.3.6-beta.0

2 years ago

0.4.0-beta.0

2 years ago

0.4.0-beta.1

2 years ago

0.3.6

2 years ago

0.4.0-beta.2

2 years ago

0.4.0-beta.3

2 years ago

0.4.1

2 years ago

0.4.0

2 years ago

0.4.2

2 years ago

0.3.5

2 years ago

0.3.4

2 years ago

0.3.3

2 years ago

0.3.2

2 years ago

0.3.0

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago