|
|
|
@ -32,13 +32,16 @@ class Worker:
|
|
|
|
|
ai_role="Worker in a swarm",
|
|
|
|
|
external_tools = None,
|
|
|
|
|
human_in_the_loop=False,
|
|
|
|
|
temperature=0.5
|
|
|
|
|
temperature=0.5,
|
|
|
|
|
llm=None,
|
|
|
|
|
openai: bool = True,
|
|
|
|
|
):
|
|
|
|
|
self.openai_api_key = openai_api_key
|
|
|
|
|
self.temperature = temperature
|
|
|
|
|
self.human_in_the_loop = human_in_the_loop
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if self.openai is True:
|
|
|
|
|
try:
|
|
|
|
|
self.llm = ChatOpenAI(
|
|
|
|
|
model_name=model_name,
|
|
|
|
@ -47,6 +50,11 @@ class Worker:
|
|
|
|
|
)
|
|
|
|
|
except Exception as error:
|
|
|
|
|
raise RuntimeError(f"Error Initializing ChatOpenAI: {error}")
|
|
|
|
|
else:
|
|
|
|
|
self.llm = llm(
|
|
|
|
|
model_name=model_name,
|
|
|
|
|
temperature=self.temperature
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
self.ai_name = ai_name
|
|
|
|
|
self.ai_role = ai_role
|
|
|
|
|