[CODE FORMATTING]

pull/704/head
Kye Gomez 2 weeks ago
parent b53cd15c24
commit da3f12905d

@ -1,4 +1,3 @@
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
from swarm_models import OpenAIChat from swarm_models import OpenAIChat

@ -17,7 +17,7 @@ from swarms.structs.groupchat import (
ChatHistory, ChatHistory,
ChatTurn, ChatTurn,
AgentResponse, AgentResponse,
expertise_based expertise_based,
) )
from swarms.structs.majority_voting import ( from swarms.structs.majority_voting import (
MajorityVoting, MajorityVoting,

@ -24,6 +24,7 @@ uuid_hex = uuid.uuid4().hex
formatted_time = datetime.datetime.now().strftime("%Y-%m-%dT%H-%M-%S") formatted_time = datetime.datetime.now().strftime("%Y-%m-%dT%H-%M-%S")
# --------------- NEW CHANGE END --------------- # --------------- NEW CHANGE END ---------------
class AgentOutput(BaseModel): class AgentOutput(BaseModel):
agent_name: str agent_name: str
task: str task: str

@ -45,15 +45,15 @@ class OpenAIFunctionCaller:
self.base_model = base_model self.base_model = base_model
self.max_tokens = max_tokens self.max_tokens = max_tokens
try: try:
from openai import OpenAI from openai import OpenAI
except ImportError: except ImportError:
logger.error("OpenAI library not found. Please install the OpenAI library by running 'pip install openai'") logger.error(
"OpenAI library not found. Please install the OpenAI library by running 'pip install openai'"
)
subprocess.run(["pip", "install", "openai"]) subprocess.run(["pip", "install", "openai"])
from openai import OpenAI from openai import OpenAI
self.client = OpenAI(api_key=api_key) self.client = OpenAI(api_key=api_key)
def run(self, task: str, *args, **kwargs) -> BaseModel: def run(self, task: str, *args, **kwargs) -> BaseModel:

Loading…
Cancel
Save