Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import os
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
import requests
|
| 4 |
import inspect
|
|
@@ -30,7 +31,7 @@ class BasicAgent:
|
|
| 30 |
print("BasicAgent initialized.")
|
| 31 |
sambanova_api_key = os.getenv("SAMBANOVA_API_KEY")
|
| 32 |
model = OpenAIServerModel(
|
| 33 |
-
model_id="Meta-Llama-3.
|
| 34 |
api_base="https://api.sambanova.ai/v1",
|
| 35 |
api_key=sambanova_api_key,
|
| 36 |
)
|
|
@@ -43,7 +44,7 @@ class BasicAgent:
|
|
| 43 |
self.agent = ToolCallingAgent(
|
| 44 |
tools=tools,
|
| 45 |
model=model,
|
| 46 |
-
max_steps=
|
| 47 |
)
|
| 48 |
|
| 49 |
def __call__(self, question: str) -> str:
|
|
@@ -110,6 +111,8 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
|
|
| 110 |
except Exception as e:
|
| 111 |
print(f"Error running agent on task {task_id}: {e}")
|
| 112 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})
|
|
|
|
|
|
|
| 113 |
|
| 114 |
if not answers_payload:
|
| 115 |
print("Agent did not produce any answers to submit.")
|
|
|
|
| 1 |
import os
|
| 2 |
+
import time
|
| 3 |
import gradio as gr
|
| 4 |
import requests
|
| 5 |
import inspect
|
|
|
|
| 31 |
print("BasicAgent initialized.")
|
| 32 |
sambanova_api_key = os.getenv("SAMBANOVA_API_KEY")
|
| 33 |
model = OpenAIServerModel(
|
| 34 |
+
model_id="Meta-Llama-3.1-8B-Instruct",
|
| 35 |
api_base="https://api.sambanova.ai/v1",
|
| 36 |
api_key=sambanova_api_key,
|
| 37 |
)
|
|
|
|
| 44 |
self.agent = ToolCallingAgent(
|
| 45 |
tools=tools,
|
| 46 |
model=model,
|
| 47 |
+
max_steps=8,
|
| 48 |
)
|
| 49 |
|
| 50 |
def __call__(self, question: str) -> str:
|
|
|
|
| 111 |
except Exception as e:
|
| 112 |
print(f"Error running agent on task {task_id}: {e}")
|
| 113 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})
|
| 114 |
+
# Small pause between questions to avoid rate limits
|
| 115 |
+
time.sleep(2)
|
| 116 |
|
| 117 |
if not answers_payload:
|
| 118 |
print("Agent did not produce any answers to submit.")
|