Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use an uppercase L in EcoLogits #32

Merged
merged 1 commit into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Ecologits
============

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


## ⚙️ Installation
Expand All @@ -11,10 +11,10 @@ Coming soon...
## 🚀 Usage

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

Ecologits.init()
EcoLogits.init()

client = OpenAI(
api_key="<OPENAI_API_KEY>",
Expand All @@ -28,12 +28,12 @@ response = client.chat.completions.create(
)

# Get estimated environmental impacts for that inference.
print(response.impacts) # Impacts(energy=0.025, energy_unit='Wh', ...)
print(response.impacts) # Impacts(energy=0.025, energy_unit='Wh', ...)
```



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

## 💪 Contributing

Expand Down
4 changes: 2 additions & 2 deletions ecologits/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .ecologits import Ecologits
from .ecologits import EcoLogits

__all__ = ["Ecologits"]
__all__ = ["EcoLogits"]
6 changes: 3 additions & 3 deletions ecologits/ecologits.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
from ecologits.exceptions import TracerInitializationError


class Ecologits:
class EcoLogits:
initialized = False

@staticmethod
def init() -> None:
if Ecologits.initialized:
if EcoLogits.initialized:
raise TracerInitializationError()
init_instruments()
Ecologits.initialized = True
EcoLogits.initialized = True


def init_instruments() -> None:
Expand Down
4 changes: 2 additions & 2 deletions ecologits/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class EcologitsError(Exception):
class EcoLogitsError(Exception):
pass


class TracerInitializationError(EcologitsError):
class TracerInitializationError(EcoLogitsError):
"""Tracer is initialized twice"""
pass
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry]
name = "ecologits"
version = "0.1.0"
description = "Ecologits tracks and estimates the energy consumption and environmental impacts of using generative AI models through APIs."
description = "EcoLogits tracks and estimates the energy consumption and environmental impacts of using generative AI models through APIs."
authors = ["DataForGood"]
license = "MIT"
readme = "README.md"
Expand Down
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pytest

from ecologits import Ecologits
from ecologits import EcoLogits


@pytest.fixture(autouse=True)
Expand All @@ -28,4 +28,4 @@ def vcr_config():

@pytest.fixture(scope="session")
def tracer_init():
Ecologits.init()
EcoLogits.init()
8 changes: 4 additions & 4 deletions tests/test_tracer.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import pytest
from ecologits import Ecologits
from ecologits.exceptions import EcologitsError
from ecologits import EcoLogits
from ecologits.exceptions import EcoLogitsError


def test_double_init(tracer_init):
with pytest.raises(EcologitsError) as e:
Ecologits.init() # Second initialization
with pytest.raises(EcoLogitsError) as e:
EcoLogits.init() # Second initialization
Loading