PDFExtractor / application /schemas /response_schema.py
Vela
modified gemini service module add API call file handling
d1ca23a
raw
history blame
36.3 kB
from pydantic import BaseModel
RESPONSE_FORMAT = {
"type": "json_schema",
"json_schema": {
"name": "esg_response",
"strict": True,
"schema": {
"type": "object",
"properties": {
"company_name": {"type": "string"},
"Greenhouse Gas (GHG) Protocol Parameters": {
"type": "array",
"items": {
"type": "object",
"properties": {
"Total GHG Emissions": {"type": ["integer", "null"]},
"Total GHG Emissions Description": {
"type": "string",
"description": "Total greenhouse gases emitted by the organization."
},
"Scope 1 Emissions": {"type": ["integer", "null"]},
"Scope 1 Emissions Description": {
"type": "string",
"description": "Direct GHG emissions from owned or controlled sources."
},
"Scope 2 Emissions": {"type": ["integer", "null"]},
"Scope 2 Emissions Description": {
"type": "string",
"description": "Indirect emissions from the generation of purchased electricity."
},
"Scope 3 Emissions": {"type": ["integer", "null"]},
"Scope 3 Emissions Description": {
"type": "string",
"description": "All other indirect emissions that occur in a company’s value chain."
},
"CO₂ Emissions": {"type": ["integer", "null"]},
"CO₂ Emissions Description": {
"type": "string",
"description": "Emissions of carbon dioxide."
},
"CH₄ Emissions": {"type": ["integer", "null"]},
"CH₄ Emissions Description": {
"type": "string",
"description": "Emissions of methane."
},
"N₂O Emissions": {"type": ["integer", "null"]},
"N₂O Emissions Description": {
"type": "string",
"description": "Emissions of nitrous oxide."
},
"HFC Emissions": {"type": ["integer", "null"]},
"HFC Emissions Description": {
"type": "string",
"description": "Emissions of hydrofluorocarbons."
},
"PFC Emissions": {"type": ["integer", "null"]},
"PFC Emissions Description": {
"type": "string",
"description": "Emissions of perfluorocarbons."
}
},
"required": [
"Total GHG Emissions", "Total GHG Emissions Description",
"Scope 1 Emissions", "Scope 1 Emissions Description",
"Scope 2 Emissions", "Scope 2 Emissions Description",
"Scope 3 Emissions", "Scope 3 Emissions Description",
"CO₂ Emissions", "CO₂ Emissions Description",
"CH₄ Emissions", "CH₄ Emissions Description",
"N₂O Emissions", "N₂O Emissions Description",
"HFC Emissions", "HFC Emissions Description",
"PFC Emissions", "PFC Emissions Description"
],
"additionalProperties": False
}
},
"Net Zero Intervention Parameters": {
"type": "array",
"items": {
"type": "object",
"properties": {
"Renewable Energy Adoption": {"type": ["number", "null"]},
"Renewable Energy Adoption Description": {
"type": "string",
"description": "Proportion of energy consumption derived from renewable sources."
},
"Energy Efficiency Improvements": {"type": ["number", "null"]},
"Energy Efficiency Improvements Description": {
"type": "string",
"description": "Reduction in energy consumption due to efficiency measures."
},
"Electrification of Operations": {"type": ["number", "null"]},
"Electrification of Operations Description": {
"type": "string",
"description": "Extent to which operations have shifted from fossil fuels to electric power."
},
"Carbon Capture and Storage (CCS) Implementation": {"type": ["number", "null"]},
"Carbon Capture and Storage (CCS) Implementation Description": {
"type": "string",
"description": "Amount of CO₂ captured and stored to prevent atmospheric release."
},
"Reforestation and Afforestation Initiatives": {"type": ["number", "null"]},
"Reforestation and Afforestation Initiatives Description": {
"type": "string",
"description": "Efforts to plant trees to absorb CO₂ from the atmosphere."
},
"Sustainable Transportation Adoption": {"type": ["number", "null"]},
"Sustainable Transportation Adoption Description": {
"type": "string",
"description": "Proportion of transportation utilizing low-emission or electric vehicles."
},
"Supply Chain Emissions Reduction": {"type": ["number", "null"]},
"Supply Chain Emissions Reduction Description": {
"type": "string",
"description": "Decrease in emissions from upstream and downstream supply chain activities."
},
"Waste-to-Energy Conversion": {"type": ["number", "null"]},
"Waste-to-Energy Conversion Description": {
"type": "string",
"description": "Energy produced from the processing of waste materials."
},
"Carbon Offset Investments": {"type": ["number", "null"]},
"Carbon Offset Investments Description": {
"type": "string",
"description": "Amount of emissions offset through investments in environmental projects."
},
"Climate Risk Assessment": {"type": ["string", "null"]},
"Climate Risk Assessment Description": {
"type": "string",
"description": "Evaluation of potential risks posed by climate change to the organization."
},
"Climate Adaptation Strategies": {"type": ["string", "null"]},
"Climate Adaptation Strategies Description": {
"type": "string",
"description": "Plans implemented to adapt operations to changing climate conditions."
},
"Internal Carbon Pricing": {"type": ["number", "null"]},
"Internal Carbon Pricing Description": {
"type": "string",
"description": "Monetary value assigned to carbon emissions to incentivize reduction."
},
"Net-Zero Target Year": {"type": ["string", "null"]},
"Net-Zero Target Year Description": {
"type": "string",
"description": "Specific year by which the organization aims to achieve net-zero emissions."
},
"Interim Emission Reduction Targets": {"type": ["number", "null"]},
"Interim Emission Reduction Targets Description": {
"type": "string",
"description": "Short-term targets set to progressively reduce emissions en route to net-zero."
},
"Employee Engagement in Sustainability": {"type": ["number", "null"]},
"Employee Engagement in Sustainability Description": {
"type": "string",
"description": "Proportion of employees actively involved in sustainability programs."
},
"Investment in Low-Carbon Technologies": {"type": ["number", "null"]},
"Investment in Low-Carbon Technologies Description": {
"type": "string",
"description": "Financial resources allocated to developing or adopting low-carbon technologies."
},
"Public Disclosure of Net-Zero Progress": {"type": ["string", "null"]},
"Public Disclosure of Net-Zero Progress Description": {
"type": "string",
"description": "Regular public updates on progress toward net-zero commitments."
},
"Third-Party Verification of Emission Data": {"type": ["boolean", "null"]},
"Third-Party Verification of Emission Data Description": {
"type": "string",
"description": "Confirmation that emission data has been verified by an external party."
},
"Participation in Carbon Markets": {"type": ["boolean", "null"]},
"Participation in Carbon Markets Description": {
"type": "string",
"description": "Involvement in systems where carbon credits are bought and sold."
},
"Development of Climate-Resilient Infrastructure": {"type": ["string", "null"]},
"Development of Climate-Resilient Infrastructure Description": {
"type": "string",
"description": "Initiatives to build infrastructure resilient to climate impacts."
},
"Reduction of Methane Emissions": {"type": ["number", "null"]},
"Reduction of Methane Emissions Description": {
"type": "string",
"description": "Efforts to decrease methane emissions from operations."
},
"Implementation of Circular Economy Practices": {"type": ["string", "null"]},
"Implementation of Circular Economy Practices Description": {
"type": "string",
"description": "Adoption of processes that emphasize reuse and recycling to minimize waste."
},
"Collaboration with Industry Peers on Climate Action": {"type": ["string", "null"]},
"Collaboration with Industry Peers on Climate Action Description": {
"type": "string",
"description": "Joint initiatives with other organizations to address climate challenges."
},
"Use of Science-Based Targets": {"type": ["boolean", "null"]},
"Use of Science-Based Targets Description": {
"type": "string",
"description": "Setting emission reduction targets in line with scientific recommendations."
},
"Monitoring and Reporting Mechanisms": {"type": ["string", "null"]},
"Monitoring and Reporting Mechanisms Description": {
"type": "string",
"description": "Systems established to track and report emissions data accurately."
}
},
"required": [
"Renewable Energy Adoption", "Renewable Energy Adoption Description",
"Energy Efficiency Improvements", "Energy Efficiency Improvements Description",
"Electrification of Operations", "Electrification of Operations Description",
"Carbon Capture and Storage (CCS) Implementation", "Carbon Capture and Storage (CCS) Implementation Description",
"Reforestation and Afforestation Initiatives", "Reforestation and Afforestation Initiatives Description",
"Sustainable Transportation Adoption", "Sustainable Transportation Adoption Description",
"Supply Chain Emissions Reduction", "Supply Chain Emissions Reduction Description",
"Waste-to-Energy Conversion", "Waste-to-Energy Conversion Description",
"Carbon Offset Investments", "Carbon Offset Investments Description",
"Climate Risk Assessment", "Climate Risk Assessment Description",
"Climate Adaptation Strategies", "Climate Adaptation Strategies Description",
"Internal Carbon Pricing", "Internal Carbon Pricing Description",
"Net-Zero Target Year", "Net-Zero Target Year Description",
"Interim Emission Reduction Targets", "Interim Emission Reduction Targets Description",
"Employee Engagement in Sustainability", "Employee Engagement in Sustainability Description",
"Investment in Low-Carbon Technologies", "Investment in Low-Carbon Technologies Description",
"Public Disclosure of Net-Zero Progress", "Public Disclosure of Net-Zero Progress Description",
"Third-Party Verification of Emission Data", "Third-Party Verification of Emission Data Description",
"Participation in Carbon Markets", "Participation in Carbon Markets Description",
"Development of Climate-Resilient Infrastructure", "Development of Climate-Resilient Infrastructure Description",
"Reduction of Methane Emissions", "Reduction of Methane Emissions Description",
"Implementation of Circular Economy Practices", "Implementation of Circular Economy Practices Description",
"Collaboration with Industry Peers on Climate Action", "Collaboration with Industry Peers on Climate Action Description",
"Use of Science-Based Targets", "Use of Science-Based Targets Description",
"Monitoring and Reporting Mechanisms", "Monitoring and Reporting Mechanisms Description"
],
"additionalProperties": False
}
},
"Materiality Parameters": {
"type": "array",
"items": {
"type": "object",
"properties": {
"Stakeholder Engagement Level": {
"type": ["string", "null"]
},
"Stakeholder Engagement Level Description": {
"type": "string",
"description": "Degree to which stakeholders are involved in organizational activities or decisions."
},
"Stakeholder Feedback Mechanisms": {
"type": ["string", "null"]
},
"Stakeholder Feedback Mechanisms Description": {
"type": "string",
"description": "Systems in place for stakeholders to provide feedback to the organization."
},
"Identification of Material Issues": {
"type": ["string", "null"]
},
"Identification of Material Issues Description": {
"type": "string",
"description": "Process of determining the most significant environmental, social, and governance issues relevant to the organization."
},
"Prioritization of Material Issues": {
"type": ["string", "null"]
},
"Prioritization of Material Issues Description": {
"type": "string",
"description": "Ranking of identified material issues based on their significance to stakeholders and the organization."
},
"Double Materiality Assessment": {
"type": ["string", "null"]
},
"Double Materiality Assessment Description": {
"type": "string",
"description": "Evaluation considering both the organization's impact on sustainability matters and the impact of those matters on the organization."
},
"Materiality Matrix Development": {
"type": ["string", "null"]
},
"Materiality Matrix Development Description": {
"type": "string",
"description": "Creation of a visual matrix plotting material issues based on their importance to stakeholders and the organization."
},
"Regular Review of Material Issues": {
"type": ["string", "null"]
},
"Regular Review of Material Issues Description": {
"type": "string",
"description": "Frequency and process for updating the assessment of material issues."
},
"Integration of Material Issues into Strategy": {
"type": ["string", "null"]
},
"Integration of Material Issues into Strategy Description": {
"type": "string",
"description": "How identified material issues are incorporated into the organization's strategic planning."
},
"Disclosure of Material Issues": {
"type": ["string", "null"]
},
"Disclosure of Material Issues Description": {
"type": "string",
"description": "Public reporting on identified material issues and how they are managed."
},
"Impact Assessment of Material Issues": {
"type": ["string", "null"]
},
"Impact Assessment of Material Issues Description": {
"type": "string",
"description": "Analysis of the potential or actual impact of material issues on the organization and its stakeholders."
}
},
"required": [
"Stakeholder Engagement Level",
"Stakeholder Engagement Level Description",
"Stakeholder Feedback Mechanisms",
"Stakeholder Feedback Mechanisms Description",
"Identification of Material Issues",
"Identification of Material Issues Description",
"Prioritization of Material Issues",
"Prioritization of Material Issues Description",
"Double Materiality Assessment",
"Double Materiality Assessment Description",
"Materiality Matrix Development",
"Materiality Matrix Development Description",
"Regular Review of Material Issues",
"Regular Review of Material Issues Description",
"Integration of Material Issues into Strategy",
"Integration of Material Issues into Strategy Description",
"Disclosure of Material Issues",
"Disclosure of Material Issues Description",
"Impact Assessment of Material Issues",
"Impact Assessment of Material Issues Description"
],
"additionalProperties": False
}
}
},
"required": ["company_name", "Greenhouse Gas (GHG) Protocol Parameters", "Net Zero Intervention Parameters", "Materiality Parameters"],
"additionalProperties": False
}
}
}
GEMINI_RESPONSE_FORMAT = {
"type": "object",
"properties": {
"Company Name": {
"type": "string",
"description": "Name of the company."
},
"Greenhouse Gas (GHG) Protocol Parameters": {
"type": "object",
"properties": {
"Total GHG Emissions": { "type": "integer", "nullable": True, "description": "Total greenhouse gases emitted by the organization. Units: Metric Tons CO₂e." },
"Scope 1 Emissions": { "type": "integer", "nullable": True, "description": "Direct GHG emissions from owned or controlled sources. Units: Metric Tons CO₂e." },
"Scope 2 Emissions": { "type": "integer", "nullable": True, "description": "Indirect GHG emissions from the consumption of purchased electricity, steam, heating, and cooling. Units: Metric Tons CO₂e." },
"Scope 3 Emissions": { "type": "integer", "nullable": True, "description": "Other indirect emissions occurring in the value chain, including both upstream and downstream emissions. Units: Metric Tons CO₂e." },
"CO₂ Emissions": { "type": "integer", "nullable": True, "description": "Emissions of carbon dioxide. Units: Metric Tons CO₂." },
"CH₄ Emissions": { "type": "integer", "nullable": True, "description": "Emissions of methane. Units: Metric Tons CH₄." },
"N₂O Emissions": { "type": "integer", "nullable": True, "description": "Emissions of nitrous oxide. Units: Metric Tons N₂O." },
"HFC Emissions": { "type": "integer", "nullable": True, "description": "Emissions of hydrofluorocarbons. Units: Metric Tons HFCs" },
"PFC Emissions": { "type": "integer", "nullable": True, "description": "Emissions of perfluorocarbons. Units: Metric Tons PFCs" },
"SF₆ Emissions": { "type": "integer", "nullable": True, "description": "Emissions of sulfur hexafluoride. Units: Metric Tons SF₆." },
"NF₃ Emissions": { "type": "integer", "nullable": True, "description": "Emissions of nitrogen trifluoride. Units: Metric Tons NF₃." },
"Biogenic CO₂ Emissions": { "type": "integer", "nullable": True, "description": "CO₂ emissions from biological sources. Units: Metric Tons CO₂." },
"Emissions Intensity per Revenue": { "type": "number", "nullable": True, "description": "GHG emissions per unit of revenue. Units: Metric Tons CO₂e / Revenue." },
"Emissions Intensity per Employee": { "type": "number", "nullable": True, "description": "GHG emissions per employee. Units: Metric Tons CO₂e / Employee." },
"Base Year Emissions": { "type": "integer", "nullable": True, "description": "GHG emissions in the base year for comparison. Units: Metric Tons CO₂e." },
"Emissions Reduction Target": { "type": "number", "nullable": True, "description": "Targeted percentage reduction in GHG emissions. Units: Percentage (%)." },
"Emissions Reduction Achieved": { "type": "number", "nullable": True, "description": "Actual percentage reduction in GHG emissions achieved. Units: Percentage (%)." },
"Energy Consumption": { "type": "number", "nullable": True, "description": "Total energy consumed by the organization. Units: MWh or GJ." },
"Renewable Energy Consumption": { "type": "number", "nullable": True, "description": "Amount of energy consumed from renewable sources. Units: MWh or GJ." },
"Non-Renewable Energy Consumption": { "type": "number", "nullable": True, "description": "Amount of energy consumed from non-renewable sources. Units: MWh or GJ." },
"Energy Intensity per Revenue": { "type": "number", "nullable": True, "description": "Energy consumption per unit of revenue. Units: MWh or GJ / Revenue." },
"Energy Intensity per Employee": { "type": "number", "nullable": True, "description": "Energy consumption per employee. Units: MWh or GJ / Employee." },
"Fuel Consumption": { "type": "number", "nullable": True, "description": "Total fuel consumed by the organization. Units: Liters or GJ." },
"Electricity Consumption": { "type": "number", "nullable": True, "description": "Total electricity consumed. Units: MWh." },
"Heat Consumption": { "type": "number", "nullable": True, "description": "Total heat energy consumed. Units: GJ." },
"Steam Consumption": { "type": "number", "nullable": True, "description": "Total steam energy consumed. Units: GJ." },
"Cooling Consumption": { "type": "number", "nullable": True, "description": "Total energy consumed for cooling. Units: GJ." },
"Purchased Goods and Services Emissions": { "type": "integer", "nullable": True, "description": "Emissions from purchased goods and services. Units: Metric Tons CO₂e." },
"Capital Goods Emissions": { "type": "integer", "nullable": True, "description": "Emissions from the production of capital goods. Units: Metric Tons CO₂e." },
"Fuel- and Energy-Related Activities Emissions": { "type": "integer", "nullable": True, "description": "Emissions related to fuel and energy production not included in Scope 1 or 2. Units: Metric Tons CO₂e." },
"Upstream Transportation and Distribution Emissions": { "type": "integer", "nullable": True, "description": "Emissions from transportation and distribution in the supply chain. Units: Metric Tons CO₂e." },
"Waste Generated in Operations Emissions": { "type": "integer", "nullable": True, "description": "Emissions from waste generated during operations. Units: Metric Tons CO₂e." },
"Business Travel Emissions": { "type": "integer", "nullable": True, "description": "Emissions from employee business travel. Units: Metric Tons CO₂e." },
"Employee Commuting Emissions": { "type": "integer", "nullable": True, "description": "Emissions from employees commuting to and from work. Units: Metric Tons CO₂e." },
"Upstream Leased Assets Emissions": { "type": "integer", "nullable": True, "description": "Emissions from leased assets upstream in the value chain. Units: Metric Tons CO₂e." },
"Downstream Transportation and Distribution Emissions": { "type": "integer", "nullable": True, "description": "Emissions from transportation and distribution of sold products. Units: Metric Tons CO₂e." },
"Processing of Sold Products Emissions": { "type": "integer", "nullable": True, "description": "Emissions from processing intermediate products sold by the organization. Units: Metric Tons CO₂e." },
"Use of Sold Products Emissions": { "type": "integer", "nullable": True, "description": "Emissions from the use of sold products by consumers. Units: Metric Tons CO₂e." },
"End-of-Life Treatment of Sold Products Emissions": { "type": "integer", "nullable": True, "description": "Emissions from the disposal of sold products at end of life. Units: Metric Tons CO₂e." },
"Downstream Leased Assets Emissions": { "type": "integer", "nullable": True, "description": "Emissions from leased assets downstream in the value chain. Units: Metric Tons CO₂e." },
"Franchises Emissions": { "type": "integer", "nullable": True, "description": "Emissions from franchise operations. Units: Metric Tons CO₂e." },
"Investments Emissions": { "type": "integer", "nullable": True, "description": "Emissions from investments. Units: Metric Tons CO₂e." },
"Carbon Offsets Purchased": { "type": "integer", "nullable": True, "description": "Amount of carbon offsets purchased. Units: Metric Tons CO₂e." },
"Net GHG Emissions": { "type": "integer", "nullable": True, "description": "GHG emissions after accounting for offsets. Units: Metric Tons CO₂e." },
"Carbon Sequestration": { "type": "integer", "nullable": True, "description": "Amount of CO₂ sequestered or captured. Units: Metric Tons CO₂e." }
},
"propertyOrdering": [
"Total GHG Emissions",
"Scope 1 Emissions",
"Scope 2 Emissions",
"Scope 3 Emissions",
"CO₂ Emissions",
"CH₄ Emissions",
"N₂O Emissions",
"HFC Emissions",
"PFC Emissions",
"SF₆ Emissions",
"NF₃ Emissions",
"Biogenic CO₂ Emissions",
"Emissions Intensity per Revenue",
"Emissions Intensity per Employee",
"Base Year Emissions",
"Emissions Reduction Target",
"Emissions Reduction Achieved",
"Energy Consumption",
"Renewable Energy Consumption",
"Non-Renewable Energy Consumption",
"Energy Intensity per Revenue",
"Energy Intensity per Employee",
"Fuel Consumption",
"Electricity Consumption",
"Heat Consumption",
"Steam Consumption",
"Cooling Consumption",
"Purchased Goods and Services Emissions",
"Capital Goods Emissions",
"Fuel- and Energy-Related Activities Emissions",
"Upstream Transportation and Distribution Emissions",
"Waste Generated in Operations Emissions",
"Business Travel Emissions",
"Employee Commuting Emissions",
"Upstream Leased Assets Emissions",
"Downstream Transportation and Distribution Emissions",
"Processing of Sold Products Emissions",
"Use of Sold Products Emissions",
"End-of-Life Treatment of Sold Products Emissions",
"Downstream Leased Assets Emissions",
"Franchises Emissions",
"Investments Emissions",
"Carbon Offsets Purchased",
"Net GHG Emissions",
"Carbon Sequestration"
]
}
},
"propertyOrdering": ["Company Name", "Greenhouse Gas (GHG) Protocol Parameters"]
}
class Parameter(BaseModel):
"""
A generic class to hold details for a sustainability metric.
"""
synonym: str
uom: str
description: str
value: str
class GreenhouseGasGHGProtocolParameters(BaseModel):
Total_GHG_Emissions: Parameter
Scope_1_Emissions: Parameter
Scope_2_Emissions: Parameter
Scope_3_Emissions: Parameter
CO2_Emissions: Parameter
CH4_Emissions: Parameter
N2O_Emissions: Parameter
HFC_Emissions: Parameter
PFC_Emissions: Parameter
SF6_Emissions: Parameter
NF3_Emissions: Parameter
Biogenic_CO2_Emissions: Parameter
Emissions_Intensity_per_Revenue: Parameter
Emissions_Intensity_per_Employee: Parameter
Base_Year_Emissions: Parameter
Emissions_Reduction_Target: Parameter
Emissions_Reduction_Achieved: Parameter
Energy_Consumption: Parameter
Renewable_Energy_Consumption: Parameter
Non_Renewable_Energy_Consumption: Parameter
Energy_Intensity_per_Revenue: Parameter
Energy_Intensity_per_Employee: Parameter
Fuel_Consumption: Parameter
Electricity_Consumption: Parameter
Heat_Consumption: Parameter
Steam_Consumption: Parameter
Cooling_Consumption: Parameter
Purchased_Goods_and_Services_Emissions: Parameter
Capital_Goods_Emissions: Parameter
Fuel_and_Energy_Related_Activities_Emissions: Parameter
Upstream_Transportation_and_Distribution_Emissions: Parameter
Waste_Generated_in_Operations_Emissions: Parameter
Business_Travel_Emissions: Parameter
Employee_Commuting_Emissions: Parameter
Upstream_Leased_Assets_Emissions: Parameter
# Downstream_Transportation_and_Distribution_Emissions: Parameter
# Processing_of_Sold_Products_Emissions: Parameter
# Use_of_Sold_Products_Emissions: Parameter
# End_of_Life_Treatment_of_Sold_Products_Emissions: Parameter
# Downstream_Leased_Assets_Emissions: Parameter
# Franchises_Emissions: Parameter
# Investments_Emissions: Parameter
# Carbon_Offsets_Purchased: Parameter
# Net_GHG_Emissions: Parameter
# Carbon_Sequestration: Parameter
class EmissionData(BaseModel):
GreenhouseGasGHGProtocolParameters: GreenhouseGasGHGProtocolParameters