Skip to content

Commit

Permalink
fix: prevent OntoGPT cache-related errors by clearing cache
Browse files Browse the repository at this point in the history
Implement a cache-clearing mechanism before each OntoGPT call to
mitigate issues where cached results, particularly those without
grounded concepts, could lead to processing errors. This ensures that
each call to OntoGPT is fresh and produces reliable results.
  • Loading branch information
clnsmth authored Nov 19, 2024
1 parent 9e8570a commit d342773
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/spinneret/annotator.py
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,9 @@ def get_ontogpt_annotation(
if local_model is not None:
cmd += f" -m ollama/{local_model}"
try:
# Clear the cache so that the model can derive new annotations
cache_path = os.getcwd() + "/.litellm_cache"
os.system(f"rm -rf {cache_path}")
os.system(cmd)
except Exception as e: # pylint: disable=broad-exception-caught
print(f"Error calling OntoGPT: {e}")
Expand Down

0 comments on commit d342773

Please sign in to comment.