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.7.tar.gz
(20.0 kB
view hashes)
Built Distribution
ecologits-0.1.7-py3-none-any.whl
(24.1 kB
view hashes)
Close
Hashes for ecologits-0.1.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3cad6b746c5fe9ea8f2ce248be988715084d8e87d12e514f30d9dccc980f63c |
|
MD5 | 15f05d09b49e4f8db2e4460a8dc56be9 |
|
BLAKE2b-256 | 1ace71d374d1a33e507860ba02d3092e2cd4e404b9b8f18d405466d68e7f9e4e |