Spaces:
Sleeping
Sleeping
updated agent flow (#7)
Browse files- updated agent flow (c108dedf55bd68f05a3b1ad600af44f2b5d360ba)
app.py
CHANGED
|
@@ -58,6 +58,22 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
| 58 |
|
| 59 |
final_answer = FinalAnswerTool()
|
| 60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
def agent_flow(user_input): #defining the workflow
|
| 63 |
# 1. Prompt for input
|
|
@@ -76,24 +92,6 @@ def agent_flow(user_input): #defining the workflow
|
|
| 76 |
f"Task outcome (short version): The currency in {timezone} is {currency_info}. The current time in {timezone} is {time_info}."
|
| 77 |
)
|
| 78 |
|
| 79 |
-
|
| 80 |
-
# 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:
|
| 81 |
-
# model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
| 82 |
-
|
| 83 |
-
model = HfApiModel(
|
| 84 |
-
max_tokens=2096,
|
| 85 |
-
temperature=0.5,
|
| 86 |
-
model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
|
| 87 |
-
custom_role_conversions=None,
|
| 88 |
-
)
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
# Import tool from Hub
|
| 92 |
-
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 93 |
-
|
| 94 |
-
with open("prompts.yaml", 'r') as stream:
|
| 95 |
-
prompt_templates = yaml.safe_load(stream)
|
| 96 |
-
|
| 97 |
agent = CodeAgent(
|
| 98 |
model=model,
|
| 99 |
tools=[final_answer], ## add your tools here (don't remove final answer)
|
|
|
|
| 58 |
|
| 59 |
final_answer = FinalAnswerTool()
|
| 60 |
|
| 61 |
+
# 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:
|
| 62 |
+
# model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
| 63 |
+
|
| 64 |
+
model = HfApiModel(
|
| 65 |
+
max_tokens=2096,
|
| 66 |
+
temperature=0.5,
|
| 67 |
+
model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
|
| 68 |
+
custom_role_conversions=None,
|
| 69 |
+
)
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
# Import tool from Hub
|
| 73 |
+
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 74 |
+
|
| 75 |
+
with open("prompts.yaml", 'r') as stream:
|
| 76 |
+
prompt_templates = yaml.safe_load(stream)
|
| 77 |
|
| 78 |
def agent_flow(user_input): #defining the workflow
|
| 79 |
# 1. Prompt for input
|
|
|
|
| 92 |
f"Task outcome (short version): The currency in {timezone} is {currency_info}. The current time in {timezone} is {time_info}."
|
| 93 |
)
|
| 94 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
agent = CodeAgent(
|
| 96 |
model=model,
|
| 97 |
tools=[final_answer], ## add your tools here (don't remove final answer)
|