{"title":"Automating vertical bearing capacity calculations using python: Prompt engineering of ChatGPT on API RP 2A","authors":"Saeyon Kim, Donghwi Kim, Heejung Youn","doi":"10.1016/j.dibe.2025.100628","DOIUrl":null,"url":null,"abstract":"<div><div>This study explores the application of ChatGPT by applying prompt engineering to enable the model to process a design standard documentation and generate computer code for calculating the vertical bearing capacity of piles. A framework is proposed for the prompt engineering of ChatGPT to compute the vertical bearing capacity according to API RP 2A and to generate Python code that complies with this standard. The research is structured into three key steps: providing geotechnical data, refining prompts to guide ChatGPT in processing the API methods for bearing capacity calculation and generating Python code to automate the calculations. Through iterative prompt refinement, the model's accuracy was improved, resulting in Python code that produced reliable outputs aligned with API RP 2A design criteria. In contrast, when ChatGPT performed the calculations directly without generating code, the results were less reliable, underscoring the value of ChatGPT-driven code generation for achieving accurate and consistent outcomes.</div></div>","PeriodicalId":34137,"journal":{"name":"Developments in the Built Environment","volume":"21 ","pages":"Article 100628"},"PeriodicalIF":6.2000,"publicationDate":"2025-02-21","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Developments in the Built Environment","FirstCategoryId":"5","ListUrlMain":"https://www.sciencedirect.com/science/article/pii/S2666165925000286","RegionNum":2,"RegionCategory":"工程技术","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q1","JCRName":"CONSTRUCTION & BUILDING TECHNOLOGY","Score":null,"Total":0}
引用次数: 0
Abstract
This study explores the application of ChatGPT by applying prompt engineering to enable the model to process a design standard documentation and generate computer code for calculating the vertical bearing capacity of piles. A framework is proposed for the prompt engineering of ChatGPT to compute the vertical bearing capacity according to API RP 2A and to generate Python code that complies with this standard. The research is structured into three key steps: providing geotechnical data, refining prompts to guide ChatGPT in processing the API methods for bearing capacity calculation and generating Python code to automate the calculations. Through iterative prompt refinement, the model's accuracy was improved, resulting in Python code that produced reliable outputs aligned with API RP 2A design criteria. In contrast, when ChatGPT performed the calculations directly without generating code, the results were less reliable, underscoring the value of ChatGPT-driven code generation for achieving accurate and consistent outcomes.
本研究探索ChatGPT的应用,通过提示工程,使模型能够处理设计标准文档,并生成计算桩竖向承载力的计算机代码。为ChatGPT的提示工程提出了一个框架,根据API RP 2A计算竖向承载力,并生成符合该标准的Python代码。该研究分为三个关键步骤:提供岩土数据,精炼提示以指导ChatGPT处理承载力计算的API方法,并生成Python代码以实现计算自动化。通过迭代的提示改进,模型的准确性得到了提高,从而使Python代码产生符合API RP 2A设计标准的可靠输出。相反,当ChatGPT直接执行计算而不生成代码时,结果不太可靠,强调了ChatGPT驱动的代码生成对于实现准确和一致的结果的价值。
期刊介绍:
Developments in the Built Environment (DIBE) is a recently established peer-reviewed gold open access journal, ensuring that all accepted articles are permanently and freely accessible. Focused on civil engineering and the built environment, DIBE publishes original papers and short communications. Encompassing topics such as construction materials and building sustainability, the journal adopts a holistic approach with the aim of benefiting the community.