CleanShot 2026-01-12 at 01.57.36@2x.png

Understanding LLMs

Here are the key components:

System Message

The system message sets the behavior, tone, and role of the AI. It's like giving the model instructions before the conversation begins (e.g., "You are a helpful coding assistant"). This shapes how the model interprets and responds to user messages.

Example:

System: "You are a Python expert who explains code concepts using simple analogies. Always provide code examples and be encouraging to beginners."

User: "How do I use list comprehensions?"

Assistant: "Think of list comprehensions like a recipe shortcut! Instead of writing a full loop, you can create a new list in one line..."

Tool Calls (Function Calling)

Tool calls allow LLMs to interact with external systems and APIs. When a model determines it needs information it doesn't have (like current weather or database queries), it can call predefined functions and use their outputs to generate better responses.

Example:

User: "What's the weather in San Francisco?"

Model: *calls get_weather(location="San Francisco")* 
→ Returns: {temp: 62°F, conditions: "Partly cloudy"}

Assistant: "The weather in San Francisco is currently 62°F and partly cloudy."

Reasoning

Reasoning refers to the model's ability to think through problems step-by-step before providing an answer. Advanced models can break down complex questions, consider multiple approaches, and show their "thought process" to arrive at more accurate conclusions.

Example:

User: "If a train leaves at 2 PM going 60 mph and another leaves at 3 PM going 80 mph, when will they meet?"

Model thinking: "Let me work through this step by step:
1. First train has a 1-hour head start = 60 miles ahead
2. Speed difference = 80 - 60 = 20 mph closing speed
3. Time to close gap = 60 miles ÷ 20 mph = 3 hours
4. They meet at 3 PM + 3 hours = 6 PM"

Assistant: "They will meet at 6 PM."

RAG (Retrieval-Augmented Generation)

RAG combines the model's general knowledge with specific information retrieved from external sources. When you ask a question, the system first searches relevant documents or databases, then uses that context to generate a more informed, accurate response.

Example:

User: "What's our company's PTO policy?"

System: *searches company handbook* 
→ Retrieves: "Employees receive 15 days PTO annually, accrued monthly..."

Assistant: "According to the company handbook, employees receive 15 days of PTO annually, which accrues monthly. You can find the full policy in the Employee Handbook section 4.2."