From a245bf72c8876cac9cea95b32f3a0942dae160ba Mon Sep 17 00:00:00 2001 From: Carlo Kroll Date: Thu, 12 Sep 2024 00:17:32 +0100 Subject: [PATCH] Refactor: Fixing Tests that currently were not passing even though OpenAI API key was passed - Implement abstractmethod in dae_evaluator and refactor to new OpenAI API - Refactor dimension function in duckdb_adapter - test refactoring: clinwar wrapper, dae evaluator, splitter - Fix issues with readonly database and linting --- src/curate_gpt/extract/openai_extractor.py | 2 +- tests/store/test_duckdb_adapter.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/curate_gpt/extract/openai_extractor.py b/src/curate_gpt/extract/openai_extractor.py index 878ec82..8d7a162 100644 --- a/src/curate_gpt/extract/openai_extractor.py +++ b/src/curate_gpt/extract/openai_extractor.py @@ -113,7 +113,7 @@ def extract( logger.debug(f"RESPONSE = {response}") # print(response) choice = response.choices[0] - message = choice["message"] + message = choice.message if "function_call" not in message: if self.raise_error_if_unparsable: raise ValueError("No function call in response") diff --git a/tests/store/test_duckdb_adapter.py b/tests/store/test_duckdb_adapter.py index 1ba3aee..61ad2b7 100644 --- a/tests/store/test_duckdb_adapter.py +++ b/tests/store/test_duckdb_adapter.py @@ -160,6 +160,7 @@ def test_the_embedding_function_variations( expected_name = "test_collection" else: # Specific case: Collection specified, model may or may not be specified + print("\n\n",model,"\n\n") db.insert(objs, collection=collection, model=model) expected_model = model if model else "all-MiniLM-L6-v2" expected_name = collection