lemone-api
Lemone: the API for french tax law and embeddings computation 🇫🇷
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
âś“.zenodo.json file
Found .zenodo.json file -
â—‹DOI references
-
â—‹Academic publication links
-
â—‹Academic email domains
-
â—‹Institutional organization owner
-
â—‹JOSS paper metadata
-
â—‹Scientific vocabulary similarity
Low similarity (15.1%) to scientific vocabulary
Keywords
Repository
Lemone: the API for french tax law and embeddings computation 🇫🇷
Basic Info
- Host: GitHub
- Owner: louisbrulenaudet
- License: apache-2.0
- Language: Python
- Default Branch: main
- Homepage: https://louisbrulenaudet.com
- Size: 2.02 MB
Statistics
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 8
- Releases: 3
Topics
Metadata Files
README.md
![]()
Lemone: the API for French tax data retrieval and classification.
The API is tailored to meet the specific demands of information retrieval and classification across large-scale tax-related corpora, supporting the implementation of production-ready Retrieval-Augmented Generation (RAG) applications. Its primary purpose is to enhance the efficiency and accuracy of legal processes in the french taxation domain, with an emphasis on delivering consistent performance in real-world settings, while also contributing to advancements in legal natural language processing research.
Usage
This API is based on the use of uv for package management, ruff for linting and type validation and docker (with dramatiq and redis for asynchronous task management) and can be used exclusively on the basis of the Makefile, whose list of commands can be obtained with make help.
To launch the application and associated services, you need to run:
bash
make build
make start
Or using Docker:
bash
docker pull louisbrulenaudet/lemone-api
API Documentation
Endpoints
The API provides both synchronous and asynchronous endpoints for each operation. Synchronous endpoints return results immediately, while asynchronous endpoints return a task ID that can be used to check the status and retrieve results later.
1. Similarity API
Purpose: Calculate similarity scores between multiple input texts. This endpoint computes a similarity matrix showing the relationships between provided texts, useful for finding related documents or measuring text similarity. Features built-in caching (60s TTL) and supports both single and batch document comparisons.
Endpoint:
POST http://localhost:8687/api/v1/similarity
Request Body:
json
{
"input": [
"Pour les cessions d’actions, de parts de fondateurs ou de parts de bénéficiaires de sociétés par action, autres que celles des personnes morales à prépondérance immobilière, ainsi que pour les parts ou titres de capital souscrits par les clients des établissements mutualistes ou coopératifs, le droit d’enregistrement est fixé à 0,1 %.",
"La liste des sociétés françaises dont les titres entrent dans le champ de la taxe sur les transactions financières prévue par les dispositions de l'article 235 ter ZD du code général des impôts au 1er décembre 2022 est mise à jour."
]
}
Response:
json
{
"model": "louisbrulenaudet/lemone-embed-pro",
"object": "list",
"data": {
"object": "similarity",
"data": [
[
1.0000003576278687,
0.43992409110069275
],
[
0.43992409110069275,
1.0000003576278687
]
]
}
}
2. Classification API
Purpose: Classify text inputs into predefined French tax law categories. Uses specialized models to analyze and categorize text according to the 8-category tax law classification scheme. Includes caching for repeated requests and supports both individual and batch classification.
Endpoint:
POST http://localhost:8687/api/v1/classification
Request Body:
json
{
"input": [
"Pour les cessions d’actions, de parts de fondateurs ou de parts de bénéficiaires de sociétés par action, autres que celles des personnes morales à prépondérance immobilière, ainsi que pour les parts ou titres de capital souscrits par les clients des établissements mutualistes ou coopératifs, le droit d’enregistrement est fixé à 0,1 %.",
"La liste des sociétés françaises dont les titres entrent dans le champ de la taxe sur les transactions financières prévue par les dispositions de l'article 235 ter ZD du code général des impôts au 1er décembre 2022 est mise à jour."
]
}
Response:
json
{
"model": "louisbrulenaudet/lemone-router-l",
"object": "list",
"data": [
{
"object": "classification",
"label": "Patrimoine et enregistrement",
"score": 0.9997046589851379,
"index": 0
},
{
"object": "classification",
"label": "Fiscalité des entreprises",
"score": 0.9994685053825378,
"index": 1
}
]
}
3. Embeddings API
Purpose: Generate vector embeddings for input text. Creates high-quality text representations for use in similarity search, semantic analysis, or other machine learning tasks. Optimized for French tax law content with built-in caching and support for different model variants.
Endpoint:
POST http://localhost:8687/api/v1/embeddings
Request Body:
json
{
"input": "Pour les cessions d’actions, de parts de fondateurs ou de parts de bénéficiaires de sociétés par action, autres que celles des personnes morales à prépondérance immobilière, ainsi que pour les parts ou titres de capital souscrits par les clients des établissements mutualistes ou coopératifs, le droit d’enregistrement est fixé à 0,1 %.",
"model": "louisbrulenaudet/lemone-embed-pro"
}
Response:
json
{
"model": "louisbrulenaudet/lemone-embed-pro",
"object": "list",
"data": [
{
"input": "Pour les cessions d’actions, de parts de fondateurs ou de parts de bénéficiaires de sociétés par action, autres que celles des personnes morales à prépondérance immobilière, ainsi que pour les parts ou titres de capital souscrits par les clients des établissements mutualistes ou coopératifs, le droit d’enregistrement est fixé à 0,1 %.",
"index": 0,
"object": "embedding",
"embedding": [
-0.10794082283973694,
0.036172136664390564,
"..."
]
}
]
}
Note: All synchronous routes provided in this API are also implemented as asynchronous routes. The asynchronous implementations execute operations using a worker and queue system to handle load and ensure scalability.
Endpoint: Get Evaluation Status
Purpose: Monitor the progress of asynchronous operations. This endpoint allows tracking of any async task (embeddings, similarity, or classification) using its task ID. Returns the task's current status, queue position, and processing details. Essential for managing long-running operations and implementing robust error handling.
Endpoint:
GET http://127.0.0.1:8687/api/v1/task/status/{task_id}
Request Parameters
| Parameter | Type | Description |
|------------|----------|--------------|
| task_id | string | The unique identifier of the evaluation task. Example: "8cdb0dbc-33f1-4120-9e54-86e247101832". |
Response Format
The API returns a JSON object containing evaluation details.
| Key | Value |
|---------------|--------------|
| queuename | `{queuename}|
| task_name |{taskname}` |
| taskid | {task_id} |
| tasktimestamp | `{tasktimestamp}` |
Example Response
json
{
"queue_name": "embeddings",
"task_name": "embeddings",
"task_id": "3ec2b643-4d23-4803-9eb0-f5b5c2989d69",
"task_timestamp": 1738745812497
}
Models
Lemone-Embed: A Series of Fine-Tuned Embedding Models for French Tax
These series are made up of 7 models: 3 basic models of different sizes trained for 1 epoch, 3 models trained for 2 epochs forming the Boost series, and Pro models with non-RoBERTa architectures.
These sentence transformer models, specifically designed for French taxation, have been fine-tuned on datasets comprising 43 million tokens, integrating blends of semi-synthetic and fully synthetic data generated by GPT-4 Turbo and Llama 3.1 70B. These datasets have been further refined through evol-instruction tuning and manual curation.
Training Hardware
- On Cloud: No
- GPU Model: 1 x NVIDIA H100 NVL
- CPU Model: AMD EPYC 9V84 96-Core Processor
- RAM Size: 314.68 GB
Lemone-Router: A Series of Fine-Tuned Classification Models for French Tax
Lemone-router is a series of classification models designed to produce an optimal multi-agent system for different branches of tax law. Trained on a base of 49k lines comprising a set of synthetic questions generated by GPT-4 Turbo and Llama 3.1 70B, which have been further refined through evol-instruction tuning and manual curation and authority documents, these models are based on an 8-category decomposition of the classification scheme derived from the Bulletin officiel des finances publiques - impĂ´ts :
```python label2id = { "Bénéfices professionnels": 0, "Contrôle et contentieux": 1, "Dispositifs transversaux": 2, "Fiscalité des entreprises": 3, "Patrimoine et enregistrement": 4, "Revenus particuliers": 5, "Revenus patrimoniaux": 6, "Taxes sur la consommation": 7 }
id2label = { 0: "Bénéfices professionnels", 1: "Contrôle et contentieux", 2: "Dispositifs transversaux", 3: "Fiscalité des entreprises", 4: "Patrimoine et enregistrement", 5: "Revenus particuliers", 6: "Revenus patrimoniaux", 7: "Taxes sur la consommation" } ```
This model is a fine-tuned version of intfloat/multilingual-e5-large. It achieves the following results on the evaluation set: - Loss: 0.4734 - Accuracy: 0.9191
Training Hardware
- On Cloud: No
- GPU Model: 1 x NVIDIA H100 NVL
- CPU Model: AMD EPYC 9V84 96-Core Processor
Citation
BibTeX
If you use this code in your research, please use the following BibTeX entry.
BibTeX
@misc{louisbrulenaudet2025,
author = {Louis Brulé Naudet},
title = {Lemone: the API for French tax data retrieval and classification.},
year = {2025}
howpublished = {\url{https://huggingface.co/datasets/louisbrulenaudet/lemone-api}},
}
BibTeX
@misc{louisbrulenaudet2024,
author = {Louis Brulé Naudet},
title = {Lemone-Embed: A Series of Fine-Tuned Embedding Models for French Taxation},
year = {2024}
howpublished = {\url{https://huggingface.co/datasets/louisbrulenaudet/lemone-embed-pro}},
}
BibTeX
@misc{louisbrulenaudet2024,
author = {Louis Brulé Naudet},
title = {Lemone-Router: A Series of Fine-Tuned Classification Models for French Taxation},
year = {2024}
howpublished = {\url{https://huggingface.co/datasets/louisbrulenaudet/lemone-router-l}},
}
Feedback
If you have any feedback, please reach out at louisbrulenaudet@icloud.com.
Owner
- Name: Louis Brulé Naudet
- Login: louisbrulenaudet
- Kind: user
- Location: Paris
- Company: Université Paris-Dauphine (Paris Sciences et Lettres - PSL)
- Website: https://louisbrulenaudet.com
- Twitter: BruleNaudet
- Repositories: 81
- Profile: https://github.com/louisbrulenaudet
Research in business taxation and development (NLP, LLM, Computer vision...), University Dauphine-PSL đź“– | Backed by the Microsoft for Startups Hub program
Citation (CITATION.cff)
cff-version: 1.2.0 message: "If you use this software, please cite it as below." authors: - family-names: "Brulé Naudet" given-names: "Louis" orcid: "https://orcid.org/0000-0001-9111-4879" title: "Lemone: the API for French tax data retrieval and classification." version: 0.1.2 date-released: 2025-02-16
GitHub Events
Total
- Release event: 3
- Watch event: 1
- Delete event: 39
- Issue comment event: 42
- Push event: 22
- Pull request event: 80
- Create event: 53
Last Year
- Release event: 3
- Watch event: 1
- Delete event: 39
- Issue comment event: 42
- Push event: 22
- Pull request event: 80
- Create event: 53
Issues and Pull Requests
Last synced: 12 months ago
All Time
- Total issues: 0
- Total pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Total issue authors: 0
- Total pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 1
Past Year
- Issues: 0
- Pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 1
Top Authors
Issue Authors
Pull Request Authors
- dependabot[bot] (49)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- actions/checkout v4 composite
- docker/build-push-action v6 composite
- docker/login-action v3 composite
- docker/setup-buildx-action v3 composite
- docker/setup-qemu-action v3 composite
- actions/checkout v4 composite
- astral-sh/ruff-action v3 composite
- actions/checkout v4 composite
- actions/setup-python v5 composite
- redis * docker
- actions/checkout v4 composite
- trufflesecurity/trufflehog main composite
- python 3.12-slim build
- accelerate ==1.6.0
- aiocache ==0.12.3
- annotated-types ==0.7.0
- anyio ==4.9.0
- certifi ==2025.1.31
- charset-normalizer ==3.4.1
- click ==8.1.8
- deprecated ==1.2.18
- dnspython ==2.7.0
- dramatiq ==1.17.1
- email-validator ==2.2.0
- executing ==2.2.0
- fastapi ==0.115.12
- fastapi-cli ==0.0.7
- filelock ==3.18.0
- fsspec ==2025.3.2
- gevent ==24.11.1
- googleapis-common-protos ==1.69.2
- greenlet ==3.1.1
- h11 ==0.14.0
- httpcore ==1.0.7
- httptools ==0.6.4
- httpx ==0.28.1
- huggingface-hub ==0.30.1
- idna ==3.10
- importlib-metadata ==8.6.1
- jinja2 ==3.1.6
- joblib ==1.4.2
- logfire ==3.12.0
- markdown-it-py ==3.0.0
- markupsafe ==3.0.2
- mdurl ==0.1.2
- mpmath ==1.3.0
- networkx ==3.4.2
- numpy ==2.2.4
- opentelemetry-api ==1.31.1
- opentelemetry-exporter-otlp-proto-common ==1.31.1
- opentelemetry-exporter-otlp-proto-http ==1.31.1
- opentelemetry-instrumentation ==0.52b1
- opentelemetry-proto ==1.31.1
- opentelemetry-sdk ==1.31.1
- opentelemetry-semantic-conventions ==0.52b1
- packaging ==24.2
- pillow ==11.1.0
- prometheus-client ==0.21.1
- protobuf ==5.29.4
- psutil ==7.0.0
- pydantic ==2.11.2
- pydantic-core ==2.33.1
- pydantic-settings ==2.8.1
- pygments ==2.19.1
- python-dotenv ==1.1.0
- python-multipart ==0.0.20
- pyyaml ==6.0.2
- redis ==5.2.1
- regex ==2024.11.6
- requests ==2.32.3
- rich ==14.0.0
- rich-toolkit ==0.14.1
- safetensors ==0.5.3
- scikit-learn ==1.6.1
- scipy ==1.15.2
- sentence-transformers ==4.0.2
- setuptools ==78.1.0
- shellingham ==1.5.4
- sniffio ==1.3.1
- starlette ==0.46.1
- sympy ==1.13.1
- threadpoolctl ==3.6.0
- tokenizers ==0.21.1
- torch ==2.6.0
- tqdm ==4.67.1
- transformers ==4.50.3
- typer ==0.15.2
- typing-extensions ==4.13.1
- typing-inspection ==0.4.0
- urllib3 ==2.3.0
- uvicorn ==0.34.0
- uvloop ==0.21.0
- watchdog ==6.0.0
- watchdog-gevent ==0.2.1
- watchfiles ==1.0.4
- websockets ==15.0.1
- wrapt ==1.17.2
- zipp ==3.21.0
- zope-event ==5.0
- zope-interface ==7.2
- 124 dependencies