# Day 5 - Jan 25 2026

#### 1. The Anatomy of an LLM Call

When we talk to an AI via code, we aren't just sending text; we are constructing a Payload.

* Model: Specifies which "brain" to use (e.g., `llama3.2`, `gpt-4`).
* Messages: A list of dictionaries representing the conversation history.
  * `role: "user"` → My input.
  * `role: "assistant"` → The AI's previous answers.
  * `role: "system"` → Instructions on how the AI should behave (we will cover this tomorrow).

#### 2. The Response Object

The AI doesn't just return a string. It returns a JSON Object containing:

* `model`: The name of the model used.
* `created_at`: Timestamp.
* `message`: The actual content (this is what we extract).
* `done`: Boolean status.

#### 3. Why Local (Ollama)?

I chose to use Ollama for this stage because:

* Zero Latency: No internet lag.
* Zero Cost: I can test a loop of 100 calls without paying $0.01.
* Privacy: My prompts (which might eventually contain private data) never leave my machine.

#### Status:

* [x] SDK Installed (`pip install ollama`)
* [x] Python Script `day5_llm_call.py` Created
* [x] Successful Response Received


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://shankar-lab.gitbook.io/mylearning/15-days-genai-learning-challenge/day-5-jan-25-2026.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
