Commit
·
90079bd
1
Parent(s):
ca345fd
new models and search
Browse files- __pycache__/agent.cpython-310.pyc +0 -0
- agent.py +6 -3
- f918266a-b3e0-4914-865d-4faa564f1aef.py +0 -35
__pycache__/agent.cpython-310.pyc
CHANGED
Binary files a/__pycache__/agent.cpython-310.pyc and b/__pycache__/agent.cpython-310.pyc differ
|
|
agent.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
from smolagents import CodeAgent, LiteLLMModel,
|
2 |
import os
|
3 |
import json
|
4 |
import requests
|
@@ -159,10 +159,13 @@ def final_answer_formatting(answer, question):
|
|
159 |
|
160 |
|
161 |
web_agent = CodeAgent(
|
162 |
-
model=
|
|
|
|
|
|
|
163 |
tools=[
|
164 |
WikipediaSearchTool(),
|
165 |
-
|
166 |
VisitWebpageTool()
|
167 |
],
|
168 |
add_base_tools=False,
|
|
|
1 |
+
from smolagents import CodeAgent, LiteLLMModel, GoogleSearchTool, WikipediaSearchTool, Tool, VisitWebpageTool, HfApiModel
|
2 |
import os
|
3 |
import json
|
4 |
import requests
|
|
|
159 |
|
160 |
|
161 |
web_agent = CodeAgent(
|
162 |
+
model=LiteLLMModel(
|
163 |
+
model="mistral/mistral-large-latest",
|
164 |
+
api_key=os.getenv("MISTRAL_API_KEY"),
|
165 |
+
),
|
166 |
tools=[
|
167 |
WikipediaSearchTool(),
|
168 |
+
GoogleSearchTool(provider="serpapi"),
|
169 |
VisitWebpageTool()
|
170 |
],
|
171 |
add_base_tools=False,
|
f918266a-b3e0-4914-865d-4faa564f1aef.py
DELETED
@@ -1,35 +0,0 @@
|
|
1 |
-
from random import randint
|
2 |
-
import time
|
3 |
-
|
4 |
-
class UhOh(Exception):
|
5 |
-
pass
|
6 |
-
|
7 |
-
class Hmm:
|
8 |
-
def __init__(self):
|
9 |
-
self.value = randint(-100, 100)
|
10 |
-
|
11 |
-
def Yeah(self):
|
12 |
-
if self.value == 0:
|
13 |
-
return True
|
14 |
-
else:
|
15 |
-
raise UhOh()
|
16 |
-
|
17 |
-
def Okay():
|
18 |
-
while True:
|
19 |
-
yield Hmm()
|
20 |
-
|
21 |
-
def keep_trying(go, first_try=True):
|
22 |
-
maybe = next(go)
|
23 |
-
try:
|
24 |
-
if maybe.Yeah():
|
25 |
-
return maybe.value
|
26 |
-
except UhOh:
|
27 |
-
if first_try:
|
28 |
-
print("Working...")
|
29 |
-
print("Please wait patiently...")
|
30 |
-
time.sleep(0.1)
|
31 |
-
return keep_trying(go, first_try=False)
|
32 |
-
|
33 |
-
if __name__ == "__main__":
|
34 |
-
go = Okay()
|
35 |
-
print(f"{keep_trying(go)}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|