"""All mock responses and content for the NotebookLM prototype.""" import random import time import uuid from datetime import datetime from state import Artifact # ── Chat Mock Responses ────────────────────────────────────────────────────── MOCK_RESPONSES = [ { "content": ( "Based on the uploaded sources, the key concept revolves around " "the relationship between the variables discussed in Chapter 3. " "The author emphasizes that understanding this foundation is critical " "before moving to advanced topics." ), "citations": [ {"source": "lecture_notes.pdf", "page": 3, "text": "the relationship between variables..."}, {"source": "textbook_ch3.pdf", "page": 42, "text": "understanding this foundation..."}, ], }, { "content": ( "The sources indicate three main approaches to this problem:\n\n" "1. **Direct method** — Apply the formula from Section 2.1\n" "2. **Iterative approach** — Build up from base cases\n" "3. **Approximation** — Use the simplified model when precision isn't critical\n\n" "The textbook recommends starting with the direct method for beginners." ), "citations": [ {"source": "textbook_ch2.pdf", "page": 15, "text": "direct method... apply the formula"}, ], }, { "content": ( "I couldn't find specific information about that topic in your " "uploaded sources. Try uploading additional materials that cover this " "subject, or rephrase your question to relate more closely to the " "content in your current sources." ), "citations": [], }, { "content": ( "Great question! According to the lecture slides, this concept " "was introduced in Week 5. The key takeaway is that the process involves " "three stages: **initialization**, **processing**, and **validation**. " "Each stage has specific requirements that must be met before proceeding." ), "citations": [ {"source": "week5_slides.pptx", "page": 8, "text": "three stages: initialization..."}, {"source": "week5_slides.pptx", "page": 12, "text": "specific requirements..."}, ], }, ] def get_mock_response(query: str) -> dict: time.sleep(1.2) return random.choice(MOCK_RESPONSES) # ── Artifact Mock Content ──────────────────────────────────────────────────── MOCK_CONVERSATION_SUMMARY = { "brief": """## Conversation Summary (Brief) **Topics Discussed:** - Relationship between core variables from Chapter 3 - Three problem-solving methodologies and when to use each - The three-stage process (initialization → processing → validation) **Key Questions Asked:** - What are the main approaches to the problem? → Three methods identified - How do the lecture notes differ from the textbook? → Application vs. theory **Unresolved:** No questions remain open from the conversation. """, "detailed": """## Conversation Summary (Detailed) ### Discussion Flow The conversation covered 4 main exchanges exploring the source material. ### Topics Explored 1. **Core Concepts (Q1-Q2):** User asked about the foundational relationship between variables. The AI identified Chapter 3 as the primary source and highlighted it as a prerequisite for advanced topics. 2. **Methodology Comparison (Q3):** User inquired about different problem-solving approaches. Three methods were identified — direct, iterative, and approximation — with trade-offs explained for each. 3. **Process Stages (Q4):** Discussion about the three-stage process introduced in Week 5 lectures: initialization, processing, and validation. ### Key Insights from Chat - The direct method is recommended as the starting point for beginners - Lecture notes and textbook provide complementary perspectives - Each stage has specific requirements that must be met before proceeding ### Citations Used | Source | Times Referenced | |--------|----------------| | textbook_ch3.pdf | 3 | | lecture_notes.pdf | 2 | | week5_slides.pptx | 2 | | textbook_ch2.pdf | 1 | """, } MOCK_DOCUMENT_SUMMARY = { "brief": """## Document Summary (Brief) **Core Theme:** The sources examine the relationship between key variables and present multiple problem-solving methodologies. **Key Takeaways:** - Three approaches exist: direct method, iterative approach, and approximation - The direct method provides exact results but requires complete data - A three-stage process (initialization → processing → validation) underpins the framework - Lecture materials focus on application; textbook provides theoretical depth **Bottom Line:** Master the direct method first, then explore alternatives as complexity increases. """, "detailed": """## Document Summary (Detailed) ### 1. Foundational Framework The sources establish a foundational framework centered on the relationship between core variables discussed primarily in Chapter 3. The author emphasizes that a thorough understanding of this relationship is a prerequisite before advancing to more complex topics. The framework operates through a three-stage process: - **Initialization** — Setting up parameters and base conditions - **Processing** — Executing the core computational logic - **Validation** — Verifying outputs meet confidence thresholds ### 2. Methodological Approaches Three distinct methodological approaches are presented across the sources: | Method | Best For | Trade-off | |--------|----------|-----------| | **Direct** | Complete datasets, exact results needed | Requires full data availability | | **Iterative** | Incomplete data, convergent solutions | Multiple passes, slower | | **Approximation** | Quick estimates, non-critical precision | Sacrifices accuracy for speed | The textbook (Section 2.1) recommends beginners start with the direct method, as it builds intuition for how the formula maps inputs to outputs. ### 3. Cross-Source Analysis The lecture notes (Week 5) and textbook chapters approach the same material from complementary angles: - **Lectures** — Emphasize practical application with worked examples - **Textbook** — Provides theoretical depth, proofs, and edge cases - **Slides** — Offer visual summaries and quick-reference diagrams ### 4. Key Definitions - **Confidence threshold** — The minimum acceptable level of certainty for a result - **Convergence** — The point at which iterative refinements produce negligible improvement - **Base case** — The simplest instance of a problem used as a starting point ### 5. Conclusion Mastering these fundamentals is essential before proceeding to advanced modules. The recommended learning path is: direct method → iterative approach → approximation, building complexity gradually. """, } MOCK_PODCAST_SCRIPT = """## Podcast: Deep Dive Study Session **Alex:** Hey everyone, welcome back to another deep dive study session! I'm Alex, and I'm here with Sam. Today we've got some really meaty material to break down. Sam, I read through the summary and honestly, there's a lot going on. Where do we even start? **Sam:** Right, so let's zoom out first. The big picture here is about problem-solving methodology — specifically, the idea that there isn't just one way to solve a problem. The sources lay out three distinct approaches, and understanding when to use which one is really the meta-skill they're teaching. **Alex:** Okay, three approaches. Let's go through them one by one? **Sam:** Absolutely. So the first one is called the **direct method**. Think of it like having a recipe where you know all the ingredients and all the steps. You plug your values into the formula, follow the steps, and you get your exact answer. Clean, precise, done. **Alex:** That sounds like the dream scenario. Why doesn't everyone just use that all the time? **Sam:** Great question — and this is where it gets interesting. The direct method has a strict requirement: you need *complete* data. Every single input has to be known. In academic exercises, sure, they give you everything. But in the real world? You're often working with gaps, estimates, or noisy data. **Alex:** Ah, so that's where the second approach comes in? **Sam:** Exactly — the **iterative approach**. Instead of solving it in one shot, you start with your best guess and then keep refining. Each pass gets you closer to the real answer. It's like sculptors — you start with a rough block and keep chipping away until it looks right. **Alex:** I love that analogy. So how do you know when to stop iterating? **Sam:** That's actually one of the key concepts — **convergence**. You stop when the difference between iterations becomes so small that it's negligible. The sources define a confidence threshold, and once you're within that threshold, you're done. **Alex:** Makes sense. And the third method? **Sam:** **Approximation**. This one is all about pragmatism. Sometimes you don't need five decimal places of precision. You just need a ballpark. Is this going to cost us $100 or $10,000? The approximation method gives you that answer fast, at the cost of some accuracy. **Alex:** So it's really about matching your tool to the job. **Sam:** Exactly right. And that's actually what the sources are trying to teach. It's not just "here are three formulas." It's "here's how to think about which tool fits which situation." That metacognitive skill is what separates a good problem-solver from someone who just memorizes formulas. **Alex:** One thing I noticed in the summary was this three-stage process — initialization, processing, validation. How does that fit in? **Sam:** Good catch. That process applies to *all three* methods. Regardless of which approach you choose, you always: set up your initial conditions, run the computation, and then validate your results. It's like a universal wrapper around any problem-solving method. **Alex:** That's a really clean mental model. I wish my professors had explained it that way. **Sam:** Ha! Well, that's what the lecture notes try to do — they focus on practical application. The textbook goes deeper into the theory and proofs, but the lectures are where you get the worked examples and intuition. **Alex:** Alright, I think that's a solid overview. Any final advice for students studying this material? **Sam:** Start with the direct method. Get really comfortable with it. Once you feel solid, move to iterative, then approximation. Don't try to learn all three at once — build up gradually. And always check your work with that validation step. **Alex:** Brilliant advice. Thanks Sam, and thanks everyone for listening. Until next time — keep studying smart, not just hard! """ MOCK_QUIZ = { 5: """## Practice Quiz (5 Questions) ### Question 1 What is the primary advantage of the direct method? - A) It works with incomplete data - B) It provides exact results in a single pass - C) It is the fastest method - D) It requires no validation **Answer: B** **Explanation:** The direct method applies the formula once to produce exact results, unlike iterative methods that require multiple passes. --- ### Question 2 Which stage comes immediately after initialization in the three-stage process? - A) Validation - B) Optimization - C) Processing - D) Calibration **Answer: C** **Explanation:** The three stages are: initialization → processing → validation. --- ### Question 3 When should the approximation method be preferred? - A) When working with critical systems - B) When precision is not the primary concern - C) When the dataset is very small - D) When the direct method fails **Answer: B** **Explanation:** Approximation trades precision for speed, ideal when exact results aren't required. --- ### Question 4 What does "convergence" refer to in the iterative approach? - A) The point where the algorithm starts - B) When iterations produce negligible differences - C) The final validation step - D) Combining multiple methods together **Answer: B** **Explanation:** Convergence is reached when successive iterations produce results so close together that further refinement is unnecessary. --- ### Question 5 What is the recommended learning order for the three methods? - A) Approximation → Iterative → Direct - B) Iterative → Direct → Approximation - C) Direct → Iterative → Approximation - D) Any order is equally effective **Answer: C** **Explanation:** The textbook recommends starting with the direct method to build intuition, then progressing to iterative and approximation. """, 10: """## Practice Quiz (10 Questions) ### Question 1 What is the primary advantage of the direct method? - A) It works with incomplete data - B) It provides exact results in a single pass - C) It is the fastest method - D) It requires no validation **Answer: B** --- ### Question 2 Which stage comes immediately after initialization? - A) Validation - B) Optimization - C) Processing - D) Calibration **Answer: C** --- ### Question 3 When should the approximation method be preferred? - A) When working with critical systems - B) When precision is not the primary concern - C) When the dataset is very small - D) When the direct method fails **Answer: B** --- ### Question 4 What does "convergence" mean in the iterative approach? - A) The point where the algorithm starts - B) When iterations produce negligible differences - C) The final validation step - D) Combining multiple methods **Answer: B** --- ### Question 5 What is the recommended learning order? - A) Approximation → Iterative → Direct - B) Iterative → Direct → Approximation - C) Direct → Iterative → Approximation - D) Any order is fine **Answer: C** --- ### Question 6 What does the direct method require? - A) Multiple iterations - B) Complete data - C) A confidence threshold - D) An initial estimate **Answer: B** --- ### Question 7 What is a "confidence threshold"? - A) How sure you are about your method choice - B) The minimum acceptable certainty for a result - C) The maximum number of iterations - D) The accuracy of the approximation method **Answer: B** --- ### Question 8 How do lecture notes differ from the textbook? - A) Lectures focus on theory, textbook on application - B) Lectures focus on application, textbook on theory - C) They cover different topics entirely - D) There is no significant difference **Answer: B** --- ### Question 9 What is a "base case" in this context? - A) The most complex problem instance - B) The simplest problem instance used as a starting point - C) The final validated result - D) A failed iteration **Answer: B** --- ### Question 10 The three-stage process applies to which methods? - A) Only the direct method - B) Only the iterative method - C) Direct and iterative only - D) All three methods **Answer: D** """, } def generate_mock_artifact(artifact_type: str, **kwargs) -> Artifact: time.sleep(1.5) if artifact_type == "conversation_summary": style = kwargs.get("style", "detailed") content = MOCK_CONVERSATION_SUMMARY.get(style, MOCK_CONVERSATION_SUMMARY["detailed"]) title = f"Conversation Summary ({'Brief' if style == 'brief' else 'Detailed'})" elif artifact_type == "document_summary": style = kwargs.get("style", "detailed") content = MOCK_DOCUMENT_SUMMARY.get(style, MOCK_DOCUMENT_SUMMARY["detailed"]) title = f"Document Summary ({'Brief' if style == 'brief' else 'Detailed'})" elif artifact_type == "podcast": content = MOCK_PODCAST_SCRIPT title = "Podcast Episode" elif artifact_type == "quiz": num_q = kwargs.get("num_questions", 5) content = MOCK_QUIZ.get(num_q, MOCK_QUIZ[5]) title = f"Practice Quiz ({num_q}Q)" else: content = "" title = artifact_type return Artifact( id=str(uuid.uuid4()), type=artifact_type, title=title, content=content, audio_path=None, created_at=datetime.now().isoformat(), )