Querying Databases with Function Calling. Shorten, C., Pierse, C., Smith, T. B., D'Oosterlinck, K., Celik, T., Cardenas, E., Monigatti, L., Hasan, M. S., Schmuhl, E., Williams, D., Kesiraju, A., & Luijt, B. v. January, 2025. arXiv:2502.00032 [cs]
Paper doi abstract bibtex The capabilities of Large Language Models (LLMs) are rapidly accelerating largely thanks to their integration with external tools. Querying databases is among the most effective of these integrations, enabling LLMs to access private or continually updating data. While Function Calling is the most common method for interfacing external tools to LLMs, its application to database querying as a tool has been underexplored. We propose a tool definition for database querying that unifies accessing data with search queries, filters, or a combination both, as well as transforming results with aggregation and groupby operators. To evaluate its effectiveness, we conduct a study with 8 LLMs spanning 5 model families. We present a novel pipeline adapting the Gorilla LLM framework to create synthetic database schemas and queries. We primarily evaluate the models with the Exact Match of predicted and ground truth query APIs. Among the models tested, Claude 3.5 Sonnet achieves the highest performance with an Exact Match score of 74.3%, followed by GPT-4o mini at 73.7%, and GPT-4o at 71.8%. We further breakdown these results per API component utilized and across synthetic use cases. We find that LLMs are highly effective at utilizing operators on boolean properties, but struggle with text property filters. Across use cases we find robust results with the higher performing models such as GPT-4o, but significant performance variance across use cases from lower performing models. We additionally conduct ablation studies exploring the impact of parallel tool calling, adding a rationale as an argument of the tool call, using a separate tool per database collection, and tool calling with structured outputs. Our findings demonstrate the effectiveness of enabling LLMs to query databases with Function Calling. We have open-sourced our experimental code and results at github.com/weaviate/gorilla.
@misc{shorten_querying_2025,
title = {Querying {Databases} with {Function} {Calling}},
url = {http://arxiv.org/abs/2502.00032},
doi = {10.48550/arXiv.2502.00032},
abstract = {The capabilities of Large Language Models (LLMs) are rapidly accelerating largely thanks to their integration with external tools. Querying databases is among the most effective of these integrations, enabling LLMs to access private or continually updating data. While Function Calling is the most common method for interfacing external tools to LLMs, its application to database querying as a tool has been underexplored. We propose a tool definition for database querying that unifies accessing data with search queries, filters, or a combination both, as well as transforming results with aggregation and groupby operators. To evaluate its effectiveness, we conduct a study with 8 LLMs spanning 5 model families. We present a novel pipeline adapting the Gorilla LLM framework to create synthetic database schemas and queries. We primarily evaluate the models with the Exact Match of predicted and ground truth query APIs. Among the models tested, Claude 3.5 Sonnet achieves the highest performance with an Exact Match score of 74.3\%, followed by GPT-4o mini at 73.7\%, and GPT-4o at 71.8\%. We further breakdown these results per API component utilized and across synthetic use cases. We find that LLMs are highly effective at utilizing operators on boolean properties, but struggle with text property filters. Across use cases we find robust results with the higher performing models such as GPT-4o, but significant performance variance across use cases from lower performing models. We additionally conduct ablation studies exploring the impact of parallel tool calling, adding a rationale as an argument of the tool call, using a separate tool per database collection, and tool calling with structured outputs. Our findings demonstrate the effectiveness of enabling LLMs to query databases with Function Calling. We have open-sourced our experimental code and results at github.com/weaviate/gorilla.},
urldate = {2025-03-14},
publisher = {arXiv},
author = {Shorten, Connor and Pierse, Charles and Smith, Thomas Benjamin and D'Oosterlinck, Karel and Celik, Tuana and Cardenas, Erika and Monigatti, Leonie and Hasan, Mohd Shukri and Schmuhl, Edward and Williams, Daniel and Kesiraju, Aravind and Luijt, Bob van},
month = jan,
year = {2025},
note = {arXiv:2502.00032 [cs]},
keywords = {Computer Science - Artificial Intelligence, Computer Science - Databases, Computer Science - Information Retrieval},
}
Downloads: 0
{"_id":"AiXxSFE3BQvQGEgqB","bibbaseid":"shorten-pierse-smith-doosterlinck-celik-cardenas-monigatti-hasan-etal-queryingdatabaseswithfunctioncalling-2025","author_short":["Shorten, C.","Pierse, C.","Smith, T. B.","D'Oosterlinck, K.","Celik, T.","Cardenas, E.","Monigatti, L.","Hasan, M. S.","Schmuhl, E.","Williams, D.","Kesiraju, A.","Luijt, B. v."],"bibdata":{"bibtype":"misc","type":"misc","title":"Querying Databases with Function Calling","url":"http://arxiv.org/abs/2502.00032","doi":"10.48550/arXiv.2502.00032","abstract":"The capabilities of Large Language Models (LLMs) are rapidly accelerating largely thanks to their integration with external tools. Querying databases is among the most effective of these integrations, enabling LLMs to access private or continually updating data. While Function Calling is the most common method for interfacing external tools to LLMs, its application to database querying as a tool has been underexplored. We propose a tool definition for database querying that unifies accessing data with search queries, filters, or a combination both, as well as transforming results with aggregation and groupby operators. To evaluate its effectiveness, we conduct a study with 8 LLMs spanning 5 model families. We present a novel pipeline adapting the Gorilla LLM framework to create synthetic database schemas and queries. We primarily evaluate the models with the Exact Match of predicted and ground truth query APIs. Among the models tested, Claude 3.5 Sonnet achieves the highest performance with an Exact Match score of 74.3%, followed by GPT-4o mini at 73.7%, and GPT-4o at 71.8%. We further breakdown these results per API component utilized and across synthetic use cases. We find that LLMs are highly effective at utilizing operators on boolean properties, but struggle with text property filters. Across use cases we find robust results with the higher performing models such as GPT-4o, but significant performance variance across use cases from lower performing models. We additionally conduct ablation studies exploring the impact of parallel tool calling, adding a rationale as an argument of the tool call, using a separate tool per database collection, and tool calling with structured outputs. Our findings demonstrate the effectiveness of enabling LLMs to query databases with Function Calling. We have open-sourced our experimental code and results at github.com/weaviate/gorilla.","urldate":"2025-03-14","publisher":"arXiv","author":[{"propositions":[],"lastnames":["Shorten"],"firstnames":["Connor"],"suffixes":[]},{"propositions":[],"lastnames":["Pierse"],"firstnames":["Charles"],"suffixes":[]},{"propositions":[],"lastnames":["Smith"],"firstnames":["Thomas","Benjamin"],"suffixes":[]},{"propositions":[],"lastnames":["D'Oosterlinck"],"firstnames":["Karel"],"suffixes":[]},{"propositions":[],"lastnames":["Celik"],"firstnames":["Tuana"],"suffixes":[]},{"propositions":[],"lastnames":["Cardenas"],"firstnames":["Erika"],"suffixes":[]},{"propositions":[],"lastnames":["Monigatti"],"firstnames":["Leonie"],"suffixes":[]},{"propositions":[],"lastnames":["Hasan"],"firstnames":["Mohd","Shukri"],"suffixes":[]},{"propositions":[],"lastnames":["Schmuhl"],"firstnames":["Edward"],"suffixes":[]},{"propositions":[],"lastnames":["Williams"],"firstnames":["Daniel"],"suffixes":[]},{"propositions":[],"lastnames":["Kesiraju"],"firstnames":["Aravind"],"suffixes":[]},{"propositions":[],"lastnames":["Luijt"],"firstnames":["Bob","van"],"suffixes":[]}],"month":"January","year":"2025","note":"arXiv:2502.00032 [cs]","keywords":"Computer Science - Artificial Intelligence, Computer Science - Databases, Computer Science - Information Retrieval","bibtex":"@misc{shorten_querying_2025,\n\ttitle = {Querying {Databases} with {Function} {Calling}},\n\turl = {http://arxiv.org/abs/2502.00032},\n\tdoi = {10.48550/arXiv.2502.00032},\n\tabstract = {The capabilities of Large Language Models (LLMs) are rapidly accelerating largely thanks to their integration with external tools. Querying databases is among the most effective of these integrations, enabling LLMs to access private or continually updating data. While Function Calling is the most common method for interfacing external tools to LLMs, its application to database querying as a tool has been underexplored. We propose a tool definition for database querying that unifies accessing data with search queries, filters, or a combination both, as well as transforming results with aggregation and groupby operators. To evaluate its effectiveness, we conduct a study with 8 LLMs spanning 5 model families. We present a novel pipeline adapting the Gorilla LLM framework to create synthetic database schemas and queries. We primarily evaluate the models with the Exact Match of predicted and ground truth query APIs. Among the models tested, Claude 3.5 Sonnet achieves the highest performance with an Exact Match score of 74.3\\%, followed by GPT-4o mini at 73.7\\%, and GPT-4o at 71.8\\%. We further breakdown these results per API component utilized and across synthetic use cases. We find that LLMs are highly effective at utilizing operators on boolean properties, but struggle with text property filters. Across use cases we find robust results with the higher performing models such as GPT-4o, but significant performance variance across use cases from lower performing models. We additionally conduct ablation studies exploring the impact of parallel tool calling, adding a rationale as an argument of the tool call, using a separate tool per database collection, and tool calling with structured outputs. Our findings demonstrate the effectiveness of enabling LLMs to query databases with Function Calling. We have open-sourced our experimental code and results at github.com/weaviate/gorilla.},\n\turldate = {2025-03-14},\n\tpublisher = {arXiv},\n\tauthor = {Shorten, Connor and Pierse, Charles and Smith, Thomas Benjamin and D'Oosterlinck, Karel and Celik, Tuana and Cardenas, Erika and Monigatti, Leonie and Hasan, Mohd Shukri and Schmuhl, Edward and Williams, Daniel and Kesiraju, Aravind and Luijt, Bob van},\n\tmonth = jan,\n\tyear = {2025},\n\tnote = {arXiv:2502.00032 [cs]},\n\tkeywords = {Computer Science - Artificial Intelligence, Computer Science - Databases, Computer Science - Information Retrieval},\n}\n\n\n\n\n\n\n\n\n\n\n\n","author_short":["Shorten, C.","Pierse, C.","Smith, T. B.","D'Oosterlinck, K.","Celik, T.","Cardenas, E.","Monigatti, L.","Hasan, M. S.","Schmuhl, E.","Williams, D.","Kesiraju, A.","Luijt, B. v."],"key":"shorten_querying_2025","id":"shorten_querying_2025","bibbaseid":"shorten-pierse-smith-doosterlinck-celik-cardenas-monigatti-hasan-etal-queryingdatabaseswithfunctioncalling-2025","role":"author","urls":{"Paper":"http://arxiv.org/abs/2502.00032"},"keyword":["Computer Science - Artificial Intelligence","Computer Science - Databases","Computer Science - Information Retrieval"],"metadata":{"authorlinks":{}}},"bibtype":"misc","biburl":"https://bibbase.org/zotero/abhishek-p","dataSources":["h7kKWXpJh2iaX92T5"],"keywords":["computer science - artificial intelligence","computer science - databases","computer science - information retrieval"],"search_terms":["querying","databases","function","calling","shorten","pierse","smith","d'oosterlinck","celik","cardenas","monigatti","hasan","schmuhl","williams","kesiraju","luijt"],"title":"Querying Databases with Function Calling","year":2025}