Omit Logging

Exploring the Power of Optional Headers

GPTBoost, by default, logs every single request and response—it's the core idea. However, in our vast experience, we've learned that there are situations where full logs are simply unwanted or unnecessary. Imagine you're developing, debugging, or dealing with automated processes where logging every single step feels like overkill. Or maybe you're handling sensitive data that requires extra care. The list goes on.

No worries, in the context of GPTBoost optional HEADERS parameters provide you with fine-grained control over which data is saved.

Here's the good news: GPTBoost offers optional headers that put you in control. Meet GPTBoost-Request-Logging, which defaults to true, ensuring all requests are logged. If you wish to exclude a specific request from the logs, simply set this parameter in the headers to false.

Similarly, there's GPTBoost-Response-Logging, also set to true by default. If you want to skip logging a particular response, just set it to false.

Usage

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

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

# headers are optional
headers = {
      "GPTBoost-Request-Logging": "false", # default is true, set to false to disable logging
      "GPTBoost-Response-Logging": "false" # default is true, set to false to disable logging
  }

response = client.chat.completions.create(
    model="gpt-3.5-turbo",
    messages=[
        {"role": "user", "content": "Tell me an interesting fact about Health Insurance"},
    ], 
    extra_headers=headers
)

print(response.choices[0].message.content)

Visualization

The result? All omitted requests and responses appear as filtered entries in the Product X dashboard.

Modifying GPTBoost-Request-Logging and GPTBoost-Response-Logging parameters grants you the flexibility to customize GPTBoost behaviour according to your specific needs. Whether it's for data management, cost control, or compliance with data privacy regulations, these optional HEADERS parameters empower users with precise control over which data is saved and logged.

Last updated