prompt ing pour no docs
Browse files
app.py
CHANGED
@@ -30,7 +30,7 @@ retrieve_giec = EmbeddingRetriever(
|
|
30 |
|
31 |
|
32 |
def chat(
|
33 |
-
query: str, history: list = [system_template], report_type: str = "All available", threshold: float = 0.
|
34 |
) -> tuple:
|
35 |
"""retrieve relevant documents in the document store then query gpt-turbo
|
36 |
|
@@ -63,7 +63,20 @@ def chat(
|
|
63 |
if sources:
|
64 |
messages.append({"role": "system", "content": f"{os.environ['sources']}\n\n{sources}"})
|
65 |
else:
|
66 |
-
messages.append(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
sources = "No environmental report was used to provide this answer."
|
68 |
|
69 |
response = openai.ChatCompletion.create(
|
@@ -102,7 +115,14 @@ with gr.Blocks(title="🌍 ClimateGPT Ekimetrics", css=css_code) as demo:
|
|
102 |
gr.Markdown(
|
103 |
""" Climate GPT is an interactive exploration tool designed to help you easily find relevant information based on of Environmental reports such as IPCCs and other environmental reports.
|
104 |
\n **How does it work:** when a user sends a message, the system retrieves the most relevant paragraphs from scientific reports that are semantically related to the user's question. These paragraphs are then used to generate a comprehensive and well-sourced answer using a language model.
|
105 |
-
\n
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
"""
|
107 |
)
|
108 |
with gr.Row():
|
|
|
30 |
|
31 |
|
32 |
def chat(
|
33 |
+
query: str, history: list = [system_template], report_type: str = "All available", threshold: float = 0.559
|
34 |
) -> tuple:
|
35 |
"""retrieve relevant documents in the document store then query gpt-turbo
|
36 |
|
|
|
63 |
if sources:
|
64 |
messages.append({"role": "system", "content": f"{os.environ['sources']}\n\n{sources}"})
|
65 |
else:
|
66 |
+
messages.append(
|
67 |
+
{
|
68 |
+
"role": "system",
|
69 |
+
"content": """Tell the user you did not find any relevant documents. Answer using your knowledge. Then tell them if their message was too vague or too short and if relevant provide an example of an alternative query.
|
70 |
+
example:
|
71 |
+
user: forrest
|
72 |
+
assistant: I did not find any relevant documents to answer your question, I will answer using my knowledge as a language model.
|
73 |
+
Forests play a crucial role in mitigating climate change. They act as carbon sinks, absorbing carbon dioxide from the atmosphere through photosynthesis and storing it in their biomass and soil. Deforestation, on the other hand, releases carbon dioxide into the atmosphere and reduces the planet's capacity to absorb carbon. Therefore, protecting and restoring forests is an important strategy for mitigating climate change.
|
74 |
+
|
75 |
+
You may want to try one of those more specific questions:
|
76 |
+
- What is deforestation, and how does it contribute to climate change?
|
77 |
+
- How does climate change impact forests and their ecosystems?""",
|
78 |
+
}
|
79 |
+
)
|
80 |
sources = "No environmental report was used to provide this answer."
|
81 |
|
82 |
response = openai.ChatCompletion.create(
|
|
|
115 |
gr.Markdown(
|
116 |
""" Climate GPT is an interactive exploration tool designed to help you easily find relevant information based on of Environmental reports such as IPCCs and other environmental reports.
|
117 |
\n **How does it work:** when a user sends a message, the system retrieves the most relevant paragraphs from scientific reports that are semantically related to the user's question. These paragraphs are then used to generate a comprehensive and well-sourced answer using a language model.
|
118 |
+
\n **Usage guideline:** more sources will be retrieved using precise questions
|
119 |
+
instead of "forrest", you may want to try one of those more specific questions
|
120 |
+
- How do forests help mitigate climate change?
|
121 |
+
- What is deforestation, and how does it contribute to climate change?
|
122 |
+
- How does climate change impact forests and their ecosystems?
|
123 |
+
- Can reforestation efforts help combat climate change?
|
124 |
+
- What role do forests play in the carbon cycle, and how does that impact climate change?
|
125 |
+
\n ⚠️ Always refer to the source to ensure the validity of the information communicated.
|
126 |
"""
|
127 |
)
|
128 |
with gr.Row():
|