Metadata-Version: 2.1
Name: ecologits
Version: 0.1.2
Summary: EcoLogits tracks and estimates the energy consumption and environmental impacts of using generative AI models through APIs.
Home-page: https://github.com/genai-impact/ecologits
License: MPL-2.0
Author: GenAI Impact
Maintainer: GenAI Impact
Requires-Python: >=3.9,<4
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved
Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: OS Independent
Classifier: Operating System :: POSIX
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Internet
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Provides-Extra: anthropic
Provides-Extra: cohere
Provides-Extra: huggingface-hub
Provides-Extra: mistralai
Provides-Extra: openai
Requires-Dist: aiohttp (>=3.9.3,<4.0.0) ; extra == "huggingface-hub"
Requires-Dist: anthropic (>=0.18.1,<0.19.0) ; extra == "anthropic"
Requires-Dist: cohere (>=5.2.5,<6.0.0) ; extra == "cohere"
Requires-Dist: huggingface-hub (>=0.22.2,<0.23.0) ; extra == "huggingface-hub"
Requires-Dist: minijinja (>=1.0.16,<2.0.0) ; extra == "huggingface-hub"
Requires-Dist: mistralai (>=0.1.3,<0.2.0) ; extra == "mistralai"
Requires-Dist: openai (>=1.12.0,<2.0.0) ; extra == "openai"
Requires-Dist: packaging (>=24.0,<25.0)
Requires-Dist: pydantic (>=2,<3)
Requires-Dist: tiktoken (>=0.6.0,<0.7.0) ; extra == "huggingface-hub"
Requires-Dist: wrapt (>=1.14.1,<2.0.0)
Project-URL: Repository, https://github.com/genai-impact/ecologits
Description-Content-Type: text/markdown

EcoLogits
============

**EcoLogits** tracks and estimates the energy consumption and environmental impacts of using generative AI models through APIs.


## ⚙️ Installation

```shell
pip install ecologits
```

## 🚀 Usage

```python
from ecologits import EcoLogits
from openai import OpenAI

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 for that inference.
print(response.impacts)  # Impacts(energy=0.025, energy_unit='Wh', ...)
```



See package documentation on [EcoLogits](<link-to-mkdocs-material>)

## 💪 Contributing

### Requirements

Have [poetry](https://python-poetry.org/docs/#installation) installed on your system.


<details>
<summary>
Easy install using a virtualenv:
</summary>

Create a venv:

```shell
python3 -m venv .venv
source .venv/bin/activate
```

Install poetry:

```shell
pip install poetry
```

</details>


### Install project

```shell
poetry install --all-extras --with dev,docs
```


### Run tests

```shell
poetry run pytest
```


### Run pre-commit hooks locally

[Install pre-commit](https://pre-commit.com/)

```shell
pre-commit run --all-files
```

