Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,22 +1,27 @@
|
|
| 1 |
from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
|
| 2 |
import datetime
|
| 3 |
import requests
|
|
|
|
| 4 |
import pytz
|
| 5 |
import yaml
|
| 6 |
-
from tools
|
| 7 |
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
| 12 |
-
def
|
| 13 |
-
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
| 15 |
Args:
|
| 16 |
-
|
| 17 |
-
arg2: the second argument
|
| 18 |
"""
|
| 19 |
-
|
|
|
|
|
|
|
| 20 |
|
| 21 |
@tool
|
| 22 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
@@ -34,7 +39,9 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
| 34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 35 |
|
| 36 |
|
| 37 |
-
final_answer = FinalAnswerTool()
|
|
|
|
|
|
|
| 38 |
|
| 39 |
# If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
|
| 40 |
# model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
|
@@ -55,7 +62,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 55 |
|
| 56 |
agent = CodeAgent(
|
| 57 |
model=model,
|
| 58 |
-
tools=[
|
| 59 |
max_steps=6,
|
| 60 |
verbosity_level=1,
|
| 61 |
grammar=None,
|
|
|
|
| 1 |
from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
|
| 2 |
import datetime
|
| 3 |
import requests
|
| 4 |
+
from gitingest import ingest
|
| 5 |
import pytz
|
| 6 |
import yaml
|
| 7 |
+
from tools import final_answer, visit_webpage
|
| 8 |
|
| 9 |
from Gradio_UI import GradioUI
|
| 10 |
|
| 11 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 12 |
@tool
|
| 13 |
+
def ingest_repository(git_dir_path: str)-> tuple[str, str, str]:
|
| 14 |
+
"""A tool that takes the url of a github directory and ingests the whole codebase
|
| 15 |
+
into a text dump of their contents
|
| 16 |
+
The output is a tuple containing a short summary with statistics of the dump,
|
| 17 |
+
the repository tree andthe actual text dump of the repository content.
|
| 18 |
+
|
| 19 |
Args:
|
| 20 |
+
git_dir_path: the url containing the path of the github repository
|
|
|
|
| 21 |
"""
|
| 22 |
+
|
| 23 |
+
summary, tree, content = ingest(git_dir_path)
|
| 24 |
+
return (summary, tree, content)
|
| 25 |
|
| 26 |
@tool
|
| 27 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 39 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 40 |
|
| 41 |
|
| 42 |
+
final_answer = final_answer.FinalAnswerTool()
|
| 43 |
+
visit_webpage = visit_webpage.VisitWebpageTool()
|
| 44 |
+
web_search = DuckDuckGoSearchTool()
|
| 45 |
|
| 46 |
# If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
|
| 47 |
# model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
|
|
|
| 62 |
|
| 63 |
agent = CodeAgent(
|
| 64 |
model=model,
|
| 65 |
+
tools=[ingest_repository, final_answer], ## add your tools here (don't remove final answer)
|
| 66 |
max_steps=6,
|
| 67 |
verbosity_level=1,
|
| 68 |
grammar=None,
|