File size: 917 Bytes
cf24ce6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from smolai import SmolAgent
from langchain.chat_models import ChatOpenAI

# Initialize SmolAgents
farmer_agent = SmolAgent(
    name="FarmerAgent",
    description="Handles farmer registrations and crop listings.",
    llm=ChatOpenAI(temperature=0.7)
)

marketplace_agent = SmolAgent(
    name="MarketplaceAgent",
    description="Assists customers in searching for crops and making recommendations.",
    llm=ChatOpenAI(temperature=0.7)
)

health_agent = SmolAgent(
    name="HealthAgent",
    description="Provides health benefits of various crops to customers.",
    llm=ChatOpenAI(temperature=0.7)
)

farming_advisor_agent = SmolAgent(
    name="FarmingAdvisorAgent",
    description="Gives farming tips and advice based on queries.",
    llm=ChatOpenAI(temperature=0.7)
)

# Function to interact with agents
def interact_with_agent(agent, user_input):
    response = agent.chat(user_input)
    return response