Skip to content

Commit

Permalink
Further Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
caufieldjh committed Sep 24, 2024
1 parent 4a1a731 commit 8c4fab8
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 15 deletions.
1 change: 1 addition & 0 deletions src/ontogpt/clients/llm_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
# Necessary to avoid repeated debug messages
litellm.suppress_debug_info = True


@dataclass
class LLMClient:

Expand Down
2 changes: 1 addition & 1 deletion src/ontogpt/engines/embedding_similarity_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Embedding similarity engine.
This module provides functionality for calculating the similarity between entities
using embeddings and cosine similarity. It includes classes and methods for
using embeddings and cosine similarity. It includes classes and methods for
searching for similar entities and retrieving textual representations of entities.
Classes:
Expand Down
12 changes: 9 additions & 3 deletions src/ontogpt/engines/mapping_engine.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
"""
Mapping engine.
This module provides the `MappingEngine` class, which is responsible for generating and resolving mappings between concepts in different ontologies. It utilizes various classes and enums to represent mapping tasks, categorized mappings, and confidence levels.
This module provides the `MappingEngine` class,
which is responsible for generating and resolving
mappings between concepts in different ontologies.
It utilizes various classes and enums to represent
mapping tasks, categorized mappings, and confidence levels.
Classes:
MappingPredicate: Enum representing different types of mapping predicates.
Expand All @@ -14,11 +18,13 @@
MappingEngine: Engine class for generating and resolving mappings.
Functions:
categorize_mapping: Categorizes a mapping between a subject and an object using a template.
categorize_mapping: Categorizes a mapping between a subject
and an object using a template.
_parse: Parses the payload from the categorization process into a `CategorizedMapping`.
categorize_mappings: Categorizes multiple mappings between subjects and object sources.
run_tasks: Runs a collection of mapping tasks and categorizes the results.
generate_tasks: Generates mapping tasks from a collection or specified subjects and object sources.
generate_tasks: Generates mapping tasks from a collection or
specified subjects and object sources.
from_sssom: Generates tasks from an SSSOM file.
categorize_sssom_mapping: Categorizes a single SSSOM mapping.
_concept: Retrieves a concept from an ontology adapter.
Expand Down
13 changes: 10 additions & 3 deletions src/ontogpt/engines/reasoner_engine.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
"""
Reasoner engine.
This module provides the implementation of the ReasonerEngine class, which is used to perform reasoning tasks using a Language Model (LLM). The engine takes an ontology and a query task as input, translates it into an LLM prompt, and performs reasoning over the ontology.
This module provides the implementation of the
ReasonerEngine class, which is used to perform
reasoning tasks using a Language Model (LLM).
The engine takes an ontology and a query task as input,
translates it into an LLM prompt, and performs
reasoning over the ontology.
Classes:
ReasonerResult: Represents the result of a reason query.
Expand All @@ -10,13 +15,15 @@
Functions:
flatten_list(lst): Flattens a nested list into a single list.
reason(task, template_path=None, strict=False, evaluate=None): Performs reasoning over axioms and query entailments.
reason(task, template_path=None, strict=False, evaluate=None): Performs
reasoning over axioms and query entailments.
reason_multiple(task_collection, **kwargs): Performs reasoning over multiple tasks.
_parse_single_answer(payload, task): Parses a single answer from the payload.
evaluate(result, task): Evaluates the result against the task.
Usage:
The ReasonerEngine can be used to perform reasoning tasks such as finding superclasses of a given class.
The ReasonerEngine can be used to perform reasoning tasks
such as finding superclasses of a given class.
It can also provide explanations for the reasoning process.
"""

Expand Down
10 changes: 7 additions & 3 deletions src/ontogpt/engines/synonym_engine.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
"""
Synonym engine.
This module defines the SynonymEngine class, which is responsible for generating synonyms for given named entities within a specified domain.
This module defines the SynonymEngine class,
which is responsible for generating synonyms
for given named entities within a specified domain.
Classes:
SynonymEngine: Inherits from KnowledgeEngine and provides a method to retrieve synonyms.
SynonymEngine: Inherits from KnowledgeEngine and
provides a method to retrieve synonyms.
Methods:
synonyms(named_entity: str, domain: str) -> List[str]:
Retrieves synonyms for the given named entity within the specified domain.
Retrieves synonyms for the given named entity
within the specified domain.
"""

from dataclasses import dataclass
Expand Down
4 changes: 3 additions & 1 deletion src/ontogpt/evaluation/maxo/eval_maxo.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,9 @@ def eval(self) -> EvaluationObjectSetRE:
if extraction.extracted_object is not None:
# Process all multi-object triples to 1 to 1 triples
# so they may be more directly compared
for extracted_triple in extraction.extracted_object.action_annotation_relationships:
for (
extracted_triple
) in extraction.extracted_object.action_annotation_relationships:
new_triple = extracted_triple
for object in extracted_triple.object:
new_triple.object = [object]
Expand Down
2 changes: 1 addition & 1 deletion src/ontogpt/utils/clinical_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ def get_kanjee_prompt() -> str:
" the diagnoses. Again, the goal is to be as specific as possible with each of the "
"diagnoses. Do you have any questions, Dr. GPT-4?\n\nHere is the case:"
)
return prompt
return prompt
4 changes: 1 addition & 3 deletions src/ontogpt/webapp/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ class Query(BaseModel):
def get_engine(datamodel: str, llm_model: str):
if datamodel not in engines:
template_details = get_template_details(template=datamodel)
engines[datamodel] = SPIRESEngine(
model=llm_model, template_details=template_details
)
engines[datamodel] = SPIRESEngine(model=llm_model, template_details=template_details)
return engines[datamodel]


Expand Down

0 comments on commit 8c4fab8

Please sign in to comment.