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.3.tar.gz
(19.8 kB
view hashes)
Built Distribution
ecologits-0.1.3-py3-none-any.whl
(23.9 kB
view hashes)
Close
Hashes for ecologits-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b6862e1c8567f8d52d4a0cb92f67ec5cafa0d64672f8ebf8fd35762f6ac55e3 |
|
MD5 | c1862549222c363ea2aa478fdd77257d |
|
BLAKE2b-256 | d40a316e920f3cd59da9962258babe431ff66f2ffe1b7937e0954d240f4fecf4 |