TheoLvs commited on
Commit
0fb079d
1 Parent(s): 20f849b

Corrected app with sources input

Browse files
app.py CHANGED
@@ -87,6 +87,21 @@ share_client = service.get_share_client(file_share_name)
87
  user_id = create_user_id()
88
 
89
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
 
91
  # Create vectorstore and retriever
92
  vectorstore = get_pinecone_vectorstore(embeddings_function)
@@ -120,7 +135,7 @@ async def chat(query,history,audience,sources,reports):
120
  # if len(reports) == 0: # TODO
121
  reports = []
122
 
123
- inputs = {"user_input": query,"audience": audience_prompt,"sources":sources}
124
  result = agent.astream_events(inputs,version = "v1")
125
 
126
  # path_reformulation = "/logs/reformulation/final_output"
@@ -500,7 +515,26 @@ with gr.Blocks(title="Climate Q&A", css_paths=os.getcwd()+ "/style.css", theme=t
500
  with gr.Tab("About",elem_classes = "max-height other-tabs"):
501
  with gr.Row():
502
  with gr.Column(scale=1):
503
- gr.Markdown("See more info at [https://climateqa.com](https://climateqa.com/docs/intro/)")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
504
 
505
 
506
  def start_chat(query,history):
 
87
  user_id = create_user_id()
88
 
89
 
90
+ CITATION_LABEL = "BibTeX citation for ClimateQ&A"
91
+ CITATION_TEXT = r"""@misc{climateqa,
92
+ author={Théo Alves Da Costa, Timothée Bohe},
93
+ title={ClimateQ&A, AI-powered conversational assistant for climate change and biodiversity loss},
94
+ year={2024},
95
+ howpublished= {\url{https://climateqa.com}},
96
+ }
97
+ @software{climateqa,
98
+ author = {Théo Alves Da Costa, Timothée Bohe},
99
+ publisher = {ClimateQ&A},
100
+ title = {ClimateQ&A, AI-powered conversational assistant for climate change and biodiversity loss},
101
+ }
102
+ """
103
+
104
+
105
 
106
  # Create vectorstore and retriever
107
  vectorstore = get_pinecone_vectorstore(embeddings_function)
 
135
  # if len(reports) == 0: # TODO
136
  reports = []
137
 
138
+ inputs = {"user_input": query,"audience": audience_prompt,"sources_input":sources}
139
  result = agent.astream_events(inputs,version = "v1")
140
 
141
  # path_reformulation = "/logs/reformulation/final_output"
 
515
  with gr.Tab("About",elem_classes = "max-height other-tabs"):
516
  with gr.Row():
517
  with gr.Column(scale=1):
518
+
519
+
520
+
521
+
522
+ gr.Markdown("""
523
+ ### More info
524
+ - See more info at [https://climateqa.com](https://climateqa.com/docs/intro/)
525
+ - Feedbacks on this [form](https://forms.office.com/e/1Yzgxm6jbp)
526
+
527
+ ### Citation
528
+ """)
529
+
530
+ # Display citation label and text)
531
+ gr.Textbox(
532
+ value=CITATION_TEXT,
533
+ label=CITATION_LABEL,
534
+ interactive=False,
535
+ show_copy_button=True,
536
+ lines=len(CITATION_TEXT.split('\n')),
537
+ )
538
 
539
 
540
  def start_chat(query,history):
climateqa/engine/chains/query_transformation.py CHANGED
@@ -183,10 +183,13 @@ def make_query_transform_node(llm,k_final=15):
183
  # new_state["questions"] = new_questions
184
  # new_state["remaining_questions"] = new_questions
185
 
 
186
  new_state = {
187
  "remaining_questions":new_questions,
188
  "n_questions":len(new_questions),
189
  }
 
 
190
 
191
  return new_state
192
 
 
183
  # new_state["questions"] = new_questions
184
  # new_state["remaining_questions"] = new_questions
185
 
186
+
187
  new_state = {
188
  "remaining_questions":new_questions,
189
  "n_questions":len(new_questions),
190
  }
191
+
192
+ print("NEW STATE",new_state)
193
 
194
  return new_state
195