Spaces:
Sleeping
Sleeping
fix(update_requirements): Update requirements
Browse files
src/graph/__pycache__/state_vector_nodes.cpython-312.pyc
CHANGED
|
Binary files a/src/graph/__pycache__/state_vector_nodes.cpython-312.pyc and b/src/graph/__pycache__/state_vector_nodes.cpython-312.pyc differ
|
|
|
src/graph/state_vector_nodes.py
CHANGED
|
@@ -15,7 +15,7 @@ from langchain_community.utilities.semanticscholar import SemanticScholarAPIWrap
|
|
| 15 |
from langchain_community.tools.tavily_search import TavilySearchResults
|
| 16 |
import pandas as pd
|
| 17 |
import torch.nn.functional as F
|
| 18 |
-
|
| 19 |
torch.classes.__path__ = []
|
| 20 |
class question_model:
|
| 21 |
def __init__(self,loaded_tokenizer,loaded_model, llm, df_keys):
|
|
@@ -113,7 +113,7 @@ class question_model:
|
|
| 113 |
return state
|
| 114 |
|
| 115 |
class research_model:
|
| 116 |
-
def __init__(self,llm):
|
| 117 |
self.llm=llm
|
| 118 |
self.local_analysis_file='src/graph/data_analyst_prompts.csv'
|
| 119 |
self.tool_names=["direct_semantic_scholar_query", "direct_tavily_search" ]
|
|
@@ -123,6 +123,7 @@ class research_model:
|
|
| 123 |
self.tools=[semantic_scholar_tool,self.direct_tavily_search]
|
| 124 |
# Bind the tool to the LLM
|
| 125 |
self.llm_with_tools = self.llm.bind_tools(self.tools)
|
|
|
|
| 126 |
#self.tavily_api_key=tavily_api_key
|
| 127 |
|
| 128 |
def direct_semantic_scholar_query(self,query: str):
|
|
|
|
| 15 |
from langchain_community.tools.tavily_search import TavilySearchResults
|
| 16 |
import pandas as pd
|
| 17 |
import torch.nn.functional as F
|
| 18 |
+
import os
|
| 19 |
torch.classes.__path__ = []
|
| 20 |
class question_model:
|
| 21 |
def __init__(self,loaded_tokenizer,loaded_model, llm, df_keys):
|
|
|
|
| 113 |
return state
|
| 114 |
|
| 115 |
class research_model:
|
| 116 |
+
def __init__(self,llm,tavily_api_key):
|
| 117 |
self.llm=llm
|
| 118 |
self.local_analysis_file='src/graph/data_analyst_prompts.csv'
|
| 119 |
self.tool_names=["direct_semantic_scholar_query", "direct_tavily_search" ]
|
|
|
|
| 123 |
self.tools=[semantic_scholar_tool,self.direct_tavily_search]
|
| 124 |
# Bind the tool to the LLM
|
| 125 |
self.llm_with_tools = self.llm.bind_tools(self.tools)
|
| 126 |
+
os.environ['TAVILY_API_KEY']=tavily_api_key
|
| 127 |
#self.tavily_api_key=tavily_api_key
|
| 128 |
|
| 129 |
def direct_semantic_scholar_query(self,query: str):
|
src/streamlit_app.py
CHANGED
|
@@ -77,6 +77,8 @@ class LoadStreamlitUI:
|
|
| 77 |
st.warning("⚠️ Please enter a Gemini or Open AI ChatGPT API key to proceed. Don't have? refer : https://platform.openai.com/api-keys or https://aistudio.google.com/welcome?gclsrc=aw.ds&gad_source=1&gad_campaignid=21521909442 ")
|
| 78 |
self.user_controls["selected_usecase"]=st.selectbox("Select Usecases",usecase_options)
|
| 79 |
self.user_controls['UN SDG Country']= st.selectbox("Choose a country (start typing to search):",options=[""] + self.unsdg_countries)
|
|
|
|
|
|
|
| 80 |
return self.user_controls
|
| 81 |
def display_result_on_ui( state_graph,mode="Question Refining Mode:"):
|
| 82 |
if mode =="Question Refining Mode:":
|
|
@@ -133,7 +135,7 @@ if __name__=='__main__':
|
|
| 133 |
loaded_tokenizer=loaded_tokenizer,
|
| 134 |
loaded_model=loaded_model, llm=llm, df_keys=df_keys)
|
| 135 |
builder=BuildGraphOptions(SmartQuestions)
|
| 136 |
-
ResearchModel=research_model(llm=SmartQuestions.genai_model)
|
| 137 |
graph=builder.build_research_graph(ResearchModel)
|
| 138 |
with st.chat_message("assistant"):
|
| 139 |
intro="Hello, I am an assistant designed to help you learn about the 17 UN SDG goals listed here: https://sdgs.un.org/goals.\
|
|
|
|
| 77 |
st.warning("⚠️ Please enter a Gemini or Open AI ChatGPT API key to proceed. Don't have? refer : https://platform.openai.com/api-keys or https://aistudio.google.com/welcome?gclsrc=aw.ds&gad_source=1&gad_campaignid=21521909442 ")
|
| 78 |
self.user_controls["selected_usecase"]=st.selectbox("Select Usecases",usecase_options)
|
| 79 |
self.user_controls['UN SDG Country']= st.selectbox("Choose a country (start typing to search):",options=[""] + self.unsdg_countries)
|
| 80 |
+
if self.user_controls['selected_usecase']=='DeepRishSearch':
|
| 81 |
+
self.user_controls["TAVILY_API_KEY"] = st.session_state["TAVILY_API_KEY"]=st.text_input("Tavily API Key",type="password")
|
| 82 |
return self.user_controls
|
| 83 |
def display_result_on_ui( state_graph,mode="Question Refining Mode:"):
|
| 84 |
if mode =="Question Refining Mode:":
|
|
|
|
| 135 |
loaded_tokenizer=loaded_tokenizer,
|
| 136 |
loaded_model=loaded_model, llm=llm, df_keys=df_keys)
|
| 137 |
builder=BuildGraphOptions(SmartQuestions)
|
| 138 |
+
ResearchModel=research_model(llm=SmartQuestions.genai_model, tavily_api_key=user_input['TAVILY_API_KEY'])
|
| 139 |
graph=builder.build_research_graph(ResearchModel)
|
| 140 |
with st.chat_message("assistant"):
|
| 141 |
intro="Hello, I am an assistant designed to help you learn about the 17 UN SDG goals listed here: https://sdgs.un.org/goals.\
|