Enhancing LLMs Interactions for Python: A Smart API Framework for Extracting and Utilizing Semantic Code Information
Published in 2025 5th International Conference on Artificial Intelligence, Big Data and Algorithms (CAIBDA), 2025
In order to engage with large language models (LLMs) in a meaningful way, it is necessary to create prompts that are both instructive and precise. However, especially when working with complicated codebases, basic prompts frequently fall short in providing adequate context or extracting useful insights. In order to overcome this difficulty, we introduce a brand-new system that uses FastAPI to automatically extract semantic data from Python codebases. In order to recognize import statements, custom functions, and class declarations, as well as how they are used within modules and classes, our system uses libest to parse and analyze Python source files. Furthermore, the framework facilitates extraction from particular branches, commits, or tags by supporting Git-based version control. We create distinctive, context-rich prompts for LLMs like OpenAI’s GPT models by fusing these capabilities. By producing structured JSON answers, the API makes it easier to integrate with open-source LLM systems like ChatGPT. In addition to improving the caliber of interactions with LLMs, this method gives developers the ability to effectively query and comprehend intricate codebases. Lastly, we curate a dataset of Python repositories from GitHub based on size and activity criteria, and train a GPT-4 based model evaluated using BERTScore, BLEU, and ROUGE, achieving research-acceptable metrics.
Recommended citation:
@INPROCEEDINGS{11182836, author={Ahmad, Nouman and Zhang, Changsheng}, booktitle={2025 5th International Conference on Artificial Intelligence, Big Data and Algorithms (CAIBDA)}, title={Enhancing LLMs Interactions for Python: A Smart API Framework for Extracting and Utilizing Semantic Code Information}, year={2025}, volume={}, number={}, pages={385-388}, keywords={Measurement;Codes;Navigation;Large language models;Semantics;Manuals;Metadata;Data mining;Prompt engineering;Software development management;Prompt Engineering;Semantic Code Analysis;LLM Interactions}, doi={10.1109/CAIBDA65784.2025.11182836}}
Download Paper
