Spaces:
Runtime error
Runtime error
serpapi_Google_Search_tool
Browse files
app.py
CHANGED
|
@@ -22,7 +22,7 @@ from langchain_openai import ChatOpenAI
|
|
| 22 |
from openai import OpenAI
|
| 23 |
|
| 24 |
# tools imported from helper.py
|
| 25 |
-
from helper import repl_tool, get_travily_api_search_tool,audio_transcriber_tool,wikipedia_search_tool,file_saver_tool,wikipedia_full_content_tool
|
| 26 |
|
| 27 |
|
| 28 |
|
|
@@ -146,6 +146,12 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 146 |
|
| 147 |
#llm_client = ChatOpenAI(model='gpt-4o',temperature=0,api_key=openai_api_key)
|
| 148 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 149 |
tavily_api_key = os.getenv("TAVILY_API_KEY")
|
| 150 |
if not tavily_api_key:
|
| 151 |
print("Tavily API key not found in environment variables.")
|
|
@@ -154,7 +160,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 154 |
|
| 155 |
travily_api_search_tool = get_travily_api_search_tool(tavily_api_key)
|
| 156 |
#tools = [travily_api_search_tool, repl_tool, file_saver_tool,audio_transcriber_tool,wikipedia_search_tool,wikipedia_full_content_tool]
|
| 157 |
-
tools = [
|
| 158 |
|
| 159 |
# Pull a predefined prompt from LangChain Hub
|
| 160 |
# "hwchase17/react-chat" is a prompt template designed for ReAct-style conversational agents.
|
|
|
|
| 22 |
from openai import OpenAI
|
| 23 |
|
| 24 |
# tools imported from helper.py
|
| 25 |
+
from helper import repl_tool, get_travily_api_search_tool,audio_transcriber_tool,wikipedia_search_tool,file_saver_tool,wikipedia_full_content_tool,serpapi_Google_Search_tool
|
| 26 |
|
| 27 |
|
| 28 |
|
|
|
|
| 146 |
|
| 147 |
#llm_client = ChatOpenAI(model='gpt-4o',temperature=0,api_key=openai_api_key)
|
| 148 |
|
| 149 |
+
serp_api_key = os.getenv("SERP_API_KEY")
|
| 150 |
+
if not serp_api_key:
|
| 151 |
+
print("SerpAPI key not found in environment variables.")
|
| 152 |
+
return "SerpAPI key not found. Please set SERP_API_KEY environment variable.", None
|
| 153 |
+
print(f"Using SerpAPI key: {serp_api_key[:4]}... (truncated for security)")
|
| 154 |
+
|
| 155 |
tavily_api_key = os.getenv("TAVILY_API_KEY")
|
| 156 |
if not tavily_api_key:
|
| 157 |
print("Tavily API key not found in environment variables.")
|
|
|
|
| 160 |
|
| 161 |
travily_api_search_tool = get_travily_api_search_tool(tavily_api_key)
|
| 162 |
#tools = [travily_api_search_tool, repl_tool, file_saver_tool,audio_transcriber_tool,wikipedia_search_tool,wikipedia_full_content_tool]
|
| 163 |
+
tools = [ repl_tool, file_saver_tool,audio_transcriber_tool,serpapi_Google_Search_tool]
|
| 164 |
|
| 165 |
# Pull a predefined prompt from LangChain Hub
|
| 166 |
# "hwchase17/react-chat" is a prompt template designed for ReAct-style conversational agents.
|