AI & LLM Engineering for .NET Architects
Lesson 27 of 30 90% of course

Function Calling: Letting the LLM use your SQL and API tools

17 · 8 min · 5/23/2026

Sign in to track progress and bookmarks.

Mastering Function Calling

Function calling is the bridge between the Imagination of the LLM and the Reality of your computer. It allows the AI to execute real C# code and interact with the real world.

1. Semantic Description as API

In function calling, the 'API' is the description you write for your methods. If you describe a function as "Cancels a subscription based on user ID," the LLM will provide the `userId` and call that function whenever a user says "I want to quit."

2. Parallel Function Calling

Modern models can call multiple functions at once. If a user asks "What's the weather in London and Paris?", the AI will return TWO function calls in a single response, allowing your C# app to fetch both results in parallel for maximum speed.

3. Security: The Sandbox Requirement

Never let an LLM write and execute raw SQL. Instead, give it a function like `SearchCustomers(string name)`. The C# code inside that function should use parameterized queries and strict RBAC to ensure the AI cannot perform a 'Prompt Injection' on your database.

4. Interview Mastery

Q: "What is 'Few-shot Function Calling'?"

Architect Answer: "Sometimes the AI gets the parameters wrong. Few-shot function calling is when you provide examples of *previous* correctly formatted function calls in the prompt history. This 'Trains' the model on how to correctly map complex user requests to your specific C# method signatures, reducing errors by 70%."

Test your knowledge

Quizzes linked to this course—pass to earn certificates.

Browse all quizzes
AI & LLM Engineering for .NET Architects

On this page

1. Semantic Description as API 2. Parallel Function Calling 3. Security: The Sandbox Requirement 4. Interview Mastery
1. AI Foundations & Prompt Engineering
The LLM Landscape: Transformers, Attention, and Tokens Advanced Prompt Engineering: Few-shot, Chain-of-Thought, and ReAct Prompt Versioning & Management in Production LLM Cost Estimation: Token accounting and budget strategies
2. Semantic Kernel & Integration
Introduction to Microsoft Semantic Kernel (SK) Skills & Plugins: Extending the LLM with native C# functions Planner & Orchestration: Automating complex multi-step AI tasks Connectors: Switching between OpenAI, Azure OpenAI, and HuggingFace
3. Vector Databases & RAG
The RAG Pattern: Solving the 'Static Knowledge' problem Embeddings Deep Dive: Converting text to math Vector DBs: Azure AI Search vs Pinecode vs Milvus Hybrid Search: Combining Keyword and Semantic search for accuracy
4. Advanced RAG Techniques
Document Chunking Strategies: Overlap, Slidewindow, and Semantic splitting Recursive Document Processing for massive knowledge bases Context Window Management: Summarization vs Truncation Citations & Grounding: Ensuring the AI doesn't hallucinate
5. AI Safety & Guardrails
Content Moderation: Azure AI Content Safety integration Prompt Injection: Defending against adversarial attacks Punitiveness & Bias: Evaluating and mitigating model behavior Self-Correction Patterns: Letting the AI check its own work
6. Small Language Models (SLMs) & Local AI
The rise of SLMs: Phi-3, Llama-3-8B, and Mistral Running AI Locally with ONNX and LocalLLM Quantization: Running 70B models on 16GB RAM Edge AI: Deploying models to local devices and private clouds
7. Multimodal & Agentic AI
Multimodal AI: Processing Images, PDFs, and Audio in C# Agentic Workflows: Multi-agent collaboration with AutoGen Function Calling: Letting the LLM use your SQL and API tools Memory Management: Ephemeral vs Long-term Semantic memory
8. FAANG AI Engineer Interview
Case Study: Designing a Global Enterprise AI Knowledge Assistant Case Study: Building an Autonomous AI Agent for Software Dev