From 6186e9251062bc711eafd133ce274704cb3183a8 Mon Sep 17 00:00:00 2001 From: Siraj R Aizlewood <siraj@aurelio.ai> Date: Tue, 30 Apr 2024 01:59:01 +0400 Subject: [PATCH] Linting. --- semantic_router/llms/openai.py | 10 +++------- semantic_router/route.py | 1 - 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/semantic_router/llms/openai.py b/semantic_router/llms/openai.py index ee621bc8..dcce3b45 100644 --- a/semantic_router/llms/openai.py +++ b/semantic_router/llms/openai.py @@ -67,12 +67,10 @@ class OpenAILLM(BaseLLM): ) arguments = tool_calls[0].function.arguments if arguments is None: - raise ValueError( - "Invalid output, expected arguments to be specified." - ) + raise ValueError("Invalid output, expected arguments to be specified.") output = str(arguments) # str to keep MyPy happy. return output - + except Exception as e: logger.error(f"LLM error: {e}") raise Exception(f"LLM error: {e}") from e @@ -84,8 +82,6 @@ class OpenAILLM(BaseLLM): system_prompt = "You are an intelligent AI. Given a command or request from the user, call the function to complete the request." messages.append(Message(role="system", content=system_prompt)) messages.append(Message(role="user", content=query)) - function_inputs_str = self( - messages=messages, function_schema=function_schema - ) + function_inputs_str = self(messages=messages, function_schema=function_schema) function_inputs = json.loads(function_inputs_str) return function_inputs diff --git a/semantic_router/route.py b/semantic_router/route.py index 01901ff9..40f8453f 100644 --- a/semantic_router/route.py +++ b/semantic_router/route.py @@ -8,7 +8,6 @@ from semantic_router.llms import BaseLLM from semantic_router.schema import Message, RouteChoice from semantic_router.utils import function_call from semantic_router.utils.logger import logger -from semantic_router.llms import OpenAILLM try: from PIL.Image import Image -- GitLab