worker documentation

pull/55/head
Kye 1 year ago
parent ba09edb8df
commit cb640a7983

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

Loading…
Cancel
Save