ecologits.tracking
¶
ImpactsTracker(providers)
¶
Context manager that collects the impacts of the LLM calls made inside it.
Use it through EcoLogits.track_impacts(). Supports both with and async with.
Attributes:
| Name | Type | Description |
|---|---|---|
providers |
Providers whose calls are tracked. |
|
calls |
list[ImpactsOutput]
|
Impacts of each tracked call, in completion order. |
Source code in ecologits/tracking.py
impacts
property
¶
Total impacts of the tracked calls.
get_active_trackers(provider)
¶
Get the trackers open in the current context that track a provider.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
provider
|
str
|
Name of the provider. |
required |
Returns:
| Type | Description |
|---|---|
tuple[ImpactsTracker, ...]
|
The open trackers that track the provider. |
Source code in ecologits/tracking.py
is_tracking_enabled(provider)
¶
Check if a call to a provider should be tracked.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
provider
|
str
|
Name of the provider. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the provider was enabled with |
Source code in ecologits/tracking.py
record_impacts(trackers, impacts)
¶
Add the impacts of a call to the given trackers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
trackers
|
tuple[ImpactsTracker, ...]
|
Trackers that were open when the call started. |
required |
impacts
|
ImpactsOutput
|
Impacts of the call. |
required |