Ai Engineering Core / Sales Boucher Project

Notebook vs Production Approach

πŸ” Iteration is Essential

When AI output doesn't match expectations:

❌ Don't immediately change the code
βœ… First improve the prompt

πŸ“€ Generate Output
       ↓
πŸ” Evaluate Result
       ↓
✏️ Adjust Prompt
       ↓
πŸ”„ Generate Again
       ↓
πŸ” Repeat until satisfied

🎯 Prompt iteration is one of the most important skills when building AI applications!


πŸ§ͺ Notebook vs Production Development

πŸ““ Notebook Style β€” "Data Scientist Mode" πŸ”¬

In notebooks, we act as experimenters, not engineers. Variables are defined globally and freely overridden as we iterate:

# Define it...
SYSTEM_PROMPT = "You are a helpful assistant."

# Didn't like it? Just overwrite it! πŸ”„
SYSTEM_PROMPT = "You are a funny assistant."

# Still not right? Override again! πŸ”„
SYSTEM_PROMPT = "You are a pirate assistant. Arrr! πŸ΄β€β˜ οΈ"

🧠 As a data scientist, you're exploring and experimenting β€” the goal is to find what works, not to write clean code. Global variables are a shortcut that makes iteration fast and frictionless.

βœ… Great for...

⚑ Fast experimentation

πŸ§ͺ Rapid prompt testing

✏️ Quick tweaks without restructuring

🏭 Production Style β€” "Software Engineer Mode" πŸ‘·

As a software developer, overriding global variables is a red flag 🚩. Instead, everything is structured, controlled, and reusable:

# βœ… Prompts live inside functions/classes β€” never floating globally
class BrochureGenerator:
    def __init__(self, system_prompt: str):
        self.system_prompt = system_prompt  # injected, not hardcoded

    def generate(self, company_name: str, url: str):
        ...

Pattern

Purpose

🧱 Classes

Organize logic cleanly

πŸ”§ Functions

Reusable, testable code

πŸ’‰ Dependency Injection

Pass prompts in β€” don't hardcode them

βš™οΈ Config Management

Manage prompts & settings from one place


πŸ“‘ Streaming Protocols

Generated tokens reach the user instantly using technologies like:

Technology

Use Case

πŸ“¨ Server-Sent Events (SSE)

Most common for AI streaming

🌊 Streaming HTTP

Simple, efficient token delivery

πŸ”Œ WebSockets

Real-time, two-way applications

⚑ These technologies ensure tokens appear on screen immediately as they're generated β€” no waiting for the full response!