From 9a9249a243c2c962e50371a99aea60c006bdb2bd Mon Sep 17 00:00:00 2001
From: James Briggs <35938317+jamescalam@users.noreply.github.com>
Date: Thu, 28 Dec 2023 09:54:06 +0100
Subject: [PATCH] fix tests env var and lint

---
 .github/workflows/pr_agent.yml |  2 +-
 semantic_router/utils/llm.py   |  1 +
 tests/unit/test_layer.py       | 11 +++++++++--
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/pr_agent.yml b/.github/workflows/pr_agent.yml
index 4e86dfbc..e9db72d8 100644
--- a/.github/workflows/pr_agent.yml
+++ b/.github/workflows/pr_agent.yml
@@ -14,5 +14,5 @@ jobs:
         id: pragent
         uses: Codium-ai/pr-agent@main
         env:
-          OPENAI_KEY: ${{ secrets.OPENAI_KEY }}
+          OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/semantic_router/utils/llm.py b/semantic_router/utils/llm.py
index 6ce28ff8..e92c1bcf 100644
--- a/semantic_router/utils/llm.py
+++ b/semantic_router/utils/llm.py
@@ -33,6 +33,7 @@ def llm(prompt: str) -> str | None:
         logger.error(f"LLM error: {e}")
         raise Exception(f"LLM error: {e}")
 
+
 # TODO integrate async LLM function
 # async def allm(prompt: str) -> str | None:
 #     try:
diff --git a/tests/unit/test_layer.py b/tests/unit/test_layer.py
index c6898235..4520adf4 100644
--- a/tests/unit/test_layer.py
+++ b/tests/unit/test_layer.py
@@ -178,7 +178,10 @@ class TestRouteLayer:
         route_layer.to_json("test_output.json")
         assert os.path.exists("test_output.json")
         route_layer_from_file = RouteLayer.from_json("test_output.json")
-        assert route_layer_from_file.index is not None and route_layer_from_file.categories is not None
+        assert (
+            route_layer_from_file.index is not None
+            and route_layer_from_file.categories is not None
+        )
         os.remove("test_output.json")
 
     def test_yaml(self, openai_encoder, routes):
@@ -186,7 +189,10 @@ class TestRouteLayer:
         route_layer.to_yaml("test_output.yaml")
         assert os.path.exists("test_output.yaml")
         route_layer_from_file = RouteLayer.from_yaml("test_output.yaml")
-        assert route_layer_from_file.index is not None and route_layer_from_file.categories is not None
+        assert (
+            route_layer_from_file.index is not None
+            and route_layer_from_file.categories is not None
+        )
         os.remove("test_output.yaml")
 
     def test_config(self, openai_encoder, routes):
@@ -200,6 +206,7 @@ class TestRouteLayer:
         assert (route_layer_from_config.categories == route_layer.categories).all()
         assert route_layer_from_config.score_threshold == route_layer.score_threshold
 
+
 # Add more tests for edge cases and error handling as needed.
 
 
-- 
GitLab