From ae0c243962077a6506159e43ebf4d87a8d08aba6 Mon Sep 17 00:00:00 2001 From: Francesco Fuggitti Date: Thu, 15 Feb 2024 15:23:41 +0100 Subject: [PATCH] chore: wrap openai client initialization Signed-off-by: Francesco Fuggitti --- nl2ltl/engines/gpt/core.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nl2ltl/engines/gpt/core.py b/nl2ltl/engines/gpt/core.py index 949cc00..4068b57 100644 --- a/nl2ltl/engines/gpt/core.py +++ b/nl2ltl/engines/gpt/core.py @@ -18,7 +18,11 @@ from nl2ltl.engines.gpt.output import GPTOutput, parse_gpt_output, parse_gpt_result from nl2ltl.filters.base import Filter -client = OpenAI() +try: + client = OpenAI() +except Exception: + client = None + engine_root = ENGINE_ROOT DATA_DIR = engine_root / "data" PROMPT_PATH = engine_root / DATA_DIR / "prompt.json"