timeki commited on
Commit
d42d3d2
·
1 Parent(s): 175604a

slight modification of the prompt

Browse files
climateqa/engine/chains/answer_rag.py CHANGED
@@ -11,7 +11,7 @@ import time
11
  from ..utils import rename_chain, pass_values
12
 
13
 
14
- DEFAULT_DOCUMENT_PROMPT = PromptTemplate.from_template(template="Source : {source} - {page_content}")
15
 
16
  def _combine_documents(
17
  docs, document_prompt=DEFAULT_DOCUMENT_PROMPT, sep="\n\n"
 
11
  from ..utils import rename_chain, pass_values
12
 
13
 
14
+ DEFAULT_DOCUMENT_PROMPT = PromptTemplate.from_template(template="Source : {source} - Content : {page_content}")
15
 
16
  def _combine_documents(
17
  docs, document_prompt=DEFAULT_DOCUMENT_PROMPT, sep="\n\n"
climateqa/engine/chains/prompts.py CHANGED
@@ -66,7 +66,10 @@ You are ClimateQ&A, an AI Assistant created by Ekimetrics. You are given a quest
66
  Guidelines:
67
  - If the passages have useful facts or numbers, use them in your answer.
68
  - When you use information from a passage, mention where it came from by using [Doc i] at the end of the sentence. i stands for the number of the document.
69
- - Do not use the sentence 'Doc i says ...' to say where information came from.
 
 
 
70
  - If the same thing is said in more than one document, you can mention all of them like this: [Doc i, Doc j, Doc k]
71
  - Do not just summarize each passage one by one. Group your summaries to highlight the key parts in the explanation.
72
  - If it makes sense, use bullet points and lists to make your answers easier to understand.
@@ -74,8 +77,7 @@ Guidelines:
74
  - If the documents do not have the information needed to answer the question, just say you do not have enough information.
75
  - Consider by default that the question is about the past century unless it is specified otherwise.
76
  - If the passage is the caption of a picture, you can still use it as part of your answer as any other document.
77
- - If you receive passages from different reports, eg IPCC and PPCP, make separate paragraphs and specify the source of the information in your answer, eg "According to IPCC, ...".
78
- - The different sources are IPCC, IPBES, PPCP (for Plan Climat Air Energie Territorial de Paris), PBDP (for Plan Biodiversité de Paris), Acclimaterra.
79
 
80
  -----------------------
81
  Passages:
 
66
  Guidelines:
67
  - If the passages have useful facts or numbers, use them in your answer.
68
  - When you use information from a passage, mention where it came from by using [Doc i] at the end of the sentence. i stands for the number of the document.
69
+ - You will receive passages from different reports, eg IPCC and PPCP, make separate paragraphs and specify the source of the information in your answer, eg "According to IPCC, ...".
70
+ - The different sources are IPCC, IPBES, PPCP (for Plan Climat Air Energie Territorial de Paris), PBDP (for Plan Biodiversité de Paris), Acclimaterra.
71
+ - Do not mention that you are using specific extract documents, but mention only the source information. "According to IPCC, ..." rather than "According to the provided document from IPCC ..."
72
+ - Make a clear distinction between information from IPCC, IPBES, Acclimaterra that are scientific reports and PPCP, PBDP that are strategic reports. Strategic reports should not be taken has verified facts, but as political or strategic decisions.
73
  - If the same thing is said in more than one document, you can mention all of them like this: [Doc i, Doc j, Doc k]
74
  - Do not just summarize each passage one by one. Group your summaries to highlight the key parts in the explanation.
75
  - If it makes sense, use bullet points and lists to make your answers easier to understand.
 
77
  - If the documents do not have the information needed to answer the question, just say you do not have enough information.
78
  - Consider by default that the question is about the past century unless it is specified otherwise.
79
  - If the passage is the caption of a picture, you can still use it as part of your answer as any other document.
80
+
 
81
 
82
  -----------------------
83
  Passages:
climateqa/engine/chains/retrieve_documents.py CHANGED
@@ -416,7 +416,6 @@ async def retrieve_documents_for_all_questions(state, config, source_type, to_ha
416
 
417
  def make_IPx_retriever_node(vectorstore,reranker,llm,rerank_by_question=True, k_final=15, k_before_reranking=100, k_summary=5):
418
 
419
- @chain
420
  async def retrieve_IPx_docs(state, config):
421
  source_type = "IPx"
422
  IPx_questions_index = [i for i, x in enumerate(state["questions_list"]) if x["source_type"] == "IPx"]
@@ -441,7 +440,6 @@ def make_IPx_retriever_node(vectorstore,reranker,llm,rerank_by_question=True, k_
441
 
442
  def make_POC_retriever_node(vectorstore,reranker,llm,rerank_by_question=True, k_final=15, k_before_reranking=100, k_summary=5):
443
 
444
- @chain
445
  async def retrieve_POC_docs_node(state, config):
446
  if "POC region" not in state["relevant_content_sources_selection"] :
447
  return {}
 
416
 
417
  def make_IPx_retriever_node(vectorstore,reranker,llm,rerank_by_question=True, k_final=15, k_before_reranking=100, k_summary=5):
418
 
 
419
  async def retrieve_IPx_docs(state, config):
420
  source_type = "IPx"
421
  IPx_questions_index = [i for i, x in enumerate(state["questions_list"]) if x["source_type"] == "IPx"]
 
440
 
441
  def make_POC_retriever_node(vectorstore,reranker,llm,rerank_by_question=True, k_final=15, k_before_reranking=100, k_summary=5):
442
 
 
443
  async def retrieve_POC_docs_node(state, config):
444
  if "POC region" not in state["relevant_content_sources_selection"] :
445
  return {}