Skip to main content

No project description provided

Project description

CallToChange 🌍

Description

CallToChange is a carbon emissions calculator for AI apps. This tool analyzes and calculates the carbon emissions generated by a company's LLM (Large Language Model) calls.

This project won first place in the environmental track at LA Hacks (hundreds of participants)


This repo is for call-to-change, a Python library that logs LLM calls with a single line of code.


How to use the Python library

Use the command pip install call-to-change to download our library. Ensure the downloaded version is >= 0.8.6.

Here is a sample script utilizing call-to-change:

from openai import OpenAI
from call_to_change import log

client = OpenAI()

log(client, 'test@test.com')

response = client.chat.completions.create(
  model="gpt-3.5-turbo",
  messages=[
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "Who won the world series in 2020?"},
  ]
)

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

How to use the log function

The log function takes in two parameters, an OpenAI client and an email address.

It modifies the client to log any text generation or image generation calls you made. These calls will be tied to the email address you input into the log function.


How to access logs

If you have an account with our web app, your logged calls can be seen through your dashboard. From there, you can view the carbon emissions tied to your OpenAI calls and the offset cost.

If not, your text generation and image generation calls will still be saved. To access your data, create an account with us here and go to the Dashboard page.


How it works

Our Python library logs LLM calls in MongoDB.

Under the hood, it does this by sending a POST request to API routes in our web app. These API routes securely handle data updates in MongoDB.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

call_to_change-0.8.7.tar.gz (2.5 kB view hashes)

Uploaded Source

Built Distribution

call_to_change-0.8.7-py3-none-any.whl (2.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page