Integration

Seamless Integration of User Feedback & Voting

How it looks in GPTBoost

In your GPTBoost Request Log, you'll instantly spot the request for which feedback was collected. There'll be a 👍 👎 ❤️ symbol describing the rating and a 🗨️ bubble if there is a comment.

All the feedback information is of course present in the JSON object, as well.

Additionally, you can now filter and export requests based on feedback ratings.

How to Start Collecting User Feedback & Voting

API Method

POST https://api.gptboost.io/v1/feedback/

Submits user feedback for a specific completion or message to the GPTBoost API.

Path Parameters

Headers

Request Body

Code Examples

# This example is for v1+ of the openai: https://pypi.org/project/openai/
from openai import OpenAI
import requests

client = OpenAI(
    base_url = "https://turbo.gptboost.io/v1",
    api_key=os.getenv("OPENAI_API_KEY")
)

# Make the request to OpenAI API
response = client.chat.completions.create(
    model="gpt-3.5-turbo",
    messages=[
        {"role": "user", "content": "Tell me an interesting fact about the Big Apple"},
    ], 
)

completion_id = response.id

# Logic to collect the user feedback
def collect_feedback(completion_id: str, rating: str, comment="" , tags=[]):

    feedback_url = "https://api.gptboost.io/v1/feedback/"

    data = {
        "message_id": completion_id,
        "rating": rating,
        "tags": tags,
        "comment": comment
    }
    # Make the post request to GPTBoost
    response = requests.post(feedback_url, json=data)

    if response.status_code == 200:
        print("Feedback submitted successfully.")
    else:
        print(f"Failed to submit feedback. Status code: {response.status_code}")
        print(response.text)


# Call collect_feedback function
collect_feedback(completion_id=completion_id, rating="positive")

Last updated