qualifire
v1.2.1
Published
Qualifire client SDK
Downloads
12,163
Readme
Qualifire
Qualifire SDK
This is the official SDK for interacting with the Qualifire API.
Installation
npm install qualifire
usage
First, import the Qualifire
class from the SDK:
import { Qualifire } from 'qualifire-sdk';
Then, create a new instance of the Qualifire class, passing your API key and the base URL of the Qualifire API:
const qualifire = new Qualifire({
apiKey: 'your-api-key',
});
ℹ️ There are default environment variables if you prefer to set it that way QUALIFIRE_API_KEY
You can now use the evaluate
method to evaluate input and output data:
const input = {
model: 'gpt-3.5-turbo',
messages: [
{
role: 'user',
content: 'this is my awesome request',
},
],
};
const output = await openai.chat.completions.create(input);
const evaluationResponse = await qualifire.evaluate(input, output); // This will block until the evaluation is done
console.log(evaluationResponse);
Non-blocking execution
In case you want to trigger a completely async evaluation (to view in qualifire's UI) simply add the {async: true}
option to your call.
const input = {
model: 'gpt-3.5-turbo',
messages: [
{
role: 'user',
content: 'this is my awesome request',
},
],
};
const output = await openai.chat.completions.create(input);
const evaluationResponse = await qualifire.evaluate(input, output, {
async: true,
}); // This will block until the evaluation is done
console.log(evaluationResponse);
Evaluates the input and output using the Qualifire API. Returns a promise that resolves to the evaluation response, or undefined if async is true.