Загрузка видео...
Не удалось загрузить видео
Self-healing code GitHub action pipeline using and OpenAI. What an insane world we live in. A 🧵 on how it works below 👇
555,185 просмотров • 3 лет назад •via X (Twitter)
Комментарии: 11

(1/9) Create a workflow for GitHub actions that triggers our healing job when the build command fails. This should pass the error log from the build to the healing job. (Note to self: it's certainly useful to implement a limit to retry mechanisms 😉)

(2/9) Create your python script to run when the build fails and read the error log file on it.

(3/9) Create your human prompt template and pass it to the LLMChain. Mine goes something like this: "Can you find the filename where this error comes from: {error}? If you do, please reply with the path to the file ONLY, if not please reply with no."

(4/9) Run the LLMChain to return the pathname and check if the filename was detected. Then read the contents of the file.

(5/9) We want to make sure GPT returns meaningful, structured code, so I created a ResponseSchema that contains if a fix was found and the fixed content.

(6/9) Create a prompt template with your structured response schema and the request for GPT to fix the code.

(7/9) Run the LLMChain again with the prompt and parse it using your created OutputParser.

(8/9) Write the returned code to the file and commit using the action.

(9/9) Run and have fun. There you have self-healing builds. This is an early prototype and works on single file errors only for now, but the potential to improve CI/CD pipelines and implications to DevOps is huge. Wdyt? Thank you for reading!

@LangChainAI @OpenAI Looks cool but I would prefer that the IDE prevented me to commit wrong code. Perhaps a quick-fix or a pre-commit hook would be even more convenient

@LangChainAI @OpenAI I agree that the IDE can and probably should take a good chunk of the work. Environments often vary from your local env though, so it could be beneficial to have multiple checkpoints along the way.


