EcoLogits tracks and estimates the energy consumption and environmental impacts of using generative AI models through APIs.
Project description
🌱 EcoLogits tracks the energy consumption and environmental impacts of using generative AI models through APIs.
Documentation: ecologits.ai
⚙️ Installation
pip install ecologits
For integration with a specific provider, use pip install ecologits[openai]
. We are currently supporting the following providers: anthropic
, cohere
, huggingface-hub
, mistralai
and openai
. See the full list of providers.
🚀 Usage
from ecologits import EcoLogits
from openai import OpenAI
# Initialize EcoLogits
EcoLogits.init()
client = OpenAI(api_key="<OPENAI_API_KEY>")
response = client.chat.completions.create(
model="gpt-3.5-turbo",
messages=[
{"role": "user", "content": "Tell me a funny joke!"}
]
)
# Get estimated environmental impacts of the inference
print(f"Energy consumption: {response.impacts.energy.value} kWh")
print(f"GHG emissions: {response.impacts.gwp.value} kgCO2eq")
See package documentation on EcoLogits
💪 Contributing
Requirements
Have poetry installed on your system.
Easy install using a virtualenv:
Create a venv:
python3 -m venv .venv
source .venv/bin/activate
Install poetry:
pip install poetry
Install project
poetry install --all-extras --with dev,docs
Run tests
poetry run pytest
Run pre-commit hooks locally
pre-commit run --all-files
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ecologits-0.1.6.tar.gz
(19.9 kB
view hashes)
Built Distribution
ecologits-0.1.6-py3-none-any.whl
(23.9 kB
view hashes)
Close
Hashes for ecologits-0.1.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb49ba3916a9f43bad51286386bd4839e2472d04242fdc82a8cfe9a80aceb420 |
|
MD5 | 3ec35592045f1c08432095fd3c4d5e91 |
|
BLAKE2b-256 | 2ce8415ed305036f12f0c1be57081310b2acf8e0a3dfd3ba1223f5477bbe1ada |