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
Built Distribution
Hashes for call_to_change-0.8.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41538e04f239b1e445165a976fb236bf1470f44d8ef7dbc63e249a6b294114d2 |
|
MD5 | 80b2cf28e801e0210f2a5b69078058a0 |
|
BLAKE2b-256 | 4f78b7ab2b9d46a7cc3262152f0031a1ccca65d2700cfb3a3a499cd75495ee53 |