-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathagents.py
36 lines (32 loc) · 1.27 KB
/
agents.py
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
35
36
from crewai import Agent
from textwrap import dedent
from langchain.llms import OpenAI, Ollama
from langchain_openai import ChatOpenAI
# This is an example of how to define custom agents.
# You can define as many agents as you want.
# You can also define custom tasks in tasks.py
class CustomAgents:
def __init__(self):
self.OpenAIGPT35 = ChatOpenAI(model_name="gpt-3.5-turbo", temperature=0.7)
self.OpenAIGPT4 = ChatOpenAI(model_name="gpt-4", temperature=0.7)
self.Ollama = Ollama(model="openhermes")
def agent_1_name(self):
return Agent(
role="Define agent 1 role here",
backstory=dedent(f"""Define agent 1 backstory here"""),
goal=dedent(f"""Define agent 1 goal here"""),
# tools=[tool_1, tool_2],
allow_delegation=False,
verbose=True,
llm=self.OpenAIGPT35,
)
def agent_2_name(self):
return Agent(
role="Define agent 2 role here",
backstory=dedent(f"""Define agent 2 backstory here"""),
goal=dedent(f"""Define agent 2 goal here"""),
# tools=[tool_1, tool_2],
allow_delegation=False,
verbose=True,
llm=self.OpenAIGPT35,
)