top | item 35625281

Show HN: I Wrote an AI PowerShell Refiner

4 points| BasiliusCarver | 2 years ago |shaunlawrie.com

I’ve been having fun generating code via LLMs but getting frustrated with the common pitfalls (hallucinated functions, parameters, mixed up language constructs etc.). I use PowerShell a lot in my daily work so I built something to help generate a lot of boilerplate code I need. I’ve used the PS abstract syntax tree to parse the LLM output and validate that common issues aren’t present, if they are it gets auto-corrected and it also uses the LLM to ensure the logic is still sound after correcting syntax issues.

I probably spent more time writing the terrible in-terminal syntax highlighter than working on the AI side of things

2 comments

order

replwoacause|2 years ago

Very cool. I too use PowerShell in my daily work and have found ChatGPT to be quite good, although it has made some mistakes. I’ll give this a try. I wonder if this could be also accomplished by providing GPT the algorithm at the end of your article, as a preamble to each request for a function. If so, was this made into a module because it fits your workflow better?

BasiliusCarver|2 years ago

I built it into the existing PowerShellAI module because I was learning as I went and I was already using it. The module already has quite a bit of adoption too so I figure it’s a good way to find bugs and get some feedback. Just launch it to a few hundred people and see what works.