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.5.tar.gz
(19.9 kB
view hashes)
Built Distribution
ecologits-0.1.5-py3-none-any.whl
(23.9 kB
view hashes)
Close
Hashes for ecologits-0.1.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 901079b0da2d83c177d43f759dfbbdddfb65ddd678fba61a625049b28ac065bb |
|
MD5 | 2b1497ddac3581bbe0ffb571a24411f0 |
|
BLAKE2b-256 | fb9bd03d11c8c21f91c0c3d97a36fdaa03eb7605c78472a618bd9e9680323e9a |