Skip to content

Commit

Permalink
docs: enhance welcome page
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelrince committed Apr 21, 2024
1 parent 6e43b12 commit 3b16c70
Show file tree
Hide file tree
Showing 9 changed files with 105 additions and 11 deletions.
File renamed without changes.
4 changes: 4 additions & 0 deletions docs/contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

!!! warning

This page is under construction.
72 changes: 64 additions & 8 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,56 @@
![EcoLogits](assets/logo_dark.png#only-dark)
</figure>

**EcoLogits** tracks the energy consumption and environmental impacts of using generative AI models through APIs.
**EcoLogits** tracks the energy consumption and environmental impacts of using generative AI models through APIs. It supports major LLM providers such as OpenAI, Anthropic, Mistral AI and more (see [supported providers](providers.md)).


## Requirements

Python 3.9+

EcoLogits relies on key libraries to provide essential functionalities:

* [Pydantic :octicons-link-external-16:](https://docs.pydantic.dev/) for data modeling.
* [Wrapt :octicons-link-external-16:](https://wrapt.readthedocs.io/) for function patching.


## Installation

To install EcoLogits, use the following command:

```shell
pip install ecologits
```

For integration with specific Large Language Model (LLM) providers like OpenAI, additional dependencies can be installed using:

```shell
pip install ecologits[openai]
```

EcoLogits currently supports the following LLM providers:

- `anthropic`
- `cohere`
- `huggingface-hub` (Hugging Face Inference Endpoints)
- `mistralai`
- `openai`

Check out the complete list of [supported providers and features](providers.md).


## Usage Example

## Usage
Below is a simple example demonstrating how to use the GPT-3.5-Turbo model from OpenAI with EcoLogits to track environmental impacts.

```python
```python hl_lines="5"
from ecologits import EcoLogits
from openai import OpenAI

# Initialize EcoLogits
EcoLogits.init()

client = OpenAI(
api_key="<OPENAI_API_KEY>",
)
client = OpenAI(api_key="<OPENAI_API_KEY>")

response = client.chat.completions.create(
model="gpt-3.5-turbo",
Expand All @@ -34,6 +63,33 @@ response = client.chat.completions.create(
]
)

# Get estimated environmental impacts for that inference.
print(response.impacts) # Impacts(energy=0.025, energy_unit='Wh', ...)
# Get estimated environmental impacts of the inference
print(f"Energy consumption: {response.impacts.energy.value} kWh")
print(f"GHG emissions: {response.impacts.gwp.value} kgCO2eq")
```

Environmental impacts are quantified based on four criteria and across two phases:

Criteria:

- **Energy** (energy): Final energy consumption in kWh,
- **Global Warming Potential** (gwp): Potential impact on global warming in kgCO2eq (commonly known as GHG/carbon emissions),
- **Abiotic Depletion Potential for Elements** (adpe): Impact on the depletion of non-living resources such as minerals or metals in kgSbeq,
- **Primary Energy** (pe): Total energy consumed from primary sources in MJ.

Phases:

- **Usage** (usage): Represents the phase of energy consumption during model execution,
- **Embodied** (embodied): Encompasses resource extraction, manufacturing, and transportation phases associated with the model's lifecycle.

!!! info "Learn more about environmental impacts assessment in the [methodology](methodology.md) section."


## License

This project is licensed under the terms of the [Mozilla Public License Version 2.0 (MPL-2.0) :octicons-link-external-16:](https://www.mozilla.org/en-US/MPL/2.0/).


## Acknowledgements

**EcoLogits** is actively developed and maintained by [GenAI Impact :octicons-link-external-16:](https://genai-impact.org/) non-profit. We extend our gratitude to [Data For Good :octicons-link-external-16:](https://dataforgood.fr/) and [Boavizta :octicons-link-external-16:](https://boavizta.org/en) for supporting the development of this project. Their contributions of tools, best practices, and expertise in environmental impact assessment have been invaluable.
4 changes: 4 additions & 0 deletions docs/methodology.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

!!! warning

This page is under construction.
14 changes: 14 additions & 0 deletions docs/providers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Supported providers

## Chat Completions

| Provider | Completions | Completions (stream) | Completions (async) | Completions (async + stream) |
|-----------------|:----------------------------------:|:---------------------------------:|:---------------------------------:|:---------------------------------:|
| Anthropic | :material-checkbox-marked-circle: | :material-check-circle-outline: | :material-checkbox-marked-circle: | :material-check-circle-outline: |
| Cohere | :material-checkbox-marked-circle: | :material-checkbox-marked-circle: | :material-checkbox-marked-circle: | :material-checkbox-marked-circle: |
| HuggingFace Hub | :material-checkbox-marked-circle: | :material-checkbox-marked-circle: | :material-checkbox-marked-circle: | :material-checkbox-marked-circle: |
| Mistral AI | :material-checkbox-marked-circle: | :material-checkbox-marked-circle: | :material-checkbox-marked-circle: | :material-checkbox-marked-circle: |
| OpenAI | :material-checkbox-marked-circle: | :material-checkbox-marked-circle: | :material-checkbox-marked-circle: | :material-checkbox-marked-circle: |

[//]: # (TODO: Add anthropic page)
Partial support for Anthropic streams, see full documentation: [Anthropic provider](anthropic.md).
4 changes: 4 additions & 0 deletions docs/roadmap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

!!! warning

This page is under construction.
4 changes: 4 additions & 0 deletions docs/tutorial.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

!!! warning

This page is under construction.
4 changes: 4 additions & 0 deletions docs/why.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

!!! warning

This page is under construction.
10 changes: 7 additions & 3 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ repo_url: https://github.com/genai-impact/ecologits
nav:
- 'Get Started':
- 'Welcome to EcoLogits': index.md
- 'Tutorial': coming_soon.md
- 'Methodology': coming_soon.md
- 'API Reference': coming_soon.md
- 'Why use EcoLogits': why.md
- 'Supported providers': providers.md
- 'Roadmap': roadmap.md
- 'Contributing': contributing.md
- 'Tutorial': tutorial.md
- 'Methodology': methodology.md
- 'API Reference': api_reference.md


theme:
Expand Down

0 comments on commit 3b16c70

Please sign in to comment.