diff --git a/swarms/agents/models/openai.py b/swarms/agents/models/openai.py index 71dfd126..6958cd1a 100644 --- a/swarms/agents/models/openai.py +++ b/swarms/agents/models/openai.py @@ -17,6 +17,12 @@ class OpenAI: params=params, save_messages=save_messages) + def __call__(self, message, **kwargs): + try: + return self.ai(message, **kwargs) + except Exception as error: + print(f"Error in OpenAI, {error}") + def generate(self, message, **kwargs): try: return self.ai(message, **kwargs) @@ -30,6 +36,6 @@ class OpenAI: #usage #from swarms import OpenAI() #chat = OpenAI() -#response = chat("Hello World") +#response = chat.generate("Hello World") #print(response)