macaron icon indicating copy to clipboard operation
macaron copied to clipboard

feat: add AI module for LLM interaction and a heuristic for checking code–docstring consistency

Open AmineRaouane opened this issue 5 months ago • 0 comments

Summary

This PR introduces an AI client for interacting with large language models (LLMs) and adds a new heuristic analyzer to detect inconsistencies between code and its docstrings.

Description of changes

  • Added an AIClient class to enable seamless integration with LLMs .
  • Implemented a new heuristic analyzer called MatchingDocstringsAnalyzer that detect inconsistencies between code and its docstrings.
  • Integrated the new heuristic into the heuristics.py registry.
  • Updated detect_malicious_metadata_check.py to include and run this new heuristic.
  • Added unit tests to verify correct detection of missing or mismatched docstrings.

Related issues

None

Checklist

  • [X] I have reviewed the contribution guide.
  • [X] My PR title and commits follow the Conventional Commits convention.
  • [X] My commits include the "Signed-off-by" line.
  • [X] I have signed my commits following the instructions provided by GitHub. Note that we run GitHub's commit verification tool to check the commit signatures. A green verified label should appear next to all of your commits on GitHub.
  • [X] I have updated the relevant documentation, if applicable.
  • [X] I have tested my changes and verified they work as expected.

AmineRaouane avatar Jul 11 '25 20:07 AmineRaouane