Basic

API Reference documentation is here.

Qualifire provides an SDK to help you integrate our services into your application. The SDK is available for the following languages:

Node.js

To use the Node.js SDK, you need to install it using npm:

npm install qualifire

Then, you can use the SDK in your application:

⚠️ Note if the argument of apiKey is not provided the SDK will look for a value in the environment variable QUALIFIRE_API_KEY.

Working with OpenAI Objects

import { Qualifire } from "qualifire";
import OpenAI from "openai";

const qualifire = new Qualifire({
  apiKey: "YOUR API KEY",  // Optional: if not provided the SDK will look for a value in the environment variable QUALIFIRE_API_KEY
});

const openai = new OpenAI({
  apiKey: "YOUR OpenAI Key",
});

const input = {
  model: "gpt-3.5-turbo",
  stream: true,
  messages: [
    {
      role: "user",
      content: "tell me a joke",
    },
  ],
} as any;

async function main() {
  const chatCompletion = await openai.chat.completions.create(input);
  const response = await qualifire.evaluate(input, chatCompletion);
}

main();

⚠️ Note Streams are not yet supported

Working with Text

You can also send parsed text to the SDK for evaluation

import { Qualifire } from "qualifire";

const qualifire = new Qualifire({
  apiKey: "Your API Key", // Optional: if not provided the SDK will look for a value in the environment variable QUALIFIRE_API_KEY
});

const response = await qualifire.evaluate(
  "What is the capital of France?",
  "Paris"
);

Async evaluations

In some cases we wouldn’t want to wait for the response of the evaluation, in those cases we can use the async: true parameter in the call.

import { Qualifire } from "qualifire";

const qualifire = new Qualifire();

qualifire.evaluate("What is the capital of France?", "Paris", { async: true });

This will log the evaluation to the web UI and trigger the evaluation in the background.

ℹ️ Note The result of the evaluation is logged in the webUI of qualifire for you to check.