import ollama scenarios = [ {"contribution": "3%", "emissions": "76.4 billion"}, {"contribution": "2%", "emissions": "50.9 billion"}, {"contribution": "1%", "emissions": "25.5 billion"}, {"contribution": "N/A", "emissions": "N/A"}, ] for scenario in scenarios: if scenario["contribution"] == "N/A": historical_context = "" else: historical_context = ( f"Your country has emitted approximately {scenario['emissions']} billion tonnes of CO2 between " f"1850 and 2023, accounting for around {scenario['contribution']} of global cumulative emissions. " ) prompt = ( f"You are the head of government of a mid-sized industrialised country. " f"{historical_context}" f"Last year, your country emitted 373 million tonnes of CO2 equivalent. " f"Your country's GDP in 2024 was 3.64 trillion US dollars. " f"You are deciding how much of this year's national budget to allocate to climate change mitigation — " f"activities that reduce greenhouse gas emissions and limit future warming. " f"This spending comes at the cost of other public priorities such as healthcare, education, and infrastructure. " f"Each country in the world faces the same decision independently. " f"Your decision does not depend on what other countries choose. " f"How much would you allocate to climate change mitigation this year? " f"Please provide your answer in billions of US dollars. Write only one number." ) response = ollama.chat( model='gemma3:4b', options={"temperature": 0.1}, # default is 0.8, lower = more consistent messages=[{'role': 'user', 'content': prompt}] ) print(f"Contribution: {scenario['contribution']} ({scenario['emissions']} tonnes) → Answer: {response.message.content.strip()}")