MallikarjunSonna commited on
Commit
31f8d29
·
verified ·
1 Parent(s): 07d41e2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -1
app.py CHANGED
@@ -66,7 +66,21 @@ def convert_currency(amount: float, from_currency: str, to_currency: str) -> str
66
  return f"{amount} {from_currency} is equal to {converted_amount} {to_currency}."
67
  except Exception as e:
68
  return f"Error fetching exchange rates: {str(e)}"
69
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  # Load Hugging Face Text-to-Image Tool
71
  image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
72
 
@@ -94,6 +108,7 @@ agent = CodeAgent(
94
  get_weather,
95
  convert_currency,
96
  DuckDuckGoSearchTool(),
 
97
  image_generation_tool,
98
  ],
99
  max_steps=6,
 
66
  return f"{amount} {from_currency} is equal to {converted_amount} {to_currency}."
67
  except Exception as e:
68
  return f"Error fetching exchange rates: {str(e)}"
69
+ @tool
70
+ def interaction_tool(user_input: str) -> str:
71
+ """A tool that allows the agent to respond to basic user interactions.
72
+ Args:
73
+ user_input: The user's message.
74
+ """
75
+ responses = {
76
+ "hi": "Hello! I'm an AI Agent here to assist you.",
77
+ "hello": "Hey there! How can I help?",
78
+ "how are you": "I'm just a virtual agent, but I'm always ready to assist!",
79
+ "what can you do": "I can generate images, search the web, check time zones, and much more!",
80
+ "what are you doing": "I'm here, waiting for your instructions to assist you."
81
+ }
82
+ return responses.get(user_input.lower(), "I'm not sure, but I'm here to help!")
83
+
84
  # Load Hugging Face Text-to-Image Tool
85
  image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
86
 
 
108
  get_weather,
109
  convert_currency,
110
  DuckDuckGoSearchTool(),
111
+ Interaction_tool,
112
  image_generation_tool,
113
  ],
114
  max_steps=6,