Find answers from the community

Updated 3 weeks ago

Constructing a pipeline for sql query generation, execution, and dataframe manipulation with llm

Hi, I'm looking for something I can use to construct a pipeline where the LLM can construct SQL queries and execute them, then save the results into a pandas dataframe in memory and construct and execute code to produce new dataframe(s) or results from the generated dataframes

For example:
"Calculate net income by month for 2024 and show me the months where I lost money along with the loss"
  • LLM constructs a plan for two sql queries to get revenue by month, expense by month
  • Execute queries and save into two separate dataframes
  • LLM can construct Pandas code, given the two dataframes, to join them and get the loss for each month
  • Execute the code, get the result dataframe
Is this possible with LlamaIndex?
L
1 comment
Its possible in llama-index, but I think you'd have to build a lot of the pieces yourself. Would be cool to be a workflow (https://docs.llamaindex.ai/en/stable/module_guides/workflow/#workflows) that does this
Add a reply
Sign up and join the conversation on Discord