test change
#96
by
vesjanamimini
- opened
app.py
CHANGED
|
@@ -3,6 +3,9 @@ import gradio as gr
|
|
| 3 |
import requests
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
# (Keep Constants as is)
|
| 8 |
# --- Constants ---
|
|
@@ -10,6 +13,27 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
| 10 |
|
| 11 |
# --- Basic Agent Definition ---
|
| 12 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
class BasicAgent:
|
| 14 |
def __init__(self):
|
| 15 |
print("BasicAgent initialized.")
|
|
|
|
| 3 |
import requests
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
| 6 |
+
from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
|
| 7 |
+
from langchain_openai import ChatOpenAI
|
| 8 |
+
|
| 9 |
|
| 10 |
# (Keep Constants as is)
|
| 11 |
# --- Constants ---
|
|
|
|
| 13 |
|
| 14 |
# --- Basic Agent Definition ---
|
| 15 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
| 16 |
+
|
| 17 |
+
model = ChatOpenAI(temperature=0)
|
| 18 |
+
|
| 19 |
+
from smolagents import DuckDuckGoSearchTool, LiteLLMModel, ToolCallingAgent
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
# Create web agent and manager agent structure
|
| 23 |
+
web_agent = ToolCallingAgent(
|
| 24 |
+
tools=[DuckDuckGoSearchTool()], # Add required tools
|
| 25 |
+
model=model, # Add model
|
| 26 |
+
max_steps=5, # Adjust steps
|
| 27 |
+
name="My browser", # Add name
|
| 28 |
+
description="Searching is easy" # Add description
|
| 29 |
+
)
|
| 30 |
+
|
| 31 |
+
query = "What are the latest updates on Mars exploration?"
|
| 32 |
+
response = web_agent.run(query)
|
| 33 |
+
print(response)
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
|
| 37 |
class BasicAgent:
|
| 38 |
def __init__(self):
|
| 39 |
print("BasicAgent initialized.")
|