Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a set of Week 1 lab notebook solutions by “Japyh” plus a résumé-based Gradio chatbot example that can log leads / unknown questions to Telegram, backed by a local PDF + summary file for context.
Changes:
- Added Lab 1, Lab 2 (reflection pattern), and Lab 3 (iterative reflection loop) notebooks under
1_foundations/community_contributions/. - Added a Telegram-enabled Lab 4 chatbot notebook under
1_foundations/community_contributions/chatbot_japyh/with supporting profile artifacts (Profile.pdf,summary.txt). - Implemented simple in-notebook RAG via in-memory embeddings over summary + PDF-extracted text.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| 1_foundations/community_contributions/chatbot_japyh/summary.txt | Adds a short profile summary used as chatbot grounding context. |
| 1_foundations/community_contributions/chatbot_japyh/Profile.pdf | Adds the PDF profile document used for extraction/grounding in the chatbot. |
| 1_foundations/community_contributions/chatbot_japyh/4_lab4_with_telegram.ipynb | Implements the Gradio chatbot, Telegram notification helpers, and in-memory embedding search for RAG. |
| 1_foundations/community_contributions/3_lab3_Iterative_Reflection_Loop.ipynb | Adds a lab notebook demonstrating an iterative evaluate→retry reflection loop. |
| 1_foundations/community_contributions/2_lab2_Japyh_Reflection_Pattern.ipynb | Adds a lab notebook demonstrating parallel generation + judge + reflection and re-judge. |
| 1_foundations/community_contributions/1_lab1_Japyh.ipynb | Adds a lab notebook covering basic API setup and simple chained prompting. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+489
to
+493
| " # This is the call to the LLM - see that we pass in the tools json\n", | ||
| " response = openai.chat.completions.create(\n", | ||
| " model=\"gpt-4o-mini\",\n", | ||
| " messages=messages,\n", | ||
| " tools=tools,\n", |
| "source": [ | ||
| "# First create the messages:\n", | ||
| "\n", | ||
| "messages = [{\"role\": \"user\", \"content\": \",Please propose a unique, creative business idea that has a high chance of success. Respond only with the business idea, no explanations.\"}]\n", |
| " f\"Interest level: {interest_level}\\n\"\n", | ||
| " f\"Notes: {notes}\"\n", | ||
| " )\n", | ||
| " send_telegram_message(text)\n", |
Comment on lines
+212
to
+221
| "def record_unknown_question(question, reason=\"insufficient_context\", attempted_answer=\"\"):\n", | ||
| " \"\"\"Record unanswered questions so they can be reviewed later.\"\"\"\n", | ||
| " text = (\n", | ||
| " \"[UNKNOWN QUESTION]\\n\"\n", | ||
| " f\"Question: {question}\\n\"\n", | ||
| " f\"Reason: {reason}\\n\"\n", | ||
| " f\"Attempted answer: {attempted_answer if attempted_answer else 'none'}\"\n", | ||
| " )\n", | ||
| " send_telegram_message(text)\n", | ||
| " return {\"recorded\": \"ok\", \"reason\": reason}\n", |
Comment on lines
+224
to
+233
| "def record_hard_question(question, user_name=\"\", follow_up_needed=True):\n", | ||
| " \"\"\"Escalate difficult questions for manual review via Telegram.\"\"\"\n", | ||
| " text = (\n", | ||
| " \"[HARD QUESTION ESCALATION]\\n\"\n", | ||
| " f\"User: {user_name if user_name else 'unknown'}\\n\"\n", | ||
| " f\"Question: {question}\\n\"\n", | ||
| " f\"Follow-up needed: {str(bool(follow_up_needed))}\"\n", | ||
| " )\n", | ||
| " send_telegram_message(text)\n", | ||
| " return {\"recorded\": \"ok\", \"follow_up_needed\": bool(follow_up_needed)}" |
Comment on lines
+137
to
+138
| " globals()[\"_kb_cache\"] = {\"chunks\": [], \"embeddings\": []}\n", | ||
| " return globals()[\"_kb_cache\"]\n", |
Comment on lines
+372
to
+393
| "def handle_tool_calls(tool_calls):\n", | ||
| " results = []\n", | ||
| " for tool_call in tool_calls:\n", | ||
| " tool_name = tool_call.function.name\n", | ||
| " arguments = json.loads(tool_call.function.arguments)\n", | ||
| " print(f\"Tool called: {tool_name}\", flush=True)\n", | ||
| "\n", | ||
| " # THE BIG IF STATEMENT!!!\n", | ||
| "\n", | ||
| " if tool_name == \"record_user_details\":\n", | ||
| " result = record_user_details(**arguments)\n", | ||
| " elif tool_name == \"record_unknown_question\":\n", | ||
| " result = record_unknown_question(**arguments)\n", | ||
| "\n", | ||
| " results.append(\n", | ||
| " {\n", | ||
| " \"role\": \"tool\",\n", | ||
| " \"content\": json.dumps(result),\n", | ||
| " \"tool_call_id\": tool_call.id,\n", | ||
| " }\n", | ||
| " )\n", | ||
| " return results" |
Comment on lines
+405
to
+413
| "def handle_tool_calls(tool_calls):\n", | ||
| " results = []\n", | ||
| " for tool_call in tool_calls:\n", | ||
| " tool_name = tool_call.function.name\n", | ||
| " arguments = json.loads(tool_call.function.arguments)\n", | ||
| " print(f\"Tool called: {tool_name}\", flush=True)\n", | ||
| " tool = globals().get(tool_name)\n", | ||
| " result = tool(**arguments) if tool else {}\n", | ||
| " results.append(\n", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.