Skip to content

Commit

Permalink
feat: remove pycountry
Browse files Browse the repository at this point in the history
  • Loading branch information
adrienbanse authored and samuelrince committed Aug 28, 2024
1 parent 76529f5 commit 9ff650e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
1 change: 0 additions & 1 deletion ecologits/electricity_mix_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from dataclasses import dataclass
from typing import Optional

reserved_codes = ["WOR", "EEE", "SCG"]

@dataclass
class ElectricityMix:
Expand Down
10 changes: 2 additions & 8 deletions ecologits/tracers/utils.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from typing import Optional

from pycountry import countries

from ecologits.electricity_mix_repository import electricity_mixes, reserved_codes
from ecologits.electricity_mix_repository import electricity_mixes
from ecologits.impacts.llm import compute_llm_impacts
from ecologits.impacts.modeling import Impacts, Range
from ecologits.model_repository import models
Expand All @@ -27,15 +25,11 @@ def llm_impacts(
model_name: Name of the LLM used.
output_token_count: Number of generated tokens.
request_latency: Measured request latency in seconds.
electricity_mix_zone: ISO 3166-1 alpha-3 code of the electricity mix zone (world electricity mix by default).
electricity_mix_zone: ISO 3166-1 alpha-3 code of the electricity mix zone (WOR by default).
Returns:
The impacts of an LLM generation request.
"""
if countries.get(alpha_3=electricity_mix_zone) is None and electricity_mix_zone not in reserved_codes:
# TODO: Replace with proper logging
print(f"`{electricity_mix_zone}` is currently not a valid ISO 3166-1 alpha-3 code")
return None

model = models.find_model(provider=provider, model_name=model_name)
if model is None:
Expand Down

0 comments on commit 9ff650e

Please sign in to comment.