Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -38,14 +38,35 @@ wikipedia_tool = WikipediaSearcher()
|
|
| 38 |
tools = [audio_tool, image_tool, wikipedia_tool]
|
| 39 |
|
| 40 |
# Define the custom agent using Dolphin model (free Mixtral)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
class MyAgent(CodeAgent):
|
| 42 |
def __init__(self):
|
| 43 |
model = HfApiModel(
|
| 44 |
model="cognitivecomputations/dolphin-2.6-mixtral-8x7b",
|
| 45 |
api_key=os.getenv("HF_API_TOKEN", "").strip(),
|
| 46 |
-
system_prompt=SYSTEM_PROMPT
|
| 47 |
)
|
| 48 |
super().__init__(model=model, tools=tools)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
# Evaluation + Submission function
|
| 51 |
def run_and_submit_all(profile: gr.OAuthProfile | None):
|
|
|
|
| 38 |
tools = [audio_tool, image_tool, wikipedia_tool]
|
| 39 |
|
| 40 |
# Define the custom agent using Dolphin model (free Mixtral)
|
| 41 |
+
#class MyAgent(CodeAgent):
|
| 42 |
+
# def __init__(self):
|
| 43 |
+
# model = HfApiModel(
|
| 44 |
+
# model="cognitivecomputations/dolphin-2.6-mixtral-8x7b",
|
| 45 |
+
# api_key=os.getenv("HF_API_TOKEN", "").strip(),
|
| 46 |
+
# system_prompt=SYSTEM_PROMPT
|
| 47 |
+
# )
|
| 48 |
+
# super().__init__(model=model, tools=tools)
|
| 49 |
+
|
| 50 |
+
|
| 51 |
class MyAgent(CodeAgent):
|
| 52 |
def __init__(self):
|
| 53 |
model = HfApiModel(
|
| 54 |
model="cognitivecomputations/dolphin-2.6-mixtral-8x7b",
|
| 55 |
api_key=os.getenv("HF_API_TOKEN", "").strip(),
|
|
|
|
| 56 |
)
|
| 57 |
super().__init__(model=model, tools=tools)
|
| 58 |
+
self.system_prompt = SYSTEM_PROMPT
|
| 59 |
+
|
| 60 |
+
def __call__(self, task):
|
| 61 |
+
# Inject the system prompt manually
|
| 62 |
+
if isinstance(task, dict) and "question" in task:
|
| 63 |
+
task["messages"] = [
|
| 64 |
+
{"role": "system", "content": self.system_prompt},
|
| 65 |
+
{"role": "user", "content": task["question"]}
|
| 66 |
+
]
|
| 67 |
+
return super().__call__(task)
|
| 68 |
+
|
| 69 |
+
|
| 70 |
|
| 71 |
# Evaluation + Submission function
|
| 72 |
def run_and_submit_all(profile: gr.OAuthProfile | None):
|