macaron
macaron copied to clipboard
feat: add AI module for LLM interaction and a heuristic for checking code–docstring consistency
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
AIClientclass to enable seamless integration with LLMs . - Implemented a new heuristic analyzer called
MatchingDocstringsAnalyzerthat detect inconsistencies between code and its docstrings. - Integrated the new heuristic into the
heuristics.pyregistry. - Updated
detect_malicious_metadata_check.pyto 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
verifiedlabel 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.