ecologits.tracers.utils
¶
ImpactsStream(stream, items)
¶
AsyncImpactsStream(stream, items)
¶
ImpactsOutput
¶
Bases: BaseModel
Impacts output data model.
Attributes:
| Name | Type | Description |
|---|---|---|
energy |
Energy | None
|
Total energy consumption |
gwp |
GWP | None
|
Total Global Warming Potential (GWP) impact |
adpe |
ADPe | None
|
Total Abiotic Depletion Potential for Elements (ADPe) impact |
pe |
PE | None
|
Total Primary Energy (PE) impact |
wcf |
WCF | None
|
Usage-only Water Consumption Footprint (WCF) impact |
usage |
Usage | None
|
Impacts for the usage phase |
embodied |
Embodied | None
|
Impacts for the embodied phase |
warnings |
list[WarningMessage] | None
|
List of warnings |
errors |
list[ErrorMessage] | None
|
List of errors |
is_raw_response_request(kwargs)
¶
Check if a request was made with with_raw_response or with_streaming_response.
The OpenAI and Anthropic clients add the X-Stainless-Raw-Response header to these requests and return the raw
HTTP response instead of the parsed model, so there is nothing to add impacts to.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kwargs
|
dict[str, Any]
|
Keyword arguments of the request. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the client returns the raw HTTP response for this request. |
Source code in ecologits/tracers/utils.py
llm_impacts(provider, model_name, output_token_count, request_latency, electricity_mix_zone=None, *, datacenter_pue=None, datacenter_wue=None)
¶
Compute LLM impacts using the deprecated tracer utility interface.
Deprecated
Use ecologits.estimations.text_impacts for standalone text generation
estimates. See the text generation tutorial for argument mappings.
Preserves the original arguments and calculations, including measured request latency. The replacement estimates latency and requires total input tokens and a namespaced model identifier, so migration may change the resulting estimates.