Spaces:
Sleeping
Sleeping
add new routing logic
Browse files- eki_esrsqa/routing.py +62 -0
eki_esrsqa/routing.py
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from langchain_core.pydantic_v1 import BaseModel, Field
|
2 |
+
|
3 |
+
|
4 |
+
class QueryAnalysis(BaseModel):
|
5 |
+
"""Analyzing the user query"""
|
6 |
+
|
7 |
+
esrs_type: str = Field(
|
8 |
+
enum=[
|
9 |
+
"ESRS 1",
|
10 |
+
"ESRS 2",
|
11 |
+
"ESRS E1",
|
12 |
+
"ESRS E2",
|
13 |
+
"ESRS E3",
|
14 |
+
"ESRS E4",
|
15 |
+
"ESRS E5",
|
16 |
+
"ESRS S1",
|
17 |
+
"ESRS S2",
|
18 |
+
"ESRS S3",
|
19 |
+
"ESRS S4",
|
20 |
+
"ESRS G1",
|
21 |
+
],
|
22 |
+
description="""
|
23 |
+
Given a user question choose which documents would be most relevant for answering their question,
|
24 |
+
- ESRS 1 is for questions about general principles for preparing and presenting sustainability information in accordance with CSRD
|
25 |
+
- ESRS 2 is for questions about general disclosures related to sustainability reporting, including governance, strategy, impact, risk, opportunity management, and metrics and targets
|
26 |
+
- ESRS E1 is for questions about climate change, global warming, GES and energy
|
27 |
+
- ESRS E2 is for questions about air, water, and soil pollution, and dangerous substances
|
28 |
+
- ESRS E3 is for questions about water and marine resources
|
29 |
+
- ESRS E4 is for questions about biodiversity, nature, wildlife and ecosystems
|
30 |
+
- ESRS E5 is for questions about resource use and circular economy
|
31 |
+
- ESRS S1 is for questions about workforce and labor issues, job security, fair pay, and health and safety
|
32 |
+
- ESRS S2 is for questions about workers in the value chain, workers' treatment
|
33 |
+
- SRS S3 is for questions about affected communities, impact on local communities
|
34 |
+
- ESRS S4 is for questions about consumers and end users, customer privacy, safety, and inclusion
|
35 |
+
- ESRS G1 is for questions about governance, risk management, internal control, and business conduct
|
36 |
+
""",
|
37 |
+
)
|
38 |
+
|
39 |
+
sources: str = Field(
|
40 |
+
enum=["ESRS", "External"],
|
41 |
+
description="""
|
42 |
+
Given a user question choose which documents would be most relevant for answering their question,
|
43 |
+
- ESRS is for questions about a specific environmental, social or governance topic, as well as CSRD's general principles and disclosures
|
44 |
+
- External is for questions about how to implement the CSRD, or general questions about CSRD's context
|
45 |
+
""",
|
46 |
+
)
|
47 |
+
|
48 |
+
intent: str = Field(
|
49 |
+
enum=[
|
50 |
+
"Specific topic",
|
51 |
+
"Implementation reco",
|
52 |
+
"KPI extraction",
|
53 |
+
],
|
54 |
+
description="""
|
55 |
+
Categorize the user query in one of the following categories,
|
56 |
+
|
57 |
+
Examples:
|
58 |
+
- Specific topic: "What are the specificities of ESRS E1 ?"
|
59 |
+
- Implementation reco: "How should I compute my scope 1 reduction target ?"
|
60 |
+
- KPI extraction: "When will the CSRD be mandatory for my small French company ?"
|
61 |
+
""",
|
62 |
+
)
|