Querying Databases with Function Calling
On the map: LLM agents and tool use → Web, search, and research agents
Abstract (arXiv)
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.
Key facts. Cited by 2 papers in the map (data through 14 Oct 2026). Placed in Web, search, and research agents, one of 16 directions in LLM agents and tool use. Builds on 28 of its 44 references that are in the map. First posted on arXiv 23 Jan 2025.
Builds on
28 of 44 references.
Closest ancestors · 1
Same direction, newest first
- 2024Agentic Information Retrieval13 Oct
Other references · 27
- 2023GPT-4 Technical Reportcited by 18,396
- 2022ReAct: Synergizing Reasoning and Acting in Language Modelscited by 8,695
- 2023Reflexion: Language Agents with Verbal Reinforcement Learningcited by 4,276
- 2024Gemini 1.5: Unlocking multimodal understanding across millions of tokens of contextcited by 3,224
- 2021WebGPT: Browser-assisted question-answering with human feedbackcited by 1,745
- 2023Gorilla: Large Language Model Connected with Massive APIscited by 1,332
- 2023DSPy: Compiling Declarative Language Model Calls into Self-Improving Pipelinescited by 832
- 2017Seq2SQL: Generating Structured Queries from Natural Language using Reinforcement Learningcited by 687
- 2022Demonstrate-Search-Predict: Composing retrieval and language models for knowledge-intensive NLPcited by 318
- 2024Optimizing Instructions and Demonstrations for Multi-Stage Language Model Programscited by 291
- 2024Spider 2.0: Evaluating Language Models on Real-World Enterprise Text-to-SQL Workflowscited by 232
- 2023Efficient Guided Generation for Large Language Modelscited by 200
15 more
- 2024Next-Generation Database Interfaces: A Survey of LLM-based Text-to-SQLcited by 120
- 2024Code Generation with AlphaCodium: From Prompt Engineering to Flow Engineeringcited by 103
- 2024Let Me Speak Freely? A Study on the Impact of Format Restrictions on Performance of Large Language Modelscited by 96
- 2024AvaTaR: Optimizing LLM Agents for Tool Usage via Contrastive Reasoningcited by 72
- 2024STaRK: Benchmarking LLM Retrieval on Textual and Relational Knowledge Basescited by 55
- 2024Anchored Preference Optimization and Contrastive Revisions: Addressing Underspecification in Alignmentcited by 46
- 2024Semantic Operators: A Declarative Model for Rich, AI-based Data Processingcited by 34
- 2024Text2SQL is Not Enough: Unifying AI and Databases with TAGcited by 34
- 2023DSPy Assertions: Computational Constraints for Self-Refining Language Model Pipelinescited by 27
- 2024GoEX: Perspectives and Designs Towards a Runtime for Autonomous LLM Applicationscited by 23
- 2024StructuredRAG: JSON Response Formatting with Large Language Modelscited by 22
- 2024SPADE: Synthesizing Data Quality Assertions for Large Language Model Pipelinescited by 19
- 2024Specifications: The missing link to making the development of LLM systems an engineering disciplinecited by 17
- 2023SUQL: Conversational Search over Structured and Unstructured Data with Large Language Modelscited by 13
- 2024Networks of Networks: Complexity Class Principles Applied to Compound AI Systems Designcited by 13
Built on by
Citing papers per year: 2026: 2.
2 papers.
Similar, not cited
Close in wording, no citation either way
- 2023DB-GPT: Empowering Database Interactions with Private Large Language Models
- 2025Play by the Type Rules: Inferring Constraints for LLM Functions in Declarative Programs
- 2026GenDB: The Next Generation of Query Processing -- Synthesized, Not Engineered
- 2024From Natural Language to SQL: Review of LLM-based Text-to-SQL Systems
- 2024LLM-PQA: LLM-enhanced Prediction Query Answering
- 2024Towards Evaluating Large Language Models for Graph Query Generation
- 2025Integrating External Tools with Large Language Models to Improve Accuracy
- 2024Is Large Language Model Good at Database Knob Tuning? A Comprehensive Experimental Evaluation