Hi,
This is probably old new question. Im sure it was asked before but I did not find much with good direction, and new because given how fast things are changing with LLM there could be better way or approach out there.
Basically Im using LLM to convert user prompt into python code that I later run on a dataset to help generate desired result in terms of data query , aggregation , visualization …etc. I like its so dynamic but there is more that goes into it to ensure delivering good result, however the bottom line is I find myself relying on the exec() function which is not recommended based on what I read. For example one of the code I generate is going to run against a pandas dataframe to isolate and aggregate the dataset to the desired result regardless of the complexity of it. This way Im bringing AI to my dataset vs uploading the dataset to AI which saves me a lot in time and tokens.
My question : Is there a better and safer way to do such approach without sacrificing much of the freedom and flexibility from having to hard code every possible scenario a user might ask then utilize function calling to route to the proper function?
Thanks