Enhancing LLMs Interactions for Python: A Smart API Framework for Extracting and Utilizing Semantic Code Information

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.

Authors

Institutions

Publication Details

Published
2025-06-20
DOI
https://doi.org/10.1109/caibda65784.2025.11182836
Primary Topic
Computational Physics and Python Applications
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Enhancing LLMs Interactions for Python: A Smart API Framework for Extracting and Utilizing Semantic Code Information

Nouman Ahmad, Changsheng Zhang
Computational Physics and Python Applications
article

Enhancing LLMs Interactions for Python: A Smart API Framework for Extracting and Utilizing Semantic Code Information

Nouman Ahmad, Changsheng Zhang
article en

Abstract

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.

Northeastern University (CN)
Openalex Percentile: Top 85%
Computational Physics and Python Applications
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Enhancing LLMs Interactions for Python: A Smart API Framework for Extracting and Utilizing Semantic Code Information — Nouman Ahmad, Changsheng Zhang · (2025) | TGRS Research Map | TGRS