ChatGPT programming hack December

ChatGPT hack

Real-world usage

Adding for real-world usage makes ChatGPT produce a much better, sophisticated output.

Compare the two code snippets below with and without for real-world usage.

Define the Sprint model, which includes attributes like sprint ID, name, start date, end date, and goals.

ChatGPT:
from typing import Optional, List
from pydantic import BaseModel

class Sprint(BaseModel):
    id: str
    name: str
    startDate: str
    endDate: str
    goals: Optional[List[str]] = None

Define the Sprint model, which includes attributes like sprint ID, name, start date, end date, and goals according to recommendations for real-world usage.

ChatGPT:
from typing import Optional, List
from pydantic import BaseModel, Field
from datetime import datetime

class Sprint(BaseModel):
    id: str = Field(..., description="Unique identifier for the sprint")
    name: str = Field(..., description="Name of the sprint")
    startDate: datetime = Field(..., description="Start date of the sprint")
    endDate: datetime = Field(..., description="End date of the sprint")
    goals: Optional[List[str]] = Field(None, description="List of sprint goals")