agent.py
CHANGED
|
@@ -112,6 +112,24 @@ class BoomBot:
|
|
| 112 |
max_tokens=8192,
|
| 113 |
temperature=0.7,
|
| 114 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 115 |
elif self.provider == "groq":
|
| 116 |
# Default to use groq's claude-3-opus or llama-3
|
| 117 |
model_id = "claude-3-opus-20240229"
|
|
@@ -130,7 +148,7 @@ class BoomBot:
|
|
| 130 |
download_file = DownloadFileFromLinkTool()
|
| 131 |
read_file_content = ReadFileContentTool()
|
| 132 |
visit_webpage = VisitWebpageTool()
|
| 133 |
-
transcribe_video = TranscibeVideoFileTool()
|
| 134 |
transcribe_audio = TranscribeAudioTool()
|
| 135 |
get_wikipedia_info = WikipediaSearchTool()
|
| 136 |
web_searcher = DuckDuckGoSearchTool()
|
|
@@ -197,7 +215,7 @@ class BoomBot:
|
|
| 197 |
# Create the agent
|
| 198 |
agent = CodeAgent(
|
| 199 |
tools=agent_tools,
|
| 200 |
-
max_steps=
|
| 201 |
model=self.model,
|
| 202 |
add_base_tools=False,
|
| 203 |
stream_outputs=True,
|
|
@@ -233,7 +251,7 @@ class BoomBot:
|
|
| 233 |
- If the content is long, complex, spans multiple pages, or may be needed later, do NOT rely solely on visit_webpage.
|
| 234 |
- Move quickly to downloading: avoid repeated visits when the content should be archived.
|
| 235 |
|
| 236 |
-
3. DOWNLOAD (MANDATORY IF CONTENT IS LONG, DENSE, OR
|
| 237 |
- Use download_file_from_link on all valuable resources (including html pages or pdfs).
|
| 238 |
- Especially when a page is detailed, technical, or multi-part, downloading is preferred.
|
| 239 |
- You can (and should) download webpages as HTML. Do this whenever the site might be referenced again later.
|
|
@@ -342,7 +360,7 @@ if __name__ == "__main__":
|
|
| 342 |
for row in rows:
|
| 343 |
writer.writerow(row)
|
| 344 |
|
| 345 |
-
agent = BoomBot(provider="
|
| 346 |
model_name = agent.provider # e.g. "gemma"
|
| 347 |
|
| 348 |
file_online = load_online_qas(file_path=r"../../Final_Assignment_Template/allqas.jsonl", has_file=True)
|
|
|
|
| 112 |
max_tokens=8192,
|
| 113 |
temperature=0.7,
|
| 114 |
)
|
| 115 |
+
elif self.provider == "google":
|
| 116 |
+
meta_model = "google/gemini-2.5-flash"
|
| 117 |
+
# return OpenAIServerModel(
|
| 118 |
+
# model_id=meta_model,
|
| 119 |
+
# api_base="https://api.deepinfra.com/v1/openai",
|
| 120 |
+
# api_key=os.getenv("DEEPINFRA_API_KEY"),
|
| 121 |
+
# flatten_messages_as_text=True,
|
| 122 |
+
# max_tokens=8192,
|
| 123 |
+
# temperature=0.7,
|
| 124 |
+
# )
|
| 125 |
+
return LiteLLMModel(
|
| 126 |
+
model_id="deepinfra/"+ meta_model,
|
| 127 |
+
api_base="https://api.deepinfra.com/v1/openai",
|
| 128 |
+
api_key=os.getenv("DEEPINFRA_API_KEY"),
|
| 129 |
+
flatten_messages_as_text=True,
|
| 130 |
+
max_tokens=8192,
|
| 131 |
+
temperature=0.7,
|
| 132 |
+
)
|
| 133 |
elif self.provider == "groq":
|
| 134 |
# Default to use groq's claude-3-opus or llama-3
|
| 135 |
model_id = "claude-3-opus-20240229"
|
|
|
|
| 148 |
download_file = DownloadFileFromLinkTool()
|
| 149 |
read_file_content = ReadFileContentTool()
|
| 150 |
visit_webpage = VisitWebpageTool()
|
| 151 |
+
# transcribe_video = TranscibeVideoFileTool()
|
| 152 |
transcribe_audio = TranscribeAudioTool()
|
| 153 |
get_wikipedia_info = WikipediaSearchTool()
|
| 154 |
web_searcher = DuckDuckGoSearchTool()
|
|
|
|
| 215 |
# Create the agent
|
| 216 |
agent = CodeAgent(
|
| 217 |
tools=agent_tools,
|
| 218 |
+
max_steps=15,
|
| 219 |
model=self.model,
|
| 220 |
add_base_tools=False,
|
| 221 |
stream_outputs=True,
|
|
|
|
| 251 |
- If the content is long, complex, spans multiple pages, or may be needed later, do NOT rely solely on visit_webpage.
|
| 252 |
- Move quickly to downloading: avoid repeated visits when the content should be archived.
|
| 253 |
|
| 254 |
+
3. DOWNLOAD AND ADD TO VECTORSTORE (MANDATORY IF CONTENT IS LONG, DENSE, COMPLEX, MULTIPLE FILES OR LINKS TO VISIT)
|
| 255 |
- Use download_file_from_link on all valuable resources (including html pages or pdfs).
|
| 256 |
- Especially when a page is detailed, technical, or multi-part, downloading is preferred.
|
| 257 |
- You can (and should) download webpages as HTML. Do this whenever the site might be referenced again later.
|
|
|
|
| 360 |
for row in rows:
|
| 361 |
writer.writerow(row)
|
| 362 |
|
| 363 |
+
agent = BoomBot(provider="deepinfra")
|
| 364 |
model_name = agent.provider # e.g. "gemma"
|
| 365 |
|
| 366 |
file_online = load_online_qas(file_path=r"../../Final_Assignment_Template/allqas.jsonl", has_file=True)
|
app.py
CHANGED
|
@@ -20,7 +20,7 @@ load_dotenv()
|
|
| 20 |
class BasicAgent:
|
| 21 |
def __init__(self):
|
| 22 |
print("BasicAgent initialized.")
|
| 23 |
-
self.agent = BoomBot(provider="
|
| 24 |
|
| 25 |
def __call__(self, question: str, task_id: str, to_download) -> str:
|
| 26 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
|
|
|
| 20 |
class BasicAgent:
|
| 21 |
def __init__(self):
|
| 22 |
print("BasicAgent initialized.")
|
| 23 |
+
self.agent = BoomBot(provider="google")
|
| 24 |
|
| 25 |
def __call__(self, question: str, task_id: str, to_download) -> str:
|
| 26 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
tools.py
CHANGED
|
@@ -289,7 +289,7 @@ class BraveWebSearchTool(Tool):
|
|
| 289 |
output_type = "string"
|
| 290 |
|
| 291 |
# api_key = os.getenv("BRAVE_SEARCH_API_KEY")
|
| 292 |
-
api_key =
|
| 293 |
count = 3
|
| 294 |
char_limit = 4000 # Adjust based on LLM context window
|
| 295 |
tool = BraveSearch.from_api_key(api_key=api_key, search_kwargs={"count": count})
|
|
|
|
| 289 |
output_type = "string"
|
| 290 |
|
| 291 |
# api_key = os.getenv("BRAVE_SEARCH_API_KEY")
|
| 292 |
+
api_key = "asdasfd"
|
| 293 |
count = 3
|
| 294 |
char_limit = 4000 # Adjust based on LLM context window
|
| 295 |
tool = BraveSearch.from_api_key(api_key=api_key, search_kwargs={"count": count})
|