Who can use this feature: Anyone on any plan.

Introduction

User feedback is a feature that allows users to evaluate the responses generated by the LLM. This feedback can be either positive or negative, offering crucial insights into the effectiveness and relevance of the LLM’s outputs based on user’s satisfaction.

Why User Feedback

User feedback allows you to:

  • Gauge the efficacy of the LLM’s responses.
  • Optimize the user experience of your LLM app as you modify your prompts or models based on the received feedback.
  • Identify trends in feedback to make informed decisions about model training or fine-tuning.

Quick Start

Option 1: Logging Feedback using Helicone’s Node Package

If you’re using Helicone’s Node package, here’s a simplified example to log feedback:

Option 2: Logging Feedback using Fetch

Without Helicone’s Node package, you can still log feedback using the Fetch API. For detailed documentation, refer to:

Fetch API for Feedback

Not using Helicone’s Node Package? We got you, too.

In some packages or scenarios, you may not be able to retrieve headers to get the helicone-id. However, you can still log feedback by supplying a UUID as the helicone-id.

Here’s a simple example:

import OpenAI from "openai";

// Initialize the OpenAI client with Helicone integration
const openai = new OpenAI({
  apiKey: process.env.OPENAI_API_KEY,
  baseURL: "https://oai.helicone.ai/v1",
  defaultHeaders: {
    "Helicone-Auth": `Bearer ${process.env.HELICONE_API_KEY}`,
  },
});

// Generate a chat completion
const {
  data: completions,
  response,
}: { data: ChatCompletion, response: Response } = await openai.chat
  .completions({
    model: "gpt-3.5-turbo",
    messages: [{ role: "user", content: "Say hi!" }],
  })
  .withResponse();

// Retrieve the heliconeId header
const heliconeId = response.headers.get("helicone-id");

// Log feedback
const options = {
  method: "POST",
  headers: {
    "Helicone-Auth": "YOUR_HELICONE_AUTH_HEADER",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    rating: true, // true for positive, false for negative
  }),
};

const response = await fetch(
  `https://api.helicone.ai/v1/${heliconeId}/feedback`,
  options
);

Questions?

Questions or feedback? Reach out to help@helicone.ai or schedule a call with us.