File size: 14,140 Bytes
4149ca9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
openapi: 3.0.0
info:
    title: FastAPI
    version: 0.1.0
paths:
    /ai_types:
        get:
            summary: Get Ai Types
            description: Récupère les types d'IA pour lesquels EcoMindAI peut faire des estimations
            operationId: get_ai_types_ai_types_get
            responses:
                "200":
                    description: Successful Response
                    content:
                        application/json:
                            schema:
                                items:
                                    type: string
                                type: array
                                title: Response Get Ai Types Ai Types Get
    /llm_configurations:
        get:
            summary: Get Llm Configurations
            description: Récupère les configurations disponibles pour un modèle de type LLM
            operationId: get_llm_configurations_llm_configurations_get
            responses:
                "200":
                    description: Successful Response
                    content:
                        application/json:
                            schema:
                                items:
                                    $ref: "#/components/schemas/LLMModelConfig"
                                type: array
                                title: Response Get Llm Configurations Llm Configurations Get
    /ml_configurations:
        get:
            summary: Get Ml Configurations
            description: Récupère les algorithmes disponibles pour un modèle d'IA de machine learning classique de regression ou classification
            operationId: get_ml_configurations_ml_configurations_get
            parameters:
                - name: ml_type
                  in: query
                  required: true
                  schema:
                      $ref: "#/components/schemas/MLType"
            responses:
                "200":
                    description: Successful Response
                    content:
                        application/json:
                            schema:
                                type: array
                                items:
                                    $ref: "#/components/schemas/MLModelConfig"
                                title: Response Get Ml Configurations Ml Configurations Get
                "422":
                    description: Validation Error
                    content:
                        application/json:
                            schema:
                                $ref: "#/components/schemas/HTTPValidationError"
    /estimate_llm_inference:
        post:
            summary: Launchestimation
            description: Lance un calcul d'estimation des métriques d'impacts environnementaux d'un projet LLM sur sa phase d'inférence sur 1 an
            operationId: launchEstimation_estimate_llm_inference_post
            requestBody:
                content:
                    application/json:
                        schema:
                            $ref: "#/components/schemas/InputEstimationLLMInference"
                required: true
            responses:
                "200":
                    description: Successful Response
                    content:
                        application/json:
                            schema:
                                $ref: "#/components/schemas/OutputEstimation"
                "422":
                    description: Validation Error
                    content:
                        application/json:
                            schema:
                                $ref: "#/components/schemas/HTTPValidationError"
    /estimate_ml:
        post:
            summary: Launchestimation
            description: Lance un calcul d'estimation des métriques d'impacts environnementaux d'un projet ML classique sur 1 an
            operationId: launchEstimation_estimate_ml_post
            requestBody:
                content:
                    application/json:
                        schema:
                            $ref: "#/components/schemas/InputEstimationML"
                required: true
            responses:
                "200":
                    description: Successful Response
                    content:
                        application/json:
                            schema:
                                $ref: "#/components/schemas/OutputEstimation"
                "422":
                    description: Validation Error
                    content:
                        application/json:
                            schema:
                                $ref: "#/components/schemas/HTTPValidationError"
components:
    schemas:
        HTTPValidationError:
            properties:
                detail:
                    items:
                        $ref: "#/components/schemas/ValidationError"
                    type: array
                    title: Detail
            type: object
            title: HTTPValidationError
        InfrastructureType:
            type: string
            enum:
                - SERVER_DC
                - LAPTOP
                - DESKTOP
            title: InfrastructureType
        InputEstimationLLMInference:
            properties:
                modelName:
                    type: string
                    title: Modelname
                    description: Nom du modèle LLM
                nbParameters:
                    type: string
                    title: Nbparameters
                    description: Nombre de paramètres (en milliards)
                framework:
                    type: string
                    title: Framework
                    description: Nom du modèle utilisé
                quantization:
                    type: string
                    title: Quantization
                    description: Méthode de quantization utilisée (none si pas de quantization)
                totalGeneratedTokens:
                    type: integer
                    title: Totalgeneratedtokens
                    description: Nombre de tokens générés sur un an
                infrastructureType:
                    $ref: "#/components/schemas/InfrastructureType"
                    description: Type d'infrastructure utilisée
                nbCpuCores:
                    type: integer
                    title: Nbcpucores
                    description: Nombre de coeurs de CPU
                nbGpu:
                    type: integer
                    title: Nbgpu
                    description: Nombre de GPUs
                gpuMemory:
                    type: integer
                    title: Gpumemory
                    description: Taille de la mémoire GPU en Go
                ramSize:
                    type: integer
                    title: Ramsize
                    description: Taille de la RAM en Go
            type: object
            required:
                - modelName
                - nbParameters
                - framework
                - quantization
                - totalGeneratedTokens
                - infrastructureType
                - nbCpuCores
                - nbGpu
                - gpuMemory
                - ramSize
            title: InputEstimationLLMInference
            description: Données d'entrée du calcul d'estimation de l'impact d'un LLM pour la phase d'inférence
        InputEstimationML:
            properties:
                stage:
                    type: string
                    title: Stage
                    description: Etape du cycle de vie de l'IA (entrainement ou inférence ?)
                algorithmType:
                    type: string
                    title: Algorithmtype
                    description: Type d'algorithme (classification ou regression)'
                algorithmName:
                    type: string
                    title: Algorithmname
                    description: Nom de l'algorithme
                nbFeatures:
                    type: string
                    title: Nbfeatures
                    description: Nombre de features (de colonnes dans le dataset)
                nbLines:
                    type: string
                    title: Nblines
                    description: Nombre de lignes dans le dataset correspondant à la stage
                nbOperations:
                    type: integer
                    title: Nboperations
                    description: Nombre d'opérations (d'inférences ou de trainings selon le stage)
                infrastructureType:
                    $ref: "#/components/schemas/InfrastructureType"
                    description: Type d'infrastructure utilisée
                nbCpuCores:
                    type: integer
                    title: Nbcpucores
                    description: Nombre de coeurs de CPU
                nbGpu:
                    type: integer
                    title: Nbgpu
                    description: Nombre de GPUs
                gpuMemory:
                    type: integer
                    title: Gpumemory
                    description: Taille de la mémoire GPU en Go
                ramSize:
                    type: integer
                    title: Ramsize
                    description: Taille de la RAM en Go
            type: object
            required:
                - stage
                - algorithmType
                - algorithmName
                - nbFeatures
                - nbLines
                - nbOperations
                - infrastructureType
                - nbCpuCores
                - nbGpu
                - gpuMemory
                - ramSize
            title: InputEstimationML
            description: Données d'entrée du calcul d'estimation de l'impact d'un LLM pour la phase d'inférence
        LLMModelConfig:
            properties:
                modelName:
                    type: string
                    title: Modelname
                    description: Nom du modèle LLM utilisé
                nbParameters:
                    type: string
                    title: Nbparameters
                    description: Nombre de paramètres (en milliards)
                framework:
                    type: string
                    title: Framework
                    description: Nom du modèle utilisé
                quantization:
                    type: string
                    title: Quantization
                    description: Méthode de quantization utilisée (none si pas de quantization)
            type: object
            required:
                - modelName
                - nbParameters
                - framework
                - quantization
            title: LLMModelConfig
            description: Configuration de LLM disponibles dans la base
        MLModelConfig:
            properties:
                algorithm_name:
                    type: string
                    title: Algorithm Name
                    description: Nom de l'algorithme de machine learning utilisé
            type: object
            required:
                - algorithm_name
            title: MLModelConfig
            description: Configuration des modèles de machine learning disponibles dans la base
        MLType:
            type: string
            enum:
                - classification
                - regression
            title: MLType
        OutputEstimation:
            properties:
                electricityConsumption:
                    type: number
                    title: Electricityconsumption
                    description: Consommation électrique totale (Wh)
                runtime:
                    type: number
                    title: Runtime
                    description: Durée d'exécution totale (s)
                recommendations:
                    items:
                        $ref: "#/components/schemas/Recommendation"
                    type: array
                    title: Recommendations
                    description: Liste des recommandations pour réduire l'impact
            type: object
            required:
                - electricityConsumption
                - runtime
                - recommendations
            title: OutputEstimation
            description: "Données de sortie du calcul d'estimation de l'impact : electricité consommée, temps + recommandations"
        Recommendation:
            properties:
                type:
                    type: string
                    title: Type
                    description: "Type de recommandation: General ou Specific"
                topic:
                    type: string
                    title: Topic
                    description: Titre de la recommandation
                example:
                    type: string
                    title: Example
                    description: Détail et exemple de la recommandation
                expectedReduction:
                    type: string
                    title: Expectedreduction
                    description: Pourcentage de réduction attendu
            type: object
            required:
                - type
                - topic
                - example
                - expectedReduction
            title: Recommendation
            description: "Recommandations personalisées sur comment s'améliorer, en fonction des données d'entrées "
        ValidationError:
            properties:
                loc:
                    items:
                        anyOf:
                            - type: string
                            - type: integer
                    type: array
                    title: Location
                msg:
                    type: string
                    title: Message
                type:
                    type: string
                    title: Error Type
            type: object
            required:
                - loc
                - msg
                - type
            title: ValidationError