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.4.tar.gz
(20.0 kB
view hashes)
Built Distribution
ecologits-0.1.4-py3-none-any.whl
(24.0 kB
view hashes)
Close
Hashes for ecologits-0.1.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97ae1affdc14b597e624b9002bdcf9571e55c293af08285de2dcdc919acf09b2 |
|
MD5 | cf94231cdaecd97e547389e6df33b2eb |
|
BLAKE2b-256 | 3c0a6524b126dc6d408f8a682e1cde632073479f19485e91ba58ce83272f3d80 |