diff --git a/swarms/swarms.py b/swarms/swarms.py index 15da612a..753b8f40 100644 --- a/swarms/swarms.py +++ b/swarms/swarms.py @@ -70,7 +70,7 @@ class HierarchicalSwarm: - def initialize_llm(self, llm_class): + def initialize_llm(self, llm_class, temperature=0.5): """ Init LLM @@ -80,10 +80,14 @@ class HierarchicalSwarm: """ try: # Initialize language model - self.llm = llm_class(openai_api_key=self.openai_api_key, temperature=self.temperature) + if self.llm_class == OpenAI: + return llm_class(openai_api_key=self.openai_api_key, temperature=self.temperature) + else: + return self.llm_class(model_id="gpt-2", temperature=self.temperature) except Exception as e: logging.error(f"Failed to initialize language model: {e}") + def initialize_tools(self, llm_class, extra_tools=None): """ Init tools