pull/53/head
Kye 1 year ago
parent 6c732f4603
commit 21b0bf0e61

@ -108,13 +108,16 @@ class WorkerNodeInitializer:
logging.error(f"While running the agent: {str(e)}") logging.error(f"While running the agent: {str(e)}")
raise e raise e
#####################
class WorkerNode: class WorkerNode:
def __init__(self, def __init__(self,
openai_api_key: str, openai_api_key: str,
temperature: Optional[int] = None, temperature: Optional[int] = None,
llm: Optional[Union[InMemoryDocstore, ChatOpenAI]] = None, llm: Optional[Union[InMemoryDocstore, ChatOpenAI]] = None,
tools: Optional[List[Tool]] = None, tools: Optional[List[Tool]] = None,
embedding_size: Optional[int] = 8192, # Default value set as 8192 from WorkerNodeInitializer embedding_size: Optional[int] = 8192,
worker_name: Optional[str] = "Swarm Worker AI Assistant", worker_name: Optional[str] = "Swarm Worker AI Assistant",
worker_role: Optional[str] = "Assistant", worker_role: Optional[str] = "Assistant",
human_in_the_loop: Optional[bool] = False, human_in_the_loop: Optional[bool] = False,
@ -135,8 +138,6 @@ class WorkerNode:
self.search_kwargs = search_kwargs self.search_kwargs = search_kwargs
self.verbose = verbose self.verbose = verbose
self.chat_history_file = chat_history_file self.chat_history_file = chat_history_file
# Properties from WorkerNode
self.temperature = temperature self.temperature = temperature
self.description = "A worker node that executes tasks" self.description = "A worker node that executes tasks"
self.create_agent() self.create_agent()
@ -214,7 +215,7 @@ class WorkerNode:
raise ValueError("llm_class cannot be none") raise ValueError("llm_class cannot be none")
try: try:
logging.info('Creating WorkerNode') logging.info('Creating WorkerNode')
llm = self.initialize_llm(llm_class, self.temperature) # Passed self.temperature llm = self.initialize_llm(llm_class, self.temperature)
tools = [ tools = [
web_search, web_search,

Loading…
Cancel
Save