Commit ·
158e2b8
1
Parent(s): a560c11
add graphs from ourworldindata
Browse files- .gitignore +0 -1
- app.py +99 -26
- climateqa/engine/chains/answer_chitchat.py +3 -1
- climateqa/engine/chains/graph_retriever.py +2 -1
- climateqa/engine/chains/retriever.py +2 -1
- climateqa/engine/graph.py +3 -3
- sandbox/20240310 - CQA - Semantic Routing 1.ipynb +48 -65
- sandbox/20240702 - CQA - Graph Functionality.ipynb +0 -0
.gitignore
CHANGED
|
@@ -10,4 +10,3 @@ notebooks/
|
|
| 10 |
**/.flashrank_cache/
|
| 11 |
|
| 12 |
data/
|
| 13 |
-
sandbox/
|
|
|
|
| 10 |
**/.flashrank_cache/
|
| 11 |
|
| 12 |
data/
|
|
|
app.py
CHANGED
|
@@ -187,7 +187,61 @@ async def chat(query,history,audience,sources,reports,current_graphs):
|
|
| 187 |
answer_message_content += event["data"]["chunk"].content
|
| 188 |
answer_message_content = parse_output_llm_with_sources(answer_message_content)
|
| 189 |
history[-1] = ChatMessage(role="assistant", content = answer_message_content)
|
| 190 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 191 |
|
| 192 |
# if docs_used is True and event["metadata"]["langgraph_node"] in ["answer_rag_no_docs", "answer_chitchat", "answer_ai_impact"]:
|
| 193 |
# docs_used = False
|
|
@@ -302,7 +356,7 @@ async def chat(query,history,audience,sources,reports,current_graphs):
|
|
| 302 |
if event["name"] == "categorize_intent" and event["event"] == "on_chain_start":
|
| 303 |
print("X")
|
| 304 |
|
| 305 |
-
yield history,docs_html,output_query,output_language,gallery #,output_query,output_keywords
|
| 306 |
|
| 307 |
except Exception as e:
|
| 308 |
print(event, "has failed")
|
|
@@ -362,9 +416,7 @@ async def chat(query,history,audience,sources,reports,current_graphs):
|
|
| 362 |
else:
|
| 363 |
img_name = f"{img['key']}"
|
| 364 |
|
| 365 |
-
|
| 366 |
-
history[-1] = (history[-1][0],answer_yet)
|
| 367 |
-
history = [tuple(x) for x in history]
|
| 368 |
|
| 369 |
# print(f"\n\nImages:\n{gallery}")
|
| 370 |
|
|
@@ -383,7 +435,7 @@ async def chat(query,history,audience,sources,reports,current_graphs):
|
|
| 383 |
# # messages.append({"role": "assistant", "content": complete_response})
|
| 384 |
# # gradio_format = make_pairs([a["content"] for a in messages[1:]])
|
| 385 |
# # yield gradio_format, messages, docs_string
|
| 386 |
-
yield history,docs_html,output_query,output_language,gallery#,output_query,output_keywords
|
| 387 |
|
| 388 |
|
| 389 |
def save_feedback(feed: str, user_id):
|
|
@@ -543,7 +595,7 @@ with gr.Blocks(title="Climate Q&A", css_paths=os.getcwd()+ "/style.css", theme=t
|
|
| 543 |
dropdown_sources = gr.CheckboxGroup(
|
| 544 |
["IPCC", "IPBES","IPOS"],
|
| 545 |
label="Select source",
|
| 546 |
-
value=["IPCC"
|
| 547 |
interactive=True,
|
| 548 |
)
|
| 549 |
|
|
@@ -567,25 +619,43 @@ with gr.Blocks(title="Climate Q&A", css_paths=os.getcwd()+ "/style.css", theme=t
|
|
| 567 |
|
| 568 |
|
| 569 |
with gr.Tab("Recommended content", elem_id="tab-recommended_content", id=3) as recommended_content_tab:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 570 |
|
| 571 |
-
|
| 572 |
-
def display_default_recommended(current_graphs):
|
| 573 |
-
if len(current_graphs)==0:
|
| 574 |
-
placeholder_message = gr.HTML("<h2>There are no graphs to be displayed at the moment. Try asking another question.</h2>")
|
| 575 |
-
|
| 576 |
-
@gr.render(inputs=[current_graphs],triggers=[chat_completed_state.change])
|
| 577 |
-
def render_graphs(current_graph_list):
|
| 578 |
-
global saved_graphs
|
| 579 |
-
with gr.Column():
|
| 580 |
-
print(f"\ncurrent_graph_list:\n{current_graph_list}")
|
| 581 |
-
for (embedding, category) in current_graph_list:
|
| 582 |
-
graphs_placeholder = gr.HTML(embedding, elem_id="graphs-placeholder")
|
| 583 |
-
save_btn = gr.Button("Save Graph")
|
| 584 |
-
save_btn.click(
|
| 585 |
-
save_graph,
|
| 586 |
-
[saved_graphs, gr.State(embedding), gr.State(category)],
|
| 587 |
-
[saved_graphs, save_btn]
|
| 588 |
-
)
|
| 589 |
|
| 590 |
#---------------------------------------------------------------------------------------
|
| 591 |
# OTHER TABS
|
|
@@ -698,6 +768,7 @@ with gr.Blocks(title="Climate Q&A", css_paths=os.getcwd()+ "/style.css", theme=t
|
|
| 698 |
.then(chat, [textbox,chatbot,dropdown_audience, dropdown_sources,dropdown_reports, current_graphs], [chatbot,sources_textbox,output_query,output_language,gallery_component, current_graphs],concurrency_limit = 8,api_name = "chat_textbox")
|
| 699 |
.then(finish_chat, None, [textbox,tabs],api_name = "finish_chat_textbox")
|
| 700 |
.then(change_completion_status, [chat_completed_state], [chat_completed_state])
|
|
|
|
| 701 |
)
|
| 702 |
|
| 703 |
(examples_hidden
|
|
@@ -706,8 +777,10 @@ with gr.Blocks(title="Climate Q&A", css_paths=os.getcwd()+ "/style.css", theme=t
|
|
| 706 |
# .then(finish_chat, None, [textbox,tabs],api_name = "finish_chat_examples")
|
| 707 |
# .then(change_completion_status, [chat_completed_state], [chat_completed_state])
|
| 708 |
.change(start_chat, [examples_hidden,chatbot], [textbox,tabs,chatbot],queue = False,api_name = "start_chat_examples")
|
| 709 |
-
.then(chat, [examples_hidden,chatbot,dropdown_audience, dropdown_sources,dropdown_reports], [chatbot,sources_textbox,output_query,output_language,gallery_component],concurrency_limit = 8,api_name = "chat_examples")
|
| 710 |
.then(finish_chat, None, [textbox],api_name = "finish_chat_examples")
|
|
|
|
|
|
|
| 711 |
)
|
| 712 |
|
| 713 |
|
|
|
|
| 187 |
answer_message_content += event["data"]["chunk"].content
|
| 188 |
answer_message_content = parse_output_llm_with_sources(answer_message_content)
|
| 189 |
history[-1] = ChatMessage(role="assistant", content = answer_message_content)
|
| 190 |
+
|
| 191 |
+
|
| 192 |
+
elif event["name"] in ["retrieve_graphs", "retrieve_graphs_ai"] and event["event"] == "on_chain_end":
|
| 193 |
+
try:
|
| 194 |
+
recommended_content = event["data"]["output"]["recommended_content"]
|
| 195 |
+
# graphs = [
|
| 196 |
+
# {
|
| 197 |
+
# "embedding": x.metadata["returned_content"],
|
| 198 |
+
# "metadata": {
|
| 199 |
+
# "source": x.metadata["source"],
|
| 200 |
+
# "category": x.metadata["category"]
|
| 201 |
+
# }
|
| 202 |
+
# } for x in recommended_content if x.metadata["source"] == "OWID"
|
| 203 |
+
# ]
|
| 204 |
+
|
| 205 |
+
unique_graphs = []
|
| 206 |
+
seen_embeddings = set()
|
| 207 |
+
|
| 208 |
+
for x in recommended_content:
|
| 209 |
+
embedding = x.metadata["returned_content"]
|
| 210 |
+
|
| 211 |
+
# Check if the embedding has already been seen
|
| 212 |
+
if embedding not in seen_embeddings:
|
| 213 |
+
unique_graphs.append({
|
| 214 |
+
"embedding": embedding,
|
| 215 |
+
"metadata": {
|
| 216 |
+
"source": x.metadata["source"],
|
| 217 |
+
"category": x.metadata["category"]
|
| 218 |
+
}
|
| 219 |
+
})
|
| 220 |
+
# Add the embedding to the seen set
|
| 221 |
+
seen_embeddings.add(embedding)
|
| 222 |
+
|
| 223 |
+
|
| 224 |
+
categories = {}
|
| 225 |
+
for graph in unique_graphs:
|
| 226 |
+
category = graph['metadata']['category']
|
| 227 |
+
if category not in categories:
|
| 228 |
+
categories[category] = []
|
| 229 |
+
categories[category].append(graph['embedding'])
|
| 230 |
+
|
| 231 |
+
# graphs_html = ""
|
| 232 |
+
for category, embeddings in categories.items():
|
| 233 |
+
# graphs_html += f"<h3>{category}</h3>"
|
| 234 |
+
# current_graphs.append(f"<h3>{category}</h3>")
|
| 235 |
+
for embedding in embeddings:
|
| 236 |
+
current_graphs.append([embedding, category])
|
| 237 |
+
# graphs_html += f"<div>{embedding}</div>"
|
| 238 |
+
|
| 239 |
+
|
| 240 |
+
except Exception as e:
|
| 241 |
+
print(f"Error getting graphs: {e}")
|
| 242 |
+
|
| 243 |
+
|
| 244 |
+
# history.append(ChatMessage(role="assistant", content = new_message_content))
|
| 245 |
|
| 246 |
# if docs_used is True and event["metadata"]["langgraph_node"] in ["answer_rag_no_docs", "answer_chitchat", "answer_ai_impact"]:
|
| 247 |
# docs_used = False
|
|
|
|
| 356 |
if event["name"] == "categorize_intent" and event["event"] == "on_chain_start":
|
| 357 |
print("X")
|
| 358 |
|
| 359 |
+
yield history,docs_html,output_query,output_language,gallery, current_graphs #,output_query,output_keywords
|
| 360 |
|
| 361 |
except Exception as e:
|
| 362 |
print(event, "has failed")
|
|
|
|
| 416 |
else:
|
| 417 |
img_name = f"{img['key']}"
|
| 418 |
|
| 419 |
+
history.append(ChatMessage(role="assistant", content = f"\n\n{img_md}\n<p class='chatbot-caption'><b>{img_name}</b> - {img_caption}</p>"))
|
|
|
|
|
|
|
| 420 |
|
| 421 |
# print(f"\n\nImages:\n{gallery}")
|
| 422 |
|
|
|
|
| 435 |
# # messages.append({"role": "assistant", "content": complete_response})
|
| 436 |
# # gradio_format = make_pairs([a["content"] for a in messages[1:]])
|
| 437 |
# # yield gradio_format, messages, docs_string
|
| 438 |
+
yield history,docs_html,output_query,output_language,gallery, current_graphs#,output_query,output_keywords
|
| 439 |
|
| 440 |
|
| 441 |
def save_feedback(feed: str, user_id):
|
|
|
|
| 595 |
dropdown_sources = gr.CheckboxGroup(
|
| 596 |
["IPCC", "IPBES","IPOS"],
|
| 597 |
label="Select source",
|
| 598 |
+
value=["IPCC"],
|
| 599 |
interactive=True,
|
| 600 |
)
|
| 601 |
|
|
|
|
| 619 |
|
| 620 |
|
| 621 |
with gr.Tab("Recommended content", elem_id="tab-recommended_content", id=3) as recommended_content_tab:
|
| 622 |
+
# placeholder_message = gr.HTML("<h2>There are no graphs to be displayed at the moment. Try asking another question.</h2>")
|
| 623 |
+
graphs_container = gr.HTML("<h2>There are no graphs to be displayed at the moment. Try asking another question.</h2>")
|
| 624 |
+
current_graphs.change(lambda x : x, inputs=[current_graphs], outputs=[graphs_container])
|
| 625 |
+
|
| 626 |
+
# @gr.render(inputs=[current_graphs])
|
| 627 |
+
# def display_default_recommended(current_graphs):
|
| 628 |
+
# if len(current_graphs)==0:
|
| 629 |
+
# placeholder_message = gr.HTML("<h2>There are no graphs to be displayed at the moment. Try asking another question.</h2>")
|
| 630 |
+
|
| 631 |
+
# @gr.render(inputs=[current_graphs],triggers=[chat_completed_state.change])
|
| 632 |
+
# def render_graphs(current_graph_list):
|
| 633 |
+
# global saved_graphs
|
| 634 |
+
# with gr.Column():
|
| 635 |
+
# print(f"\ncurrent_graph_list:\n{current_graph_list}")
|
| 636 |
+
# for (embedding, category) in current_graph_list:
|
| 637 |
+
# graphs_placeholder = gr.HTML(embedding, elem_id="graphs-placeholder")
|
| 638 |
+
# save_btn = gr.Button("Save Graph")
|
| 639 |
+
# save_btn.click(
|
| 640 |
+
# save_graph,
|
| 641 |
+
# [saved_graphs, gr.State(embedding), gr.State(category)],
|
| 642 |
+
# [saved_graphs, save_btn]
|
| 643 |
+
# )
|
| 644 |
+
|
| 645 |
+
|
| 646 |
+
# # Display current_graphs
|
| 647 |
+
# with gr.Row():
|
| 648 |
+
# for embedding in current_graphs:
|
| 649 |
+
# with gr.Column():
|
| 650 |
+
# gr.HTML(embedding, elem_id="graphs-placeholder")
|
| 651 |
+
# save_btn = gr.Button("Save Graph")
|
| 652 |
+
# save_btn.click(
|
| 653 |
+
# save_graph,
|
| 654 |
+
# [saved_graphs, gr.State(embedding)],
|
| 655 |
+
# [saved_graphs, save_btn]
|
| 656 |
+
# )
|
| 657 |
|
| 658 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 659 |
|
| 660 |
#---------------------------------------------------------------------------------------
|
| 661 |
# OTHER TABS
|
|
|
|
| 768 |
.then(chat, [textbox,chatbot,dropdown_audience, dropdown_sources,dropdown_reports, current_graphs], [chatbot,sources_textbox,output_query,output_language,gallery_component, current_graphs],concurrency_limit = 8,api_name = "chat_textbox")
|
| 769 |
.then(finish_chat, None, [textbox,tabs],api_name = "finish_chat_textbox")
|
| 770 |
.then(change_completion_status, [chat_completed_state], [chat_completed_state])
|
| 771 |
+
# .then(lambda graphs : generate_html_graphs(graphs), [current_graphs], [graphs_container],)
|
| 772 |
)
|
| 773 |
|
| 774 |
(examples_hidden
|
|
|
|
| 777 |
# .then(finish_chat, None, [textbox,tabs],api_name = "finish_chat_examples")
|
| 778 |
# .then(change_completion_status, [chat_completed_state], [chat_completed_state])
|
| 779 |
.change(start_chat, [examples_hidden,chatbot], [textbox,tabs,chatbot],queue = False,api_name = "start_chat_examples")
|
| 780 |
+
.then(chat, [examples_hidden,chatbot,dropdown_audience, dropdown_sources,dropdown_reports, current_graphs], [chatbot,sources_textbox,output_query,output_language,gallery_component, current_graphs],concurrency_limit = 8,api_name = "chat_examples")
|
| 781 |
.then(finish_chat, None, [textbox],api_name = "finish_chat_examples")
|
| 782 |
+
# .then(lambda graphs : graphs, [current_graphs], [graphs_container])
|
| 783 |
+
|
| 784 |
)
|
| 785 |
|
| 786 |
|
climateqa/engine/chains/answer_chitchat.py
CHANGED
|
@@ -48,7 +48,9 @@ def make_chitchat_node(llm):
|
|
| 48 |
print("---- Answer chitchat ----")
|
| 49 |
|
| 50 |
answer = await chitchat_chain.ainvoke({"question":state["user_input"]},config)
|
| 51 |
-
|
|
|
|
|
|
|
| 52 |
|
| 53 |
return answer_chitchat
|
| 54 |
|
|
|
|
| 48 |
print("---- Answer chitchat ----")
|
| 49 |
|
| 50 |
answer = await chitchat_chain.ainvoke({"question":state["user_input"]},config)
|
| 51 |
+
state["answer"] = answer
|
| 52 |
+
return state
|
| 53 |
+
# return {"answer":answer}
|
| 54 |
|
| 55 |
return answer_chitchat
|
| 56 |
|
climateqa/engine/chains/graph_retriever.py
CHANGED
|
@@ -51,7 +51,8 @@ def make_graph_retriever_node(vectorstore, reranker, rerank_by_question=True, k_
|
|
| 51 |
|
| 52 |
POSSIBLE_SOURCES = ["IEA", "OWID"]
|
| 53 |
questions = state["remaining_questions"] if state["remaining_questions"] is not None and state["remaining_questions"]!=[] else [state["query"]]
|
| 54 |
-
sources_input = state["sources_input"]
|
|
|
|
| 55 |
|
| 56 |
auto_mode = "auto" in sources_input
|
| 57 |
|
|
|
|
| 51 |
|
| 52 |
POSSIBLE_SOURCES = ["IEA", "OWID"]
|
| 53 |
questions = state["remaining_questions"] if state["remaining_questions"] is not None and state["remaining_questions"]!=[] else [state["query"]]
|
| 54 |
+
# sources_input = state["sources_input"]
|
| 55 |
+
sources_input = ["auto"]
|
| 56 |
|
| 57 |
auto_mode = "auto" in sources_input
|
| 58 |
|
climateqa/engine/chains/retriever.py
CHANGED
|
@@ -3,7 +3,8 @@ import os
|
|
| 3 |
from contextlib import contextmanager
|
| 4 |
|
| 5 |
from ..reranker import rerank_docs
|
| 6 |
-
from ..retriever import ClimateQARetriever
|
|
|
|
| 7 |
|
| 8 |
|
| 9 |
|
|
|
|
| 3 |
from contextlib import contextmanager
|
| 4 |
|
| 5 |
from ..reranker import rerank_docs
|
| 6 |
+
from ...knowledge.retriever import ClimateQARetriever
|
| 7 |
+
|
| 8 |
|
| 9 |
|
| 10 |
|
climateqa/engine/graph.py
CHANGED
|
@@ -101,7 +101,7 @@ def make_graph_agent(llm, vectorstore_ipcc, vectorstore_graphs, reranker, thresh
|
|
| 101 |
chitchat_categorize_intent = make_chitchat_intent_categorization_node(llm)
|
| 102 |
|
| 103 |
# Define the nodes
|
| 104 |
-
workflow.add_node("set_defaults", set_defaults)
|
| 105 |
workflow.add_node("categorize_intent", categorize_intent)
|
| 106 |
workflow.add_node("search", search)
|
| 107 |
workflow.add_node("answer_search", answer_search)
|
|
@@ -122,7 +122,7 @@ def make_graph_agent(llm, vectorstore_ipcc, vectorstore_graphs, reranker, thresh
|
|
| 122 |
workflow.add_node("answer_rag_no_docs", answer_rag_no_docs)
|
| 123 |
|
| 124 |
# Entry point
|
| 125 |
-
workflow.set_entry_point("
|
| 126 |
|
| 127 |
# CONDITIONAL EDGES
|
| 128 |
workflow.add_conditional_edges(
|
|
@@ -155,7 +155,7 @@ def make_graph_agent(llm, vectorstore_ipcc, vectorstore_graphs, reranker, thresh
|
|
| 155 |
)
|
| 156 |
|
| 157 |
# Define the edges
|
| 158 |
-
workflow.add_edge("set_defaults", "categorize_intent")
|
| 159 |
workflow.add_edge("translate_query", "transform_query")
|
| 160 |
workflow.add_edge("transform_query", "retrieve_graphs")
|
| 161 |
# workflow.add_edge("retrieve_graphs", "answer_rag_graph")
|
|
|
|
| 101 |
chitchat_categorize_intent = make_chitchat_intent_categorization_node(llm)
|
| 102 |
|
| 103 |
# Define the nodes
|
| 104 |
+
# workflow.add_node("set_defaults", set_defaults)
|
| 105 |
workflow.add_node("categorize_intent", categorize_intent)
|
| 106 |
workflow.add_node("search", search)
|
| 107 |
workflow.add_node("answer_search", answer_search)
|
|
|
|
| 122 |
workflow.add_node("answer_rag_no_docs", answer_rag_no_docs)
|
| 123 |
|
| 124 |
# Entry point
|
| 125 |
+
workflow.set_entry_point("categorize_intent")
|
| 126 |
|
| 127 |
# CONDITIONAL EDGES
|
| 128 |
workflow.add_conditional_edges(
|
|
|
|
| 155 |
)
|
| 156 |
|
| 157 |
# Define the edges
|
| 158 |
+
# workflow.add_edge("set_defaults", "categorize_intent")
|
| 159 |
workflow.add_edge("translate_query", "transform_query")
|
| 160 |
workflow.add_edge("transform_query", "retrieve_graphs")
|
| 161 |
# workflow.add_edge("retrieve_graphs", "answer_rag_graph")
|
sandbox/20240310 - CQA - Semantic Routing 1.ipynb
CHANGED
|
@@ -119,39 +119,12 @@
|
|
| 119 |
]
|
| 120 |
},
|
| 121 |
{
|
| 122 |
-
"
|
| 123 |
-
"
|
| 124 |
-
"
|
| 125 |
-
|
| 126 |
-
"
|
| 127 |
-
"
|
| 128 |
-
"Cell \u001b[0;32mIn[4], line 5\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mclimateqa\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mengine\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01membeddings\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m get_embeddings_function\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mclimateqa\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mknowledge\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mretriever\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m ClimateQARetriever\n\u001b[0;32m----> 5\u001b[0m embeddings_function \u001b[38;5;241m=\u001b[39m \u001b[43mget_embeddings_function\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 6\u001b[0m vectorstore \u001b[38;5;241m=\u001b[39m get_pinecone_vectorstore(embeddings_function)\n",
|
| 129 |
-
"File \u001b[0;32m~/ai4s/climate_qa/climate-question-answering/climateqa/engine/embeddings.py:15\u001b[0m, in \u001b[0;36mget_embeddings_function\u001b[0;34m(version, query_instruction)\u001b[0m\n\u001b[1;32m 13\u001b[0m encode_kwargs \u001b[38;5;241m=\u001b[39m {\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mnormalize_embeddings\u001b[39m\u001b[38;5;124m'\u001b[39m: \u001b[38;5;28;01mTrue\u001b[39;00m,\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mshow_progress_bar\u001b[39m\u001b[38;5;124m\"\u001b[39m:\u001b[38;5;28;01mFalse\u001b[39;00m} \u001b[38;5;66;03m# set True to compute cosine similarity\u001b[39;00m\n\u001b[1;32m 14\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mLoading embeddings model: \u001b[39m\u001b[38;5;124m\"\u001b[39m, model_name)\n\u001b[0;32m---> 15\u001b[0m embeddings_function \u001b[38;5;241m=\u001b[39m \u001b[43mHuggingFaceBgeEmbeddings\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 16\u001b[0m \u001b[43m \u001b[49m\u001b[43mmodel_name\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmodel_name\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 17\u001b[0m \u001b[43m \u001b[49m\u001b[43mencode_kwargs\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mencode_kwargs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 18\u001b[0m \u001b[43m \u001b[49m\u001b[43mquery_instruction\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mquery_instruction\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 19\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 21\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 23\u001b[0m embeddings_function \u001b[38;5;241m=\u001b[39m HuggingFaceEmbeddings(model_name \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124msentence-transformers/multi-qa-mpnet-base-dot-v1\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n",
|
| 130 |
-
"File \u001b[0;32m~/anaconda3/envs/climateqa/lib/python3.11/site-packages/langchain_community/embeddings/huggingface.py:262\u001b[0m, in \u001b[0;36mHuggingFaceBgeEmbeddings.__init__\u001b[0;34m(self, **kwargs)\u001b[0m\n\u001b[1;32m 256\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mImportError\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m exc:\n\u001b[1;32m 257\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mImportError\u001b[39;00m(\n\u001b[1;32m 258\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mCould not import sentence_transformers python package. \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 259\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mPlease install it with `pip install sentence_transformers`.\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 260\u001b[0m ) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mexc\u001b[39;00m\n\u001b[0;32m--> 262\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mclient \u001b[38;5;241m=\u001b[39m \u001b[43msentence_transformers\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mSentenceTransformer\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 263\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmodel_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcache_folder\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcache_folder\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmodel_kwargs\u001b[49m\n\u001b[1;32m 264\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 265\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m-zh\u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmodel_name:\n\u001b[1;32m 266\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mquery_instruction \u001b[38;5;241m=\u001b[39m DEFAULT_QUERY_BGE_INSTRUCTION_ZH\n",
|
| 131 |
-
"File \u001b[0;32m~/anaconda3/envs/climateqa/lib/python3.11/site-packages/sentence_transformers/SentenceTransformer.py:191\u001b[0m, in \u001b[0;36mSentenceTransformer.__init__\u001b[0;34m(self, model_name_or_path, modules, device, prompts, default_prompt_name, cache_folder, trust_remote_code, revision, token, use_auth_token)\u001b[0m\n\u001b[1;32m 188\u001b[0m model_name_or_path \u001b[38;5;241m=\u001b[39m __MODEL_HUB_ORGANIZATION__ \u001b[38;5;241m+\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m/\u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;241m+\u001b[39m model_name_or_path\n\u001b[1;32m 190\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m is_sentence_transformer_model(model_name_or_path, token, cache_folder\u001b[38;5;241m=\u001b[39mcache_folder, revision\u001b[38;5;241m=\u001b[39mrevision):\n\u001b[0;32m--> 191\u001b[0m modules \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_load_sbert_model\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 192\u001b[0m \u001b[43m \u001b[49m\u001b[43mmodel_name_or_path\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 193\u001b[0m \u001b[43m \u001b[49m\u001b[43mtoken\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtoken\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 194\u001b[0m \u001b[43m \u001b[49m\u001b[43mcache_folder\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcache_folder\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 195\u001b[0m \u001b[43m \u001b[49m\u001b[43mrevision\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrevision\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 196\u001b[0m \u001b[43m \u001b[49m\u001b[43mtrust_remote_code\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtrust_remote_code\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 197\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 198\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 199\u001b[0m modules \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_load_auto_model(\n\u001b[1;32m 200\u001b[0m model_name_or_path,\n\u001b[1;32m 201\u001b[0m token\u001b[38;5;241m=\u001b[39mtoken,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 204\u001b[0m trust_remote_code\u001b[38;5;241m=\u001b[39mtrust_remote_code,\n\u001b[1;32m 205\u001b[0m )\n",
|
| 132 |
-
"File \u001b[0;32m~/anaconda3/envs/climateqa/lib/python3.11/site-packages/sentence_transformers/SentenceTransformer.py:1239\u001b[0m, in \u001b[0;36mSentenceTransformer._load_sbert_model\u001b[0;34m(self, model_name_or_path, token, cache_folder, revision, trust_remote_code)\u001b[0m\n\u001b[1;32m 1237\u001b[0m module_path \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m 1238\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1239\u001b[0m module_path \u001b[38;5;241m=\u001b[39m \u001b[43mload_dir_path\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1240\u001b[0m \u001b[43m \u001b[49m\u001b[43mmodel_name_or_path\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1241\u001b[0m \u001b[43m \u001b[49m\u001b[43mmodule_config\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mpath\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1242\u001b[0m \u001b[43m \u001b[49m\u001b[43mtoken\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtoken\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1243\u001b[0m \u001b[43m \u001b[49m\u001b[43mcache_folder\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcache_folder\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1244\u001b[0m \u001b[43m \u001b[49m\u001b[43mrevision\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrevision\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1245\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1246\u001b[0m module \u001b[38;5;241m=\u001b[39m module_class\u001b[38;5;241m.\u001b[39mload(module_path)\n\u001b[1;32m 1247\u001b[0m modules[module_config[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mname\u001b[39m\u001b[38;5;124m\"\u001b[39m]] \u001b[38;5;241m=\u001b[39m module\n",
|
| 133 |
-
"File \u001b[0;32m~/anaconda3/envs/climateqa/lib/python3.11/site-packages/sentence_transformers/util.py:567\u001b[0m, in \u001b[0;36mload_dir_path\u001b[0;34m(model_name_or_path, directory, token, cache_folder, revision)\u001b[0m\n\u001b[1;32m 565\u001b[0m \u001b[38;5;66;03m# Try to download from the remote\u001b[39;00m\n\u001b[1;32m 566\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 567\u001b[0m repo_path \u001b[38;5;241m=\u001b[39m \u001b[43msnapshot_download\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mdownload_kwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 568\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m:\n\u001b[1;32m 569\u001b[0m \u001b[38;5;66;03m# Otherwise, try local (i.e. cache) only\u001b[39;00m\n\u001b[1;32m 570\u001b[0m download_kwargs[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mlocal_files_only\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mTrue\u001b[39;00m\n",
|
| 134 |
-
"File \u001b[0;32m~/anaconda3/envs/climateqa/lib/python3.11/site-packages/huggingface_hub/utils/_validators.py:114\u001b[0m, in \u001b[0;36mvalidate_hf_hub_args.<locals>._inner_fn\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 111\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m check_use_auth_token:\n\u001b[1;32m 112\u001b[0m kwargs \u001b[38;5;241m=\u001b[39m smoothly_deprecate_use_auth_token(fn_name\u001b[38;5;241m=\u001b[39mfn\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__name__\u001b[39m, has_token\u001b[38;5;241m=\u001b[39mhas_token, kwargs\u001b[38;5;241m=\u001b[39mkwargs)\n\u001b[0;32m--> 114\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfn\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
|
| 135 |
-
"File \u001b[0;32m~/anaconda3/envs/climateqa/lib/python3.11/site-packages/huggingface_hub/_snapshot_download.py:155\u001b[0m, in \u001b[0;36msnapshot_download\u001b[0;34m(repo_id, repo_type, revision, cache_dir, local_dir, library_name, library_version, user_agent, proxies, etag_timeout, force_download, token, local_files_only, allow_patterns, ignore_patterns, max_workers, tqdm_class, headers, endpoint, local_dir_use_symlinks, resume_download)\u001b[0m\n\u001b[1;32m 146\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 147\u001b[0m \u001b[38;5;66;03m# if we have internet connection we want to list files to download\u001b[39;00m\n\u001b[1;32m 148\u001b[0m api \u001b[38;5;241m=\u001b[39m HfApi(\n\u001b[1;32m 149\u001b[0m library_name\u001b[38;5;241m=\u001b[39mlibrary_name,\n\u001b[1;32m 150\u001b[0m library_version\u001b[38;5;241m=\u001b[39mlibrary_version,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 153\u001b[0m headers\u001b[38;5;241m=\u001b[39mheaders,\n\u001b[1;32m 154\u001b[0m )\n\u001b[0;32m--> 155\u001b[0m repo_info \u001b[38;5;241m=\u001b[39m \u001b[43mapi\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrepo_info\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrepo_id\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrepo_id\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mrepo_type\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrepo_type\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mrevision\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrevision\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtoken\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtoken\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 156\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m (requests\u001b[38;5;241m.\u001b[39mexceptions\u001b[38;5;241m.\u001b[39mSSLError, requests\u001b[38;5;241m.\u001b[39mexceptions\u001b[38;5;241m.\u001b[39mProxyError):\n\u001b[1;32m 157\u001b[0m \u001b[38;5;66;03m# Actually raise for those subclasses of ConnectionError\u001b[39;00m\n\u001b[1;32m 158\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m\n",
|
| 136 |
-
"File \u001b[0;32m~/anaconda3/envs/climateqa/lib/python3.11/site-packages/huggingface_hub/utils/_validators.py:114\u001b[0m, in \u001b[0;36mvalidate_hf_hub_args.<locals>._inner_fn\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 111\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m check_use_auth_token:\n\u001b[1;32m 112\u001b[0m kwargs \u001b[38;5;241m=\u001b[39m smoothly_deprecate_use_auth_token(fn_name\u001b[38;5;241m=\u001b[39mfn\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__name__\u001b[39m, has_token\u001b[38;5;241m=\u001b[39mhas_token, kwargs\u001b[38;5;241m=\u001b[39mkwargs)\n\u001b[0;32m--> 114\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfn\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
|
| 137 |
-
"File \u001b[0;32m~/anaconda3/envs/climateqa/lib/python3.11/site-packages/huggingface_hub/hf_api.py:2682\u001b[0m, in \u001b[0;36mHfApi.repo_info\u001b[0;34m(self, repo_id, revision, repo_type, timeout, files_metadata, expand, token)\u001b[0m\n\u001b[1;32m 2680\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 2681\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mUnsupported repo type.\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m-> 2682\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mmethod\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 2683\u001b[0m \u001b[43m \u001b[49m\u001b[43mrepo_id\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2684\u001b[0m \u001b[43m \u001b[49m\u001b[43mrevision\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrevision\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2685\u001b[0m \u001b[43m \u001b[49m\u001b[43mtoken\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtoken\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2686\u001b[0m \u001b[43m \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtimeout\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2687\u001b[0m \u001b[43m \u001b[49m\u001b[43mexpand\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mexpand\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;66;43;03m# type: ignore[arg-type]\u001b[39;49;00m\n\u001b[1;32m 2688\u001b[0m \u001b[43m \u001b[49m\u001b[43mfiles_metadata\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mfiles_metadata\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2689\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n",
|
| 138 |
-
"File \u001b[0;32m~/anaconda3/envs/climateqa/lib/python3.11/site-packages/huggingface_hub/utils/_validators.py:114\u001b[0m, in \u001b[0;36mvalidate_hf_hub_args.<locals>._inner_fn\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 111\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m check_use_auth_token:\n\u001b[1;32m 112\u001b[0m kwargs \u001b[38;5;241m=\u001b[39m smoothly_deprecate_use_auth_token(fn_name\u001b[38;5;241m=\u001b[39mfn\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__name__\u001b[39m, has_token\u001b[38;5;241m=\u001b[39mhas_token, kwargs\u001b[38;5;241m=\u001b[39mkwargs)\n\u001b[0;32m--> 114\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfn\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
|
| 139 |
-
"File \u001b[0;32m~/anaconda3/envs/climateqa/lib/python3.11/site-packages/huggingface_hub/hf_api.py:2466\u001b[0m, in \u001b[0;36mHfApi.model_info\u001b[0;34m(self, repo_id, revision, timeout, securityStatus, files_metadata, expand, token)\u001b[0m\n\u001b[1;32m 2464\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m expand:\n\u001b[1;32m 2465\u001b[0m params[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mexpand\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m expand\n\u001b[0;32m-> 2466\u001b[0m r \u001b[38;5;241m=\u001b[39m \u001b[43mget_session\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpath\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mheaders\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mheaders\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtimeout\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparams\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mparams\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 2467\u001b[0m hf_raise_for_status(r)\n\u001b[1;32m 2468\u001b[0m data \u001b[38;5;241m=\u001b[39m r\u001b[38;5;241m.\u001b[39mjson()\n",
|
| 140 |
-
"File \u001b[0;32m~/anaconda3/envs/climateqa/lib/python3.11/site-packages/requests/sessions.py:602\u001b[0m, in \u001b[0;36mSession.get\u001b[0;34m(self, url, **kwargs)\u001b[0m\n\u001b[1;32m 594\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124mr\u001b[39m\u001b[38;5;124;03m\"\"\"Sends a GET request. Returns :class:`Response` object.\u001b[39;00m\n\u001b[1;32m 595\u001b[0m \n\u001b[1;32m 596\u001b[0m \u001b[38;5;124;03m:param url: URL for the new :class:`Request` object.\u001b[39;00m\n\u001b[1;32m 597\u001b[0m \u001b[38;5;124;03m:param \\*\\*kwargs: Optional arguments that ``request`` takes.\u001b[39;00m\n\u001b[1;32m 598\u001b[0m \u001b[38;5;124;03m:rtype: requests.Response\u001b[39;00m\n\u001b[1;32m 599\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 601\u001b[0m kwargs\u001b[38;5;241m.\u001b[39msetdefault(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mallow_redirects\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;28;01mTrue\u001b[39;00m)\n\u001b[0;32m--> 602\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mGET\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
|
| 141 |
-
"File \u001b[0;32m~/anaconda3/envs/climateqa/lib/python3.11/site-packages/requests/sessions.py:589\u001b[0m, in \u001b[0;36mSession.request\u001b[0;34m(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)\u001b[0m\n\u001b[1;32m 584\u001b[0m send_kwargs \u001b[38;5;241m=\u001b[39m {\n\u001b[1;32m 585\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtimeout\u001b[39m\u001b[38;5;124m\"\u001b[39m: timeout,\n\u001b[1;32m 586\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mallow_redirects\u001b[39m\u001b[38;5;124m\"\u001b[39m: allow_redirects,\n\u001b[1;32m 587\u001b[0m }\n\u001b[1;32m 588\u001b[0m send_kwargs\u001b[38;5;241m.\u001b[39mupdate(settings)\n\u001b[0;32m--> 589\u001b[0m resp \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msend\u001b[49m\u001b[43m(\u001b[49m\u001b[43mprep\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43msend_kwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 591\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m resp\n",
|
| 142 |
-
"File \u001b[0;32m~/anaconda3/envs/climateqa/lib/python3.11/site-packages/requests/sessions.py:703\u001b[0m, in \u001b[0;36mSession.send\u001b[0;34m(self, request, **kwargs)\u001b[0m\n\u001b[1;32m 700\u001b[0m start \u001b[38;5;241m=\u001b[39m preferred_clock()\n\u001b[1;32m 702\u001b[0m \u001b[38;5;66;03m# Send the request\u001b[39;00m\n\u001b[0;32m--> 703\u001b[0m r \u001b[38;5;241m=\u001b[39m \u001b[43madapter\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msend\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 705\u001b[0m \u001b[38;5;66;03m# Total elapsed time of the request (approximately)\u001b[39;00m\n\u001b[1;32m 706\u001b[0m elapsed \u001b[38;5;241m=\u001b[39m preferred_clock() \u001b[38;5;241m-\u001b[39m start\n",
|
| 143 |
-
"File \u001b[0;32m~/anaconda3/envs/climateqa/lib/python3.11/site-packages/huggingface_hub/utils/_http.py:93\u001b[0m, in \u001b[0;36mUniqueRequestIdAdapter.send\u001b[0;34m(self, request, *args, **kwargs)\u001b[0m\n\u001b[1;32m 91\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"Catch any RequestException to append request id to the error message for debugging.\"\"\"\u001b[39;00m\n\u001b[1;32m 92\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m---> 93\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msend\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 94\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m requests\u001b[38;5;241m.\u001b[39mRequestException \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[1;32m 95\u001b[0m request_id \u001b[38;5;241m=\u001b[39m request\u001b[38;5;241m.\u001b[39mheaders\u001b[38;5;241m.\u001b[39mget(X_AMZN_TRACE_ID)\n",
|
| 144 |
-
"File \u001b[0;32m~/anaconda3/envs/climateqa/lib/python3.11/site-packages/requests/adapters.py:667\u001b[0m, in \u001b[0;36mHTTPAdapter.send\u001b[0;34m(self, request, stream, timeout, verify, cert, proxies)\u001b[0m\n\u001b[1;32m 664\u001b[0m timeout \u001b[38;5;241m=\u001b[39m TimeoutSauce(connect\u001b[38;5;241m=\u001b[39mtimeout, read\u001b[38;5;241m=\u001b[39mtimeout)\n\u001b[1;32m 666\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 667\u001b[0m resp \u001b[38;5;241m=\u001b[39m \u001b[43mconn\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43murlopen\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 668\u001b[0m \u001b[43m \u001b[49m\u001b[43mmethod\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 669\u001b[0m \u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 670\u001b[0m \u001b[43m \u001b[49m\u001b[43mbody\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mbody\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 671\u001b[0m \u001b[43m \u001b[49m\u001b[43mheaders\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mheaders\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 672\u001b[0m \u001b[43m \u001b[49m\u001b[43mredirect\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m 673\u001b[0m \u001b[43m \u001b[49m\u001b[43massert_same_host\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m 674\u001b[0m \u001b[43m \u001b[49m\u001b[43mpreload_content\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m 675\u001b[0m \u001b[43m \u001b[49m\u001b[43mdecode_content\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m 676\u001b[0m \u001b[43m \u001b[49m\u001b[43mretries\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmax_retries\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 677\u001b[0m \u001b[43m \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtimeout\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 678\u001b[0m \u001b[43m \u001b[49m\u001b[43mchunked\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mchunked\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 679\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 681\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m (ProtocolError, \u001b[38;5;167;01mOSError\u001b[39;00m) \u001b[38;5;28;01mas\u001b[39;00m err:\n\u001b[1;32m 682\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mConnectionError\u001b[39;00m(err, request\u001b[38;5;241m=\u001b[39mrequest)\n",
|
| 145 |
-
"File \u001b[0;32m~/anaconda3/envs/climateqa/lib/python3.11/site-packages/urllib3/connectionpool.py:789\u001b[0m, in \u001b[0;36mHTTPConnectionPool.urlopen\u001b[0;34m(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, preload_content, decode_content, **response_kw)\u001b[0m\n\u001b[1;32m 786\u001b[0m response_conn \u001b[38;5;241m=\u001b[39m conn \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m release_conn \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m 788\u001b[0m \u001b[38;5;66;03m# Make the request on the HTTPConnection object\u001b[39;00m\n\u001b[0;32m--> 789\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_make_request\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 790\u001b[0m \u001b[43m \u001b[49m\u001b[43mconn\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 791\u001b[0m \u001b[43m \u001b[49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 792\u001b[0m \u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 793\u001b[0m \u001b[43m \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtimeout_obj\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 794\u001b[0m \u001b[43m \u001b[49m\u001b[43mbody\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mbody\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 795\u001b[0m \u001b[43m \u001b[49m\u001b[43mheaders\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mheaders\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 796\u001b[0m \u001b[43m \u001b[49m\u001b[43mchunked\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mchunked\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 797\u001b[0m \u001b[43m \u001b[49m\u001b[43mretries\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mretries\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 798\u001b[0m \u001b[43m \u001b[49m\u001b[43mresponse_conn\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mresponse_conn\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 799\u001b[0m \u001b[43m \u001b[49m\u001b[43mpreload_content\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mpreload_content\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 800\u001b[0m \u001b[43m \u001b[49m\u001b[43mdecode_content\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdecode_content\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 801\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mresponse_kw\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 802\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 804\u001b[0m \u001b[38;5;66;03m# Everything went great!\u001b[39;00m\n\u001b[1;32m 805\u001b[0m clean_exit \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mTrue\u001b[39;00m\n",
|
| 146 |
-
"File \u001b[0;32m~/anaconda3/envs/climateqa/lib/python3.11/site-packages/urllib3/connectionpool.py:536\u001b[0m, in \u001b[0;36mHTTPConnectionPool._make_request\u001b[0;34m(self, conn, method, url, body, headers, retries, timeout, chunked, response_conn, preload_content, decode_content, enforce_content_length)\u001b[0m\n\u001b[1;32m 534\u001b[0m \u001b[38;5;66;03m# Receive the response from the server\u001b[39;00m\n\u001b[1;32m 535\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 536\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[43mconn\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgetresponse\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 537\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m (BaseSSLError, \u001b[38;5;167;01mOSError\u001b[39;00m) \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[1;32m 538\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_raise_timeout(err\u001b[38;5;241m=\u001b[39me, url\u001b[38;5;241m=\u001b[39murl, timeout_value\u001b[38;5;241m=\u001b[39mread_timeout)\n",
|
| 147 |
-
"File \u001b[0;32m~/anaconda3/envs/climateqa/lib/python3.11/site-packages/urllib3/connection.py:507\u001b[0m, in \u001b[0;36mHTTPConnection.getresponse\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 504\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mresponse\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m HTTPResponse\n\u001b[1;32m 506\u001b[0m \u001b[38;5;66;03m# Get the response from http.client.HTTPConnection\u001b[39;00m\n\u001b[0;32m--> 507\u001b[0m httplib_response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgetresponse\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 509\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 510\u001b[0m assert_header_parsing(httplib_response\u001b[38;5;241m.\u001b[39mmsg)\n",
|
| 148 |
-
"File \u001b[0;32m~/anaconda3/envs/climateqa/lib/python3.11/http/client.py:1395\u001b[0m, in \u001b[0;36mHTTPConnection.getresponse\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 1393\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1394\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m-> 1395\u001b[0m \u001b[43mresponse\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mbegin\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1396\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mConnectionError\u001b[39;00m:\n\u001b[1;32m 1397\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mclose()\n",
|
| 149 |
-
"File \u001b[0;32m~/anaconda3/envs/climateqa/lib/python3.11/http/client.py:325\u001b[0m, in \u001b[0;36mHTTPResponse.begin\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 323\u001b[0m \u001b[38;5;66;03m# read until we get a non-100 response\u001b[39;00m\n\u001b[1;32m 324\u001b[0m \u001b[38;5;28;01mwhile\u001b[39;00m \u001b[38;5;28;01mTrue\u001b[39;00m:\n\u001b[0;32m--> 325\u001b[0m version, status, reason \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_read_status\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 326\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m status \u001b[38;5;241m!=\u001b[39m CONTINUE:\n\u001b[1;32m 327\u001b[0m \u001b[38;5;28;01mbreak\u001b[39;00m\n",
|
| 150 |
-
"File \u001b[0;32m~/anaconda3/envs/climateqa/lib/python3.11/http/client.py:286\u001b[0m, in \u001b[0;36mHTTPResponse._read_status\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 285\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m_read_status\u001b[39m(\u001b[38;5;28mself\u001b[39m):\n\u001b[0;32m--> 286\u001b[0m line \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mstr\u001b[39m(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mfp\u001b[38;5;241m.\u001b[39mreadline(_MAXLINE \u001b[38;5;241m+\u001b[39m \u001b[38;5;241m1\u001b[39m), \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124miso-8859-1\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 287\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(line) \u001b[38;5;241m>\u001b[39m _MAXLINE:\n\u001b[1;32m 288\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m LineTooLong(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mstatus line\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n",
|
| 151 |
-
"File \u001b[0;32m~/anaconda3/envs/climateqa/lib/python3.11/socket.py:706\u001b[0m, in \u001b[0;36mSocketIO.readinto\u001b[0;34m(self, b)\u001b[0m\n\u001b[1;32m 704\u001b[0m \u001b[38;5;28;01mwhile\u001b[39;00m \u001b[38;5;28;01mTrue\u001b[39;00m:\n\u001b[1;32m 705\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 706\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_sock\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrecv_into\u001b[49m\u001b[43m(\u001b[49m\u001b[43mb\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 707\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m timeout:\n\u001b[1;32m 708\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_timeout_occurred \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mTrue\u001b[39;00m\n",
|
| 152 |
-
"File \u001b[0;32m~/anaconda3/envs/climateqa/lib/python3.11/ssl.py:1314\u001b[0m, in \u001b[0;36mSSLSocket.recv_into\u001b[0;34m(self, buffer, nbytes, flags)\u001b[0m\n\u001b[1;32m 1310\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m flags \u001b[38;5;241m!=\u001b[39m \u001b[38;5;241m0\u001b[39m:\n\u001b[1;32m 1311\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\n\u001b[1;32m 1312\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mnon-zero flags not allowed in calls to recv_into() on \u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;241m%\u001b[39m\n\u001b[1;32m 1313\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__class__\u001b[39m)\n\u001b[0;32m-> 1314\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mread\u001b[49m\u001b[43m(\u001b[49m\u001b[43mnbytes\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mbuffer\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1315\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 1316\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28msuper\u001b[39m()\u001b[38;5;241m.\u001b[39mrecv_into(buffer, nbytes, flags)\n",
|
| 153 |
-
"File \u001b[0;32m~/anaconda3/envs/climateqa/lib/python3.11/ssl.py:1166\u001b[0m, in \u001b[0;36mSSLSocket.read\u001b[0;34m(self, len, buffer)\u001b[0m\n\u001b[1;32m 1164\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1165\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m buffer \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m-> 1166\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_sslobj\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mread\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mlen\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mbuffer\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1167\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 1168\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_sslobj\u001b[38;5;241m.\u001b[39mread(\u001b[38;5;28mlen\u001b[39m)\n",
|
| 154 |
-
"\u001b[0;31mKeyboardInterrupt\u001b[0m: "
|
| 155 |
]
|
| 156 |
}
|
| 157 |
],
|
|
@@ -166,7 +139,7 @@
|
|
| 166 |
},
|
| 167 |
{
|
| 168 |
"cell_type": "code",
|
| 169 |
-
"execution_count":
|
| 170 |
"id": "882811c8-5890-4048-8630-d052c5179d7d",
|
| 171 |
"metadata": {},
|
| 172 |
"outputs": [],
|
|
@@ -176,7 +149,7 @@
|
|
| 176 |
},
|
| 177 |
{
|
| 178 |
"cell_type": "code",
|
| 179 |
-
"execution_count":
|
| 180 |
"id": "51aed81d-860b-409a-bae0-f0e1eeb0f120",
|
| 181 |
"metadata": {},
|
| 182 |
"outputs": [
|
|
@@ -186,7 +159,7 @@
|
|
| 186 |
"False"
|
| 187 |
]
|
| 188 |
},
|
| 189 |
-
"execution_count":
|
| 190 |
"metadata": {},
|
| 191 |
"output_type": "execute_result"
|
| 192 |
}
|
|
@@ -721,10 +694,22 @@
|
|
| 721 |
},
|
| 722 |
{
|
| 723 |
"cell_type": "code",
|
| 724 |
-
"execution_count":
|
| 725 |
"id": "2376e1d7-5893-4022-a0af-155bb8c1950f",
|
| 726 |
"metadata": {},
|
| 727 |
-
"outputs": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 728 |
"source": [
|
| 729 |
"from climateqa.engine.graph import make_graph_agent,display_graph\n",
|
| 730 |
"agent = make_graph_agent(llm,vectorstore,reranker)"
|
|
@@ -1233,7 +1218,7 @@
|
|
| 1233 |
},
|
| 1234 |
{
|
| 1235 |
"cell_type": "code",
|
| 1236 |
-
"execution_count":
|
| 1237 |
"id": "b91f4f58",
|
| 1238 |
"metadata": {},
|
| 1239 |
"outputs": [
|
|
@@ -1250,6 +1235,20 @@
|
|
| 1250 |
"text": [
|
| 1251 |
"---- Translate query ----\n"
|
| 1252 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1253 |
}
|
| 1254 |
],
|
| 1255 |
"source": [
|
|
@@ -1265,7 +1264,7 @@
|
|
| 1265 |
},
|
| 1266 |
{
|
| 1267 |
"cell_type": "code",
|
| 1268 |
-
"execution_count":
|
| 1269 |
"id": "c3c70cdb",
|
| 1270 |
"metadata": {},
|
| 1271 |
"outputs": [
|
|
@@ -1292,35 +1291,19 @@
|
|
| 1292 |
},
|
| 1293 |
{
|
| 1294 |
"cell_type": "code",
|
| 1295 |
-
"execution_count":
|
| 1296 |
"id": "05ead97d",
|
| 1297 |
"metadata": {},
|
| 1298 |
"outputs": [
|
| 1299 |
{
|
| 1300 |
-
"
|
| 1301 |
-
"
|
| 1302 |
-
"
|
| 1303 |
-
|
| 1304 |
-
"----
|
| 1305 |
-
|
| 1306 |
-
|
| 1307 |
-
|
| 1308 |
-
"name": "stderr",
|
| 1309 |
-
"output_type": "stream",
|
| 1310 |
-
"text": [
|
| 1311 |
-
"/tmp/ipykernel_19549/336144448.py:7: LangChainBetaWarning: This API is in beta and may change in the future.\n",
|
| 1312 |
-
" async for event in app.astream_events({\"user_input\": question,\"sources\":[\"auto\"], \"audience\" : 'expert'}, version=\"v1\"):\n",
|
| 1313 |
-
"INFO:httpx:HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n"
|
| 1314 |
-
]
|
| 1315 |
-
},
|
| 1316 |
-
{
|
| 1317 |
-
"name": "stdout",
|
| 1318 |
-
"output_type": "stream",
|
| 1319 |
-
"text": [
|
| 1320 |
-
"\n",
|
| 1321 |
-
"\n",
|
| 1322 |
-
"Output intent categorization: {'intent': 'search'}\n",
|
| 1323 |
-
"\n"
|
| 1324 |
]
|
| 1325 |
}
|
| 1326 |
],
|
|
|
|
| 119 |
]
|
| 120 |
},
|
| 121 |
{
|
| 122 |
+
"name": "stderr",
|
| 123 |
+
"output_type": "stream",
|
| 124 |
+
"text": [
|
| 125 |
+
"INFO:sentence_transformers.SentenceTransformer:Use pytorch device_name: cpu\n",
|
| 126 |
+
"/home/tim/ai4s/climate_qa/climate-question-answering/climateqa/engine/vectorstore.py:38: LangChainDeprecationWarning: The class `Pinecone` was deprecated in LangChain 0.0.18 and will be removed in 0.3.0. An updated version of the class exists in the langchain-pinecone package and should be used instead. To use it run `pip install -U langchain-pinecone` and import as `from langchain_pinecone import Pinecone`.\n",
|
| 127 |
+
" vectorstore = PineconeVectorstore(\n"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
]
|
| 129 |
}
|
| 130 |
],
|
|
|
|
| 139 |
},
|
| 140 |
{
|
| 141 |
"cell_type": "code",
|
| 142 |
+
"execution_count": 5,
|
| 143 |
"id": "882811c8-5890-4048-8630-d052c5179d7d",
|
| 144 |
"metadata": {},
|
| 145 |
"outputs": [],
|
|
|
|
| 149 |
},
|
| 150 |
{
|
| 151 |
"cell_type": "code",
|
| 152 |
+
"execution_count": 6,
|
| 153 |
"id": "51aed81d-860b-409a-bae0-f0e1eeb0f120",
|
| 154 |
"metadata": {},
|
| 155 |
"outputs": [
|
|
|
|
| 159 |
"False"
|
| 160 |
]
|
| 161 |
},
|
| 162 |
+
"execution_count": 6,
|
| 163 |
"metadata": {},
|
| 164 |
"output_type": "execute_result"
|
| 165 |
}
|
|
|
|
| 694 |
},
|
| 695 |
{
|
| 696 |
"cell_type": "code",
|
| 697 |
+
"execution_count": 7,
|
| 698 |
"id": "2376e1d7-5893-4022-a0af-155bb8c1950f",
|
| 699 |
"metadata": {},
|
| 700 |
+
"outputs": [
|
| 701 |
+
{
|
| 702 |
+
"ename": "TypeError",
|
| 703 |
+
"evalue": "make_graph_agent() missing 1 required positional argument: 'reranker'",
|
| 704 |
+
"output_type": "error",
|
| 705 |
+
"traceback": [
|
| 706 |
+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
| 707 |
+
"\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)",
|
| 708 |
+
"Cell \u001b[0;32mIn[7], line 2\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mclimateqa\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mengine\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mgraph\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m make_graph_agent,display_graph\n\u001b[0;32m----> 2\u001b[0m agent \u001b[38;5;241m=\u001b[39m \u001b[43mmake_graph_agent\u001b[49m\u001b[43m(\u001b[49m\u001b[43mllm\u001b[49m\u001b[43m,\u001b[49m\u001b[43mvectorstore\u001b[49m\u001b[43m,\u001b[49m\u001b[43mreranker\u001b[49m\u001b[43m)\u001b[49m\n",
|
| 709 |
+
"\u001b[0;31mTypeError\u001b[0m: make_graph_agent() missing 1 required positional argument: 'reranker'"
|
| 710 |
+
]
|
| 711 |
+
}
|
| 712 |
+
],
|
| 713 |
"source": [
|
| 714 |
"from climateqa.engine.graph import make_graph_agent,display_graph\n",
|
| 715 |
"agent = make_graph_agent(llm,vectorstore,reranker)"
|
|
|
|
| 1218 |
},
|
| 1219 |
{
|
| 1220 |
"cell_type": "code",
|
| 1221 |
+
"execution_count": 10,
|
| 1222 |
"id": "b91f4f58",
|
| 1223 |
"metadata": {},
|
| 1224 |
"outputs": [
|
|
|
|
| 1235 |
"text": [
|
| 1236 |
"---- Translate query ----\n"
|
| 1237 |
]
|
| 1238 |
+
},
|
| 1239 |
+
{
|
| 1240 |
+
"ename": "ValueError",
|
| 1241 |
+
"evalue": "Node `retrieve_graphs_chitchat` is not reachable",
|
| 1242 |
+
"output_type": "error",
|
| 1243 |
+
"traceback": [
|
| 1244 |
+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
| 1245 |
+
"\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)",
|
| 1246 |
+
"Cell \u001b[0;32mIn[10], line 8\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mlangchain_chroma\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m Chroma\n\u001b[1;32m 7\u001b[0m vectorstore_graphs \u001b[38;5;241m=\u001b[39m Chroma(persist_directory\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m/home/tim/ai4s/climate_qa/climate-question-answering/data/vectorstore_owid\u001b[39m\u001b[38;5;124m\"\u001b[39m, embedding_function\u001b[38;5;241m=\u001b[39membeddings_function)\n\u001b[0;32m----> 8\u001b[0m app \u001b[38;5;241m=\u001b[39m \u001b[43mmake_graph_agent\u001b[49m\u001b[43m(\u001b[49m\u001b[43mllm\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mvectorstore_ipcc\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m \u001b[49m\u001b[43mvectorstore\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mvectorstore_graphs\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m \u001b[49m\u001b[43mvectorstore_graphs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mreranker\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mreranker\u001b[49m\u001b[43m)\u001b[49m\n",
|
| 1247 |
+
"File \u001b[0;32m~/ai4s/climate_qa/climate-question-answering/climateqa/engine/graph.py:178\u001b[0m, in \u001b[0;36mmake_graph_agent\u001b[0;34m(llm, vectorstore_ipcc, vectorstore_graphs, reranker, threshold_docs)\u001b[0m\n\u001b[1;32m 169\u001b[0m workflow\u001b[38;5;241m.\u001b[39madd_edge(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mretrieve_graphs_chitchat\u001b[39m\u001b[38;5;124m\"\u001b[39m, END)\n\u001b[1;32m 170\u001b[0m \u001b[38;5;66;03m# workflow.add_edge(\"answer_ai_impact\", \"translate_query_ai\")\u001b[39;00m\n\u001b[1;32m 171\u001b[0m \u001b[38;5;66;03m# workflow.add_edge(\"translate_query_ai\", \"transform_query_ai\")\u001b[39;00m\n\u001b[1;32m 172\u001b[0m \u001b[38;5;66;03m# workflow.add_edge(\"transform_query_ai\", \"retrieve_graphs_ai\")\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 176\u001b[0m \n\u001b[1;32m 177\u001b[0m \u001b[38;5;66;03m# Compile\u001b[39;00m\n\u001b[0;32m--> 178\u001b[0m app \u001b[38;5;241m=\u001b[39m \u001b[43mworkflow\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcompile\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 179\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m app\n",
|
| 1248 |
+
"File \u001b[0;32m~/anaconda3/envs/climateqa/lib/python3.11/site-packages/langgraph/graph/state.py:430\u001b[0m, in \u001b[0;36mStateGraph.compile\u001b[0;34m(self, checkpointer, store, interrupt_before, interrupt_after, debug)\u001b[0m\n\u001b[1;32m 427\u001b[0m interrupt_after \u001b[38;5;241m=\u001b[39m interrupt_after \u001b[38;5;129;01mor\u001b[39;00m []\n\u001b[1;32m 429\u001b[0m \u001b[38;5;66;03m# validate the graph\u001b[39;00m\n\u001b[0;32m--> 430\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mvalidate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 431\u001b[0m \u001b[43m \u001b[49m\u001b[43minterrupt\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m(\u001b[49m\n\u001b[1;32m 432\u001b[0m \u001b[43m \u001b[49m\u001b[43m(\u001b[49m\u001b[43minterrupt_before\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mif\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43minterrupt_before\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m!=\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43m*\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01melse\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43m[\u001b[49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m+\u001b[39;49m\u001b[43m \u001b[49m\u001b[43minterrupt_after\u001b[49m\n\u001b[1;32m 433\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43;01mif\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43minterrupt_after\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m!=\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43m*\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\n\u001b[1;32m 434\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43;01melse\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43m[\u001b[49m\u001b[43m]\u001b[49m\n\u001b[1;32m 435\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 436\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 438\u001b[0m \u001b[38;5;66;03m# prepare output channels\u001b[39;00m\n\u001b[1;32m 439\u001b[0m output_channels \u001b[38;5;241m=\u001b[39m (\n\u001b[1;32m 440\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m__root__\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 441\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mschemas[\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39moutput]) \u001b[38;5;241m==\u001b[39m \u001b[38;5;241m1\u001b[39m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 447\u001b[0m ]\n\u001b[1;32m 448\u001b[0m )\n",
|
| 1249 |
+
"File \u001b[0;32m~/anaconda3/envs/climateqa/lib/python3.11/site-packages/langgraph/graph/graph.py:393\u001b[0m, in \u001b[0;36mGraph.validate\u001b[0;34m(self, interrupt)\u001b[0m\n\u001b[1;32m 391\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m node \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mnodes:\n\u001b[1;32m 392\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m node \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;129;01min\u001b[39;00m all_targets:\n\u001b[0;32m--> 393\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mNode `\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mnode\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m` is not reachable\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 394\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m target \u001b[38;5;129;01min\u001b[39;00m all_targets:\n\u001b[1;32m 395\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m target \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mnodes \u001b[38;5;129;01mand\u001b[39;00m target \u001b[38;5;241m!=\u001b[39m END:\n",
|
| 1250 |
+
"\u001b[0;31mValueError\u001b[0m: Node `retrieve_graphs_chitchat` is not reachable"
|
| 1251 |
+
]
|
| 1252 |
}
|
| 1253 |
],
|
| 1254 |
"source": [
|
|
|
|
| 1264 |
},
|
| 1265 |
{
|
| 1266 |
"cell_type": "code",
|
| 1267 |
+
"execution_count": 8,
|
| 1268 |
"id": "c3c70cdb",
|
| 1269 |
"metadata": {},
|
| 1270 |
"outputs": [
|
|
|
|
| 1291 |
},
|
| 1292 |
{
|
| 1293 |
"cell_type": "code",
|
| 1294 |
+
"execution_count": 9,
|
| 1295 |
"id": "05ead97d",
|
| 1296 |
"metadata": {},
|
| 1297 |
"outputs": [
|
| 1298 |
{
|
| 1299 |
+
"ename": "NameError",
|
| 1300 |
+
"evalue": "name 'app' is not defined",
|
| 1301 |
+
"output_type": "error",
|
| 1302 |
+
"traceback": [
|
| 1303 |
+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
| 1304 |
+
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
|
| 1305 |
+
"Cell \u001b[0;32mIn[9], line 7\u001b[0m\n\u001b[1;32m 5\u001b[0m question \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mWhat evidence do we have of climate change and are human activities responsible for global warming?\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 6\u001b[0m events_list \u001b[38;5;241m=\u001b[39m []\n\u001b[0;32m----> 7\u001b[0m \u001b[38;5;28;01masync\u001b[39;00m \u001b[38;5;28;01mfor\u001b[39;00m event \u001b[38;5;129;01min\u001b[39;00m \u001b[43mapp\u001b[49m\u001b[38;5;241m.\u001b[39mastream_events({\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124muser_input\u001b[39m\u001b[38;5;124m\"\u001b[39m: question,\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124msources\u001b[39m\u001b[38;5;124m\"\u001b[39m:[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mauto\u001b[39m\u001b[38;5;124m\"\u001b[39m], \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124maudience\u001b[39m\u001b[38;5;124m\"\u001b[39m : \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mexpert\u001b[39m\u001b[38;5;124m'\u001b[39m}, version\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mv1\u001b[39m\u001b[38;5;124m\"\u001b[39m):\n\u001b[1;32m 8\u001b[0m events_list\u001b[38;5;241m.\u001b[39mappend(event)\n\u001b[1;32m 10\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m event[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mevent\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mon_chat_model_stream\u001b[39m\u001b[38;5;124m\"\u001b[39m:\n",
|
| 1306 |
+
"\u001b[0;31mNameError\u001b[0m: name 'app' is not defined"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1307 |
]
|
| 1308 |
}
|
| 1309 |
],
|
sandbox/20240702 - CQA - Graph Functionality.ipynb
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|