Albert RAG API
Documents a French government RAG API that extends OpenAI-compatible chat endpoints with source-augmented queries.
What this file does
Documents a French government RAG API that extends OpenAI-compatible chat endpoints with source-augmented queries.
When to use it
- Building a RAG layer on top of an existing OpenAI-compatible API
- Integrating French public service sources like service-public.fr into a chatbot
- Exposing a streaming chat API with authentication and temperature control
Assumes this stack
Albert RAG API
Overview
The Albert API supports the v1 OpenAI API, including system prompts, conversation handling, temperature control, and streaming. Additionally, we have introduced a Retrieval-Augmented Generation (RAG) extension toenhance user queries with relevant sources.
Authentication
To use the API, you need to authenticate with an API token. Ensure that you include the token in the header of your requests.
Endpoints
1. Standard LLM API
Endpoint
POST /api/v1/chat/completions
- See https://platform.openai.com/docs/api-reference/chat/create for the full list supported parameters.
- See https://huggingface.co/AgentPublic to see the available models.
Example Request
curl -X POST https://albert.etalab.gouv.fr/api/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"model" : "AgentPulic/llama3-instruct-8b",
"messages": [
{ "role": "system", "content": "Réponds dans un style francais ancien, moyenâgeux." },
{ "role": "user", "content": "Comment déclarer un revenue fiscal de référence ?" },
],
"temperature": 0.7,
}'
2. RAG Extension
Endpoint
POST /api/v1/chat/completions
Parameters
rag: (string, optional) Only "last" is supported for now, which the current RAG implementation of ALbert that augment the last user query with French data referenceslimit: (integer, optional) Limit the number of references added.sources: (array, optional) List of sources to search for references. Source available: "service-public", "travail-emploi".
Example Request
curl -X POST https://albert.etalab.gouv.fr/api/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"model" : "AgentPulic/llama3-instruct-8b",
"messages": [
{ "role": "system", "content": "Réponds dans un style ancien, moyenâgeux" },
{ "role": "user", "content": "Comment déclarer un revenue fiscal de référence ?" },
"rag": {
"mode": "rag",
"strategy": "last",
"limit": 5
}
}'
Note
- The API does not store user conversations.
- User must authenticated to use the API.
What's inside
2 endpoints, 2 example curl requests, authentication note, and parameter descriptions for RAG mode.
Change this for your project
- Replace
YOUR_API_TOKENwith your actual API token - Replace
AgentPulic/llama3-instruct-8bwith your model identifier - Replace
https://albert.etalab.gouv.frwith your own API base URL
Where it goes
Use as the system prompt for your model call, or as the base instructions in your agent framework.
Related Documents
Character Persona
Defines a Fallout 2 roleplay persona for an LLM agent: charming rogue with social-first combat and moral code.
How to implement tool use
Explains how to define, configure, and control tool use with the Anthropic API, including model selection, tool definitions, output control, and parallel calls.
Gemini by Example
Collects 20+ Gemini API code examples covering text, images, audio, video, PDFs, agents, and token counting.
Claude Tool Use (Function Calling) Documentation
Teaches how to define and use Claude tool use (function calling) with Python, including schema rules, execution patterns, and best practices.