Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,13 +1,33 @@
|
|
1 |
-
|
2 |
-
from
|
3 |
-
|
4 |
-
#
|
5 |
-
|
6 |
-
"
|
7 |
-
"
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from smolai import SmolAgent
|
2 |
+
from langchain.chat_models import ChatOpenAI
|
3 |
+
|
4 |
+
# Initialize SmolAgents
|
5 |
+
farmer_agent = SmolAgent(
|
6 |
+
name="FarmerAgent",
|
7 |
+
description="Handles farmer registrations and crop listings.",
|
8 |
+
llm=ChatOpenAI(temperature=0.7)
|
9 |
+
)
|
10 |
+
|
11 |
+
marketplace_agent = SmolAgent(
|
12 |
+
name="MarketplaceAgent",
|
13 |
+
description="Assists customers in searching for crops and making recommendations.",
|
14 |
+
llm=ChatOpenAI(temperature=0.7)
|
15 |
+
)
|
16 |
+
|
17 |
+
health_agent = SmolAgent(
|
18 |
+
name="HealthAgent",
|
19 |
+
description="Provides health benefits of various crops to customers.",
|
20 |
+
llm=ChatOpenAI(temperature=0.7)
|
21 |
+
)
|
22 |
+
|
23 |
+
farming_advisor_agent = SmolAgent(
|
24 |
+
name="FarmingAdvisorAgent",
|
25 |
+
description="Gives farming tips and advice based on queries.",
|
26 |
+
llm=ChatOpenAI(temperature=0.7)
|
27 |
+
)
|
28 |
+
|
29 |
+
# Function to interact with agents
|
30 |
+
def interact_with_agent(agent, user_input):
|
31 |
+
response = agent.chat(user_input)
|
32 |
+
return response
|
33 |
+
|