Save cost in OpenAI API calls using LLUMO compressor API
logging.basicConfig()
to configure the logging system. The level=logging.INFO
argument sets the threshold for logging messages to INFO level and above.getpass()
to prompt the user for their API keys. This function hides the input, making it more secure than using regular input().os.environ
to set environment variables for both API keys.os.getenv("OPENAI_API_KEY")
retrieves the API key from the environment variables.compress_with_llumo
that takes a text input and an optional topic.requests.post()
to send a POST request to the Llumo API.
response.raise_for_status()
will raise an exception for HTTP errors.