Spaces:
Sleeping
Sleeping
update
Browse files- agent.py +5 -3
- app.py +2 -2
- app_playground.ipynb +0 -0
agent.py
CHANGED
|
@@ -27,7 +27,7 @@ class State(TypedDict):
|
|
| 27 |
|
| 28 |
def get_llm():
|
| 29 |
os.getenv("GROQ_API_KEY")
|
| 30 |
-
#
|
| 31 |
|
| 32 |
return init_chat_model("gemini-2.0-flash", model_provider="google_genai")
|
| 33 |
|
|
@@ -143,7 +143,8 @@ def get_graph(llm):
|
|
| 143 |
"""
|
| 144 |
print("\n-------------------- Tool (Tavily) has been called --------------------\n")
|
| 145 |
print("The query is: ", query)
|
| 146 |
-
docs = tavily_retriever.invoke(query)
|
|
|
|
| 147 |
serialized = "\n\n".join(
|
| 148 |
(f"\nContent:\n{doc.page_content}")
|
| 149 |
for doc in docs
|
|
@@ -157,10 +158,11 @@ def get_graph(llm):
|
|
| 157 |
|
| 158 |
Args:
|
| 159 |
query: The search query."""
|
|
|
|
| 160 |
search_docs = TavilySearchResults(max_results=3).invoke({'query': query})
|
| 161 |
formatted_search_docs = "\n\n---\n\n".join(
|
| 162 |
[
|
| 163 |
-
f'
|
| 164 |
for doc in search_docs
|
| 165 |
])
|
| 166 |
return {"web_results": formatted_search_docs}
|
|
|
|
| 27 |
|
| 28 |
def get_llm():
|
| 29 |
os.getenv("GROQ_API_KEY")
|
| 30 |
+
#return init_chat_model("llama-3.3-70b-versatile", model_provider="groq")
|
| 31 |
|
| 32 |
return init_chat_model("gemini-2.0-flash", model_provider="google_genai")
|
| 33 |
|
|
|
|
| 143 |
"""
|
| 144 |
print("\n-------------------- Tool (Tavily) has been called --------------------\n")
|
| 145 |
print("The query is: ", query)
|
| 146 |
+
# docs = tavily_retriever.invoke(query)
|
| 147 |
+
docs = TavilySearchResults(max_results=3).invoke({'query': query})
|
| 148 |
serialized = "\n\n".join(
|
| 149 |
(f"\nContent:\n{doc.page_content}")
|
| 150 |
for doc in docs
|
|
|
|
| 158 |
|
| 159 |
Args:
|
| 160 |
query: The search query."""
|
| 161 |
+
print("\n-------------------- Tool (Tavily) has been called --------------------\n")
|
| 162 |
search_docs = TavilySearchResults(max_results=3).invoke({'query': query})
|
| 163 |
formatted_search_docs = "\n\n---\n\n".join(
|
| 164 |
[
|
| 165 |
+
f'URL: {doc["url"]}\nTitle= {doc["title"]}\nContent: {doc["content"]}'
|
| 166 |
for doc in search_docs
|
| 167 |
])
|
| 168 |
return {"web_results": formatted_search_docs}
|
app.py
CHANGED
|
@@ -126,8 +126,8 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 126 |
answers_payload = []
|
| 127 |
print(f"Running agent on {len(questions_data)} questions...")
|
| 128 |
for item in questions_data:
|
| 129 |
-
print("Waiting for
|
| 130 |
-
time.sleep(
|
| 131 |
task_id = item.get("task_id")
|
| 132 |
question_text = item.get("question")
|
| 133 |
content_type = None
|
|
|
|
| 126 |
answers_payload = []
|
| 127 |
print(f"Running agent on {len(questions_data)} questions...")
|
| 128 |
for item in questions_data:
|
| 129 |
+
print("Waiting for 12 seconds...")
|
| 130 |
+
time.sleep(12)
|
| 131 |
task_id = item.get("task_id")
|
| 132 |
question_text = item.get("question")
|
| 133 |
content_type = None
|
app_playground.ipynb
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|