etalab-ia / albert-tchap

Bot for Tchap (the messaging app of the French State) using Albert, the French administration Artificial Intelligence agent
MIT License
13 stars 1 forks source link
bot llm messaging

Albert Tchap

English version below

| Albert API sur GitHub | Modèles Albert sur HuggingFace |

Description du projet

Bot pour Tchap, l'application de messagerie de l'administration française. Ce bot utilise Albert, l'agent conversationnel (large language models, LLM) de l'administration française, pour répondre à des questions sur Tchap, l'application de messagerie de l'administration française.

Le projet est un POC (Proof of Concept - preuve de concept) pour montrer comment un bot peut être utilisé pour répondre à des questions sur Tchap en utilisant Albert. Il s'agit d'un travail WIP (Work In Progress - en cours de développement) et n'est pas (encore) destiné à être utilisé en production.

Le projet est un fork de tchap_bot qui est un bot Matrix pour Tchap, conçu par le Pôle d'Expertise de la Régulation Numérique. La partie bibliothèque (matrix_bot) est fortement inspirée de https://github.com/imbev/simplematrixbotlib.

Contient :

Installation locale

Le projet utilise un fichier de dépendances et de config pyproject.toml et non un fichier requirements.txt. Il est donc nécessaire d'utiliser pip en version 19.0 ou supérieure, ou bien avec un package manager comme pdm, pip-tools, uv, rye, hatch etc. (mais pas poetry qui n'utilise pas le standard pyproject.toml).

# Récupération du code avec Git
git clone ${GITHUB_URL}

# Création d'un environnement virtuel Python
python3 -m venv .venv

# Activation de l'environnement virtuel Python
source .venv/bin/activate

# Installation des dépendances
pip install .

Configuration

Créez le fichier d'environnement app/.env avec les informations de connexion (ou fournissez-les en variables d'environnement). Vous pouvez vous inspirer du fichier app/.env.example qui est initialisé avec les valeurs par défaut :

cp app/.env.example app/.env

L'ensemble des variables d'environements disponibles est documenté dans le fichier suivant : app/config.py

Lancer le bot

Pour lancer le bot executez :

python app

Troubleshooting

Le premier sync est assez long, et a priori non bloquant. Si vous avez une interaction avec le bot avant qu'il se soit bien sync vous risquez de le laisser dans un état instable (où le bot n'a pas le listing des rooms).

Contribution

Le projet est en open source, sous licence MIT. Toutes les contributions sont bienvenues, sous forme de pull requests ou d'ouvertures d'issues sur le repo officiel GitHub.

Pour commencer, consultez CONTRIBUTING.md.

Licence

Ce projet est sous licence MIT. Une copie intégrale du texte de la licence se trouve dans le fichier LICENSES/MIT.txt.


English version

English version | Albert API on GitHub | Albert models on HuggingFace | ## Project Description Bot for [Tchap, the French government messaging application](https://tchap.beta.gouv.fr/). This bot uses [Albert](https://github.com/etalab-ia/albert), the conversational agent (large language models, LLM) of the French government, to answer questions about [Tchap](https://tchap.beta.gouv.fr/). The project is a Proof of Concept (POC) to show how a bot can be used to answer questions about Tchap using Albert. It is a Work In Progress (WIP) and is not (yet) intended for production use. The project is a fork of [tchap_bot](https://code.peren.fr/open-source/tchapbot) which is a Matrix bot for Tchap, designed by the [Pôle d'Expertise de la Régulation Numérique](https://www.peren.gouv.fr/). The library part (`matrix_bot`) is heavily inspired by https://github.com/imbev/simplematrixbotlib. Contains: - `app/.`: the codebase for the Albert Tchap bot - `app/matrix_bot`: a library that wraps [matrix-nio](https://github.com/matrix-nio/matrix-nio) to make Matrix bots ### Local Installation The project uses a dependencies and config file `pyproject.toml` and not a `requirements.txt` file. It is therefore necessary to use `pip` in version 19.0 or higher, or with a package manager like `pdm`, `pip-tools`, `uv`, `rye`, `hatch` etc. (but not `poetry` which does not use the standard `pyproject.toml`). ```bash # Getting the code with Git git clone ${GITHUB_URL} # Creating a Python virtual environment python3 -m venv .venv # Activating the Python virtual environment source .venv/bin/activate # Installing dependencies pip install . ``` ### Configuration Create the environment file `app/.env` with the connection information (or provide them as environment variables). You can use the `app/.env.example` file as inspiration, which is initialized with default values: ```bash cp app/.env.example app/.env ``` The set of available environment variables is documented in the following file: [app/config.py](./app/config.py) ### Run the bot To launch the bot: ```bash python app ``` ### Troubleshooting The first sync is quite long, and apparently non-blocking. If you interact with the bot before it has synced properly, you risk leaving it in an unstable state (where the bot does not have the room listing). ### Contribution This project is open source, under the [MIT license](LICENSES/MIT.txt). All contributions are welcome, in the form of pull requests or issue openings on the [repo officiel GitHub](https://github.com/etalab-ia/albert-tchapbot). To get started, take a look at [CONTRIBUTING.md](CONTRIBUTING.md). ### License This project is licensed under the MIT License. A full copy of the license text can be found in the `LICENSES/MIT.txt` file.