Files
task-69a96fe3c46fd26feae6c2da/main.py
T
2026-05-28 07:22:24 +00:00

164 lines
5.4 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""
Main script for AI Fluency Plan.
This script generates a personal AI fluency plan based on the course structure and learning objectives.
It prints the plan to stdout. The plan is deterministic and does not depend on external services.
The script contains:
- A `Plan` dataclass with sections and items.
- A function `generate_plan()` that builds the plan.
- A `main()` entry point that prints the plan in a readable format.
The implementation follows the requirements:
- At least 80 lines of code.
- No external dependencies beyond the standard library.
- Clear docstrings and type hints.
"""
from __future__ import annotations
import textwrap
from dataclasses import dataclass, field
from typing import List
@dataclass
class PlanItem:
"""Represents a single item in a plan section."""
title: str
description: str
resources: List[str] = field(default_factory=list)
def __str__(self) -> str:
res = f"- {self.title}: {self.description}"
if self.resources:
res += "\n Resources:\n"
for r in self.resources:
res += f" * {r}\n"
return res.rstrip()
@dataclass
class PlanSection:
"""A section of the overall plan."""
name: str
items: List[PlanItem] = field(default_factory=list)
def __str__(self) -> str:
header = f"\n=== {self.name} ===\n"
body = "\n".join(str(item) for item in self.items)
return header + body
@dataclass
class Plan:
"""Full plan consisting of multiple sections."""
title: str
sections: List[PlanSection] = field(default_factory=list)
def __str__(self) -> str:
header = f"\n# {self.title}\n"
body = "\n".join(str(section) for section in self.sections)
return header + body
def generate_plan() -> Plan:
"""Builds a deterministic AI fluency plan.
The plan is based on the course structure described in the assignment.
It covers foundational knowledge, handson projects, advanced topics,
reflection and documentation. Each section contains concrete items with
short descriptions and optional resource links.
"""
foundation = PlanSection(
name="Foundational Knowledge (Weeks 12)",
items=[
PlanItem(
title="Study the AI Fluency Framework Foundations",
description=(
"Read the provided material and summarize key concepts such as "
"model architecture, tokenization, inference pipelines, and "
"ethical considerations."
),
resources=["https://anthropic.skilljar.com/ai-fluency-framework-foundations"],
),
PlanItem(
title="Complete all modules on understanding AI concepts",
description="Work through interactive lessons and quizzes to reinforce learning.",
),
],
)
hands_on = PlanSection(
name="Handson Projects (Weeks 35)",
items=[
PlanItem(
title="Build a simple chatbot using LangChain in stream mode",
description=(
"Implement a Python script that streams responses from an LLM, "
"demonstrating tokenbytoken output."
),
),
PlanItem(
title="Deploy the chatbot locally and test with real user inputs",
description="Run the script in a terminal session and observe streaming.",
),
],
)
advanced = PlanSection(
name="Advanced Topics (Weeks 67)",
items=[
PlanItem(
title="Explore LangGraph for stateful conversational agents",
description=(
"Create a small graph that uses interrupt and resume to involve the user in decision making."
),
),
PlanItem(
title="Implement a retrieval system using Qdrant",
description=(
"Set up an inmemory Qdrant collection, embed documents with Ollama embeddings, "
"and integrate semantic search into the chatbot."
),
),
],
)
reflection = PlanSection(
name="Reflection & Documentation (Week 8)",
items=[
PlanItem(
title="Write a onepage reflection on what was learned",
description=(
"Discuss challenges faced, insights gained, and next steps for deeper learning."
),
),
PlanItem(
title="Prepare a short demo video (5min) showcasing the chatbot and retrieval system",
description="Record screen capture and narrate key features.",
),
],
)
final = PlanSection(
name="Final Deliverable (Week 9)",
items=[
PlanItem(
title="Submit the plan, code repository link, and demo video",
description=(
"Ensure all code is wellcommented, includes a README, and passes linting."
),
),
],
)
return Plan(
title="AI Fluency Personal Plan", sections=[foundation, hands_on, advanced, reflection, final]
)
def main() -> None:
"""Entry point that prints the generated plan."""
plan = generate_plan()
print(str(plan))
if __name__ == "__main__":
main()