From 56ec4bf6ff07271d5381c2b5ef582aaa8db2f925 Mon Sep 17 00:00:00 2001 From: caufieldjh Date: Mon, 12 Aug 2024 11:29:34 -0400 Subject: [PATCH 1/5] Bump version to v1.0.3 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 2593987b4..b108b5772 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "ontogpt" -version = "1.0.2" +version = "1.0.3" description = "OntoGPT" authors = ["Chris Mungall ", "J. Harry Caufield "] license = "BSD-3" From b433755051e5c497139964068386f97c069c1a40 Mon Sep 17 00:00:00 2001 From: caufieldjh Date: Mon, 12 Aug 2024 11:30:54 -0400 Subject: [PATCH 2/5] Linting in tests --- tests/unit/test_clients/test_pubmed_client_unit.py | 1 + tests/unit/test_converters/test_ontology_converter.py | 1 + tests/unit/test_ontex/test_extract.py | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/unit/test_clients/test_pubmed_client_unit.py b/tests/unit/test_clients/test_pubmed_client_unit.py index 3239ebb1c..3484c377b 100644 --- a/tests/unit/test_clients/test_pubmed_client_unit.py +++ b/tests/unit/test_clients/test_pubmed_client_unit.py @@ -1,4 +1,5 @@ """PubMed client tests.""" + import unittest from ontogpt.clients import PubmedClient diff --git a/tests/unit/test_converters/test_ontology_converter.py b/tests/unit/test_converters/test_ontology_converter.py index edfce8c1e..1040b7eab 100644 --- a/tests/unit/test_converters/test_ontology_converter.py +++ b/tests/unit/test_converters/test_ontology_converter.py @@ -1,4 +1,5 @@ """Core tests.""" + import logging import unittest diff --git a/tests/unit/test_ontex/test_extract.py b/tests/unit/test_ontex/test_extract.py index f7455d3e0..4253be24c 100644 --- a/tests/unit/test_ontex/test_extract.py +++ b/tests/unit/test_ontex/test_extract.py @@ -1,4 +1,5 @@ -"""Core tests.""" +"""Core tests for extraction.""" + import csv import logging import unittest From db7d0bfe26e73e75e15f3d45a9555c60762c69fd Mon Sep 17 00:00:00 2001 From: caufieldjh Date: Mon, 12 Aug 2024 11:38:45 -0400 Subject: [PATCH 3/5] Linting in engines --- src/ontogpt/engines/generic_engine.py | 3 +-- src/ontogpt/engines/halo_engine.py | 2 +- src/ontogpt/engines/mapping_engine.py | 1 + 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ontogpt/engines/generic_engine.py b/src/ontogpt/engines/generic_engine.py index 123e6d76d..cbbcd4fda 100644 --- a/src/ontogpt/engines/generic_engine.py +++ b/src/ontogpt/engines/generic_engine.py @@ -48,11 +48,10 @@ def run( question_collection: QuestionCollection, template_path: Union[str, Path] = "", ) -> Iterator[Question]: - if template_path is None: - template_path = GENERIC_QA_PROMPT if isinstance(template_path, Path): template_path = str(template_path) if isinstance(template_path, str): + # Note: The default is a string, so this will always be true # create a Jinja2 template object with open(template_path) as file: template_txt = file.read() diff --git a/src/ontogpt/engines/halo_engine.py b/src/ontogpt/engines/halo_engine.py index b5755142b..da1ec4805 100644 --- a/src/ontogpt/engines/halo_engine.py +++ b/src/ontogpt/engines/halo_engine.py @@ -257,7 +257,7 @@ def get_element_score(self, element: OntologyElement, tokens: Set[int]) -> float score = self.element_scores[element_name] else: score = 0 - for _, v in element.dict().items(): + for _, v in element.model_dump().items(): if v: score += 1 self.element_scores[element_name] = score diff --git a/src/ontogpt/engines/mapping_engine.py b/src/ontogpt/engines/mapping_engine.py index 883c20c54..c704e2dab 100644 --- a/src/ontogpt/engines/mapping_engine.py +++ b/src/ontogpt/engines/mapping_engine.py @@ -1,4 +1,5 @@ """Synonym engine.""" + import logging from copy import deepcopy from dataclasses import dataclass From af7467759d75da450bd907e142832750702e2e65 Mon Sep 17 00:00:00 2001 From: caufieldjh Date: Mon, 12 Aug 2024 11:40:46 -0400 Subject: [PATCH 4/5] Linting in the reasoner engine --- src/ontogpt/engines/reasoner_engine.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ontogpt/engines/reasoner_engine.py b/src/ontogpt/engines/reasoner_engine.py index 9377256ac..1b2925fa3 100644 --- a/src/ontogpt/engines/reasoner_engine.py +++ b/src/ontogpt/engines/reasoner_engine.py @@ -1,4 +1,5 @@ """Reasoner engine.""" + import logging import re from dataclasses import dataclass @@ -72,10 +73,10 @@ class ReasonerResultSet(BaseModel): @dataclass class ReasonerEngine(KnowledgeEngine): - """Engine for performing reasoning using GPT. + """Engine for performing reasoning using an LLM. This engine takes as input an Ontology, and a query Task, - and then translates this to a GPT prompt that asks GPT to + and then translates this to an LLM prompt that asks the LLM to perform the task over the ontology after reasoning over it. The Task is typically a query such as finding superclasses of @@ -83,10 +84,10 @@ class ReasonerEngine(KnowledgeEngine): This is intended primarily for investigation purposes. For practical scenarios, it is recommended to use a dedicated OWL reasoner. The goal - of this engine is to evaluate the extent to which GPT can perform + of this engine is to evaluate the extent to which the LLM can perform reasoning-like tasks, including deduction and abduction (explanation). - Due to token-length constraints on GPT models, it is usually necessary + Due to token-length constraints on some models, it is usually necessary to extract a submodule prior to reasoning. This can be done using the OntologyExtractor: From 86f4025ba0bff2f676b386a04c513ebeb3abf520 Mon Sep 17 00:00:00 2001 From: caufieldjh Date: Mon, 12 Aug 2024 11:53:55 -0400 Subject: [PATCH 5/5] Remove unused reference to generic QA template --- src/ontogpt/engines/generic_engine.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ontogpt/engines/generic_engine.py b/src/ontogpt/engines/generic_engine.py index cbbcd4fda..992df1231 100644 --- a/src/ontogpt/engines/generic_engine.py +++ b/src/ontogpt/engines/generic_engine.py @@ -10,7 +10,6 @@ from pydantic import BaseModel from ontogpt.engines.knowledge_engine import KnowledgeEngine -from ontogpt.prompts.qa import GENERIC_QA_PROMPT logger = logging.getLogger(__name__)