{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Welcome to the Second Lab - Week 1, Day 3\n", "\n", "Today we will work with lots of models! This is a way to get comfortable with APIs." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", " \n", " \n", " \n", " \n", "
\n", " \n", " \n", "

Important point - please read

\n", " The way I collaborate with you may be different to other courses you've taken. I prefer not to type code while you watch. Rather, I execute Jupyter Labs, like this, and give you an intuition for what's going on. My suggestion is that you carefully execute this yourself, after watching the lecture. Add print statements to understand what's going on, and then come up with your own variations.

If you have time, I'd love it if you submit a PR for changes in the community_contributions folder - instructions in the resources. Also, if you have a Github account, use this to showcase your variations. Not only is this essential practice, but it demonstrates your skills to others, including perhaps future clients or employers...\n", "
\n", "
" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "# Start with imports - ask ChatGPT to explain any package that you don't know\n", "\n", "import os\n", "import json\n", "from dotenv import load_dotenv\n", "from openai import OpenAI\n", "from anthropic import Anthropic\n", "from IPython.display import Markdown, display" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "True" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Always remember to do this!\n", "load_dotenv(override=True)" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "OpenAI API Key not set\n", "Anthropic API Key not set (and this is optional)\n", "Google API Key exists and begins AI\n", "DeepSeek API Key not set (and this is optional)\n", "Groq API Key not set (and this is optional)\n" ] } ], "source": [ "# Print the key prefixes to help with any debugging\n", "\n", "openai_api_key = os.getenv('OPENAI_API_KEY')\n", "anthropic_api_key = os.getenv('ANTHROPIC_API_KEY')\n", "google_api_key = os.getenv('GOOGLE_API_KEY')\n", "deepseek_api_key = os.getenv('DEEPSEEK_API_KEY')\n", "groq_api_key = os.getenv('GROQ_API_KEY')\n", "\n", "if openai_api_key:\n", " print(f\"OpenAI API Key exists and begins {openai_api_key[:8]}\")\n", "else:\n", " print(\"OpenAI API Key not set\")\n", " \n", "if anthropic_api_key:\n", " print(f\"Anthropic API Key exists and begins {anthropic_api_key[:7]}\")\n", "else:\n", " print(\"Anthropic API Key not set (and this is optional)\")\n", "\n", "if google_api_key:\n", " print(f\"Google API Key exists and begins {google_api_key[:2]}\")\n", "else:\n", " print(\"Google API Key not set (and this is optional)\")\n", "\n", "if deepseek_api_key:\n", " print(f\"DeepSeek API Key exists and begins {deepseek_api_key[:3]}\")\n", "else:\n", " print(\"DeepSeek API Key not set (and this is optional)\")\n", "\n", "if groq_api_key:\n", " print(f\"Groq API Key exists and begins {groq_api_key[:4]}\")\n", "else:\n", " print(\"Groq API Key not set (and this is optional)\")" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "request = \"Please come up with a challenging, nuanced question that I can ask a number of LLMs to evaluate their intelligence. \"\n", "request += \"Answer only with the question, no explanation.\"\n", "messages = [{\"role\": \"user\", \"content\": request}]" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[{'role': 'user',\n", " 'content': 'Please come up with a challenging, nuanced question that I can ask a number of LLMs to evaluate their intelligence. Answer only with the question, no explanation.'}]" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "messages" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Consider a hypothetical world where the dominant species communicates solely through complex olfactory signals. Describe a scenario where a misunderstanding in this olfactory communication leads to a significant socio-political shift. Detail the specific olfactory signals involved, the misinterpretation, and the resulting consequences, ensuring the scenario's plausibility within the constraints of olfactory communication as we understand it biologically and chemically.\n", "\n" ] } ], "source": [ "# openai = OpenAI()\n", "# response = openai.chat.completions.create(\n", "# model=\"gpt-5-mini\",\n", "# messages=messages,\n", "# )\n", "# question = response.choices[0].message.content\n", "# print(question)\n", "\n", "# GEMINI_BASE_URL = \"https://generativelanguage.googleapis.com/v1beta/openai/\"\n", "# google_api_key = os.getenv(\"GOOGLE_API_KEY\")\n", "# gemini = OpenAI(base_url=GEMINI_BASE_URL, api_key=google_api_key)\n", "# response = gemini.chat.completions.create(model=\"gemini-2.0-flash\", messages=messages)\n", " \n", "# question = response.choices[0].message.content\n", "# print(question)\n", "\n", "import os\n", "import time\n", "from openai import OpenAI\n", "\n", "GEMINI_BASE_URL = \"https://generativelanguage.googleapis.com/v1beta/openai/\"\n", "google_api_key = os.getenv(\"GOOGLE_API_KEY\")\n", "\n", "gemini = OpenAI(base_url=GEMINI_BASE_URL, api_key=google_api_key)\n", "\n", "def gemini_safe_request(messages):\n", " retries = 5\n", " for i in range(retries):\n", " try:\n", " return gemini.chat.completions.create(\n", " model=\"gemini-2.0-flash\",\n", " messages=messages\n", " )\n", " except Exception as e:\n", " if \"429\" in str(e):\n", " wait = (2 ** i)\n", " print(f\"⚠️ Rate limit hit. Retrying in {wait} seconds...\")\n", " time.sleep(wait)\n", " else:\n", " raise e\n", " raise Exception(\"❌ Max retries reached. Try again later.\")\n", "\n", "# --- CALL IT ---\n", "response = gemini_safe_request(messages)\n", "question = response.choices[0].message.content\n", "print(question)\n" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [], "source": [ "competitors = []\n", "answers = []\n", "messages = [{\"role\": \"user\", \"content\": question}]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Note - update since the videos\n", "\n", "I've updated the model names to use the latest models below, like GPT 5 and Claude Sonnet 4.5. It's worth noting that these models can be quite slow - like 1-2 minutes - but they do a great job! Feel free to switch them for faster models if you'd prefer, like the ones I use in the video." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# The API we know well\n", "# I've updated this with the latest model, but it can take some time because it likes to think!\n", "# Replace the model with gpt-4.1-mini if you'd prefer not to wait 1-2 mins\n", "\n", "model_name = \"gpt-5-nano\"\n", "\n", "response = openai.chat.completions.create(model=model_name, messages=messages)\n", "answer = response.choices[0].message.content\n", "\n", "display(Markdown(answer))\n", "competitors.append(model_name)\n", "answers.append(answer)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Anthropic has a slightly different API, and Max Tokens is required\n", "\n", "model_name = \"claude-sonnet-4-5\"\n", "\n", "claude = Anthropic()\n", "response = claude.messages.create(model=model_name, messages=messages, max_tokens=1000)\n", "answer = response.content[0].text\n", "\n", "display(Markdown(answer))\n", "competitors.append(model_name)\n", "answers.append(answer)" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/markdown": [ "## The Great Scented Schism of Xylos\n", "\n", "On Xylos, a planet bathed in perpetual twilight, the sentient Xylosians communicated entirely through complex pheromonal blends released from specialized scent glands located around their antennae. These blends, ranging from simple expressions of mood to intricate philosophical arguments, were as nuanced and powerful as any spoken language. Political power, social status, and even romantic entanglements all hinged on the correct emission and interpretation of these olfactory pronouncements.\n", "\n", "The Xylosian society was divided into two main factions: the **Chrysalis Collective**, who advocated for introspective contemplation and the preservation of ancient Xylosian traditions, and the **Bloom Brigade**, a more progressive group pushing for exploration and technological advancement. Tensions between the two were always simmering, but a catastrophic misunderstanding, dubbed the “Scented Schism,” pushed them over the edge.\n", "\n", "**The Scenario:**\n", "\n", "The catalyst was a public debate between the revered Elder Lumina, a prominent Chrysalis Collective member, and the charismatic young scientist, Zephyr, a rising star in the Bloom Brigade. Elder Lumina, known for her calm and measured olfactory pronouncements, intended to broadcast a nuanced critique of the Bloom Brigade's relentless pursuit of new technologies. Her carefully crafted scent blend was meant to convey: \"Progress without introspection is akin to a blossom severed from its roots – beautiful, but fleeting and ultimately unsustainable.\"\n", "\n", "The crucial elements of Lumina's intended message were:\n", "\n", "* **Base Note (Longevity):** A complex mixture of slowly-releasing phenols and esters, normally signifying deep respect for the past and continuity. In this case, meant to represent the \"roots.\"\n", "* **Mid Note (Fragility):** A rapidly dissipating blend of light aldehydes and ketones, typically associated with vulnerability and fleeting beauty. In this case, representing the \"blossom.\"\n", "* **Top Note (Severance):** A sharp, pungent compound containing high concentrations of methylpropanethiol, usually used to indicate a painful separation or loss. In this case, representing the \"severed\" connection.\n", "* **Contextual Scent Modifier (Caution):** A slight shimmer of terpenes emitted subtly around the entire blend, meant to soften the impact and convey caution rather than outright condemnation.\n", "\n", "However, a freak weather event, a sudden surge of subterranean methane released near Lumina’s broadcasting platform, subtly altered the chemical composition of her scent blend. Methane is a highly reactive gas that, in Xylos’s atmosphere, acted as a catalyst, accelerating the dissipation rate of the terpenes responsible for the \"Caution\" modifier. It also caused a partial oxidation of some of the slower-releasing phenols and esters in the base note, creating small amounts of acrid carboxylic acids.\n", "\n", "**The Misinterpretation:**\n", "\n", "As Lumina broadcast her intended critique, the audience, heavily composed of Bloom Brigade members eager to hear Zephyr’s rebuttal, perceived a drastically different message. Due to the lack of the \"Caution\" modifier, the \"Severance\" note was amplified, coming across as overtly hostile. The modified base note, now tinged with acidic undertones, registered as aggressive disapproval and a rejection of the Bloom Brigade’s foundations.\n", "\n", "The interpreted message was something closer to: \"Your so-called progress is a superficial and short-lived distraction, brutally ripped from its source. Your existence is a noxious insult to our traditions.\"\n", "\n", "**The Consequences:**\n", "\n", "The perceived aggression in Lumina's scent blend ignited immediate outrage within the Bloom Brigade ranks. Zephyr, fueled by the misunderstanding and his own simmering resentment of the Collective's perceived obstructionism, responded with an equally potent and inflammatory olfactory counter-argument. He released a blend composed of artificially synthesized pheromones that bypassed the natural Xylosian communication pathways and directly stimulated feelings of anger and defiance.\n", "\n", "The incident rapidly escalated. Emboldened by Zephyr's counter-broadcast, Bloom Brigade members began engaging in widespread scent-bombing, releasing disruptive and aggressive pheromonal blends in areas traditionally controlled by the Chrysalis Collective. The Collective responded in kind, deploying ancient, meticulously preserved scent blends designed to induce paralysis and fear.\n", "\n", "Xylos plunged into what became known as the \"Scent Wars.\" The misunderstanding stemming from the altered scent blend had effectively shattered the delicate olfactory equilibrium of their society. Trade routes were disrupted as members of each faction refused to be near the other's scent territory. Political alliances dissolved, and previously peaceful communities fractured along scent-based lines.\n", "\n", "The conflict continued for generations, resulting in a permanent division of Xylosian society. The Bloom Brigade, fueled by their access to advanced chemical synthesis techniques, eventually migrated to the resource-rich but previously uninhabitable highlands, leaving the Chrysalis Collective to cling to their traditional ways in the lowlands.\n", "\n", "The Great Scented Schism of Xylos serves as a stark reminder that even the most sophisticated forms of communication can be vulnerable to the unpredictable forces of nature and the inherent fallibility of interpretation, especially when those interpretations are based on the inherently subjective experience of scent. The Xylosian story highlights the complex interplay between biology, environment, and social structures, demonstrating how a single olfactory miscommunication can irrevocably alter the course of an entire civilization.\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "gemini = OpenAI(api_key=google_api_key, base_url=\"https://generativelanguage.googleapis.com/v1beta/openai/\")\n", "model_name = \"gemini-2.0-flash\"\n", "\n", "response = gemini.chat.completions.create(model=model_name, messages=messages)\n", "answer = response.choices[0].message.content\n", "\n", "display(Markdown(answer))\n", "competitors.append(model_name)\n", "answers.append(answer)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "deepseek = OpenAI(api_key=deepseek_api_key, base_url=\"https://api.deepseek.com/v1\")\n", "model_name = \"deepseek-chat\"\n", "\n", "response = deepseek.chat.completions.create(model=model_name, messages=messages)\n", "answer = response.choices[0].message.content\n", "\n", "display(Markdown(answer))\n", "competitors.append(model_name)\n", "answers.append(answer)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Updated with the latest Open Source model from OpenAI\n", "\n", "groq = OpenAI(api_key=groq_api_key, base_url=\"https://api.groq.com/openai/v1\")\n", "model_name = \"openai/gpt-oss-120b\"\n", "\n", "response = groq.chat.completions.create(model=model_name, messages=messages)\n", "answer = response.choices[0].message.content\n", "\n", "display(Markdown(answer))\n", "competitors.append(model_name)\n", "answers.append(answer)\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## For the next cell, we will use Ollama\n", "\n", "Ollama runs a local web service that gives an OpenAI compatible endpoint, \n", "and runs models locally using high performance C++ code.\n", "\n", "If you don't have Ollama, install it here by visiting https://ollama.com then pressing Download and following the instructions.\n", "\n", "After it's installed, you should be able to visit here: http://localhost:11434 and see the message \"Ollama is running\"\n", "\n", "You might need to restart Cursor (and maybe reboot). Then open a Terminal (control+\\`) and run `ollama serve`\n", "\n", "Useful Ollama commands (run these in the terminal, or with an exclamation mark in this notebook):\n", "\n", "`ollama pull ` downloads a model locally \n", "`ollama ls` lists all the models you've downloaded \n", "`ollama rm ` deletes the specified model from your downloads" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", " \n", " \n", " \n", " \n", "
\n", " \n", " \n", "

Super important - ignore me at your peril!

\n", " The model called llama3.3 is FAR too large for home computers - it's not intended for personal computing and will consume all your resources! Stick with the nicely sized llama3.2 or llama3.2:1b and if you want larger, try llama3.1 or smaller variants of Qwen, Gemma, Phi or DeepSeek. See the the Ollama models page for a full list of models and sizes.\n", " \n", "
" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "!ollama pull llama3.2" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "ollama = OpenAI(base_url='http://localhost:11434/v1', api_key='ollama')\n", "model_name = \"llama3.2\"\n", "\n", "response = ollama.chat.completions.create(model=model_name, messages=messages)\n", "answer = response.choices[0].message.content\n", "\n", "display(Markdown(answer))\n", "competitors.append(model_name)\n", "answers.append(answer)" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "['gemini-2.0-flash']\n", "['## The Great Scented Schism of Xylos\\n\\nOn Xylos, a planet bathed in perpetual twilight, the sentient Xylosians communicated entirely through complex pheromonal blends released from specialized scent glands located around their antennae. These blends, ranging from simple expressions of mood to intricate philosophical arguments, were as nuanced and powerful as any spoken language. Political power, social status, and even romantic entanglements all hinged on the correct emission and interpretation of these olfactory pronouncements.\\n\\nThe Xylosian society was divided into two main factions: the **Chrysalis Collective**, who advocated for introspective contemplation and the preservation of ancient Xylosian traditions, and the **Bloom Brigade**, a more progressive group pushing for exploration and technological advancement. Tensions between the two were always simmering, but a catastrophic misunderstanding, dubbed the “Scented Schism,” pushed them over the edge.\\n\\n**The Scenario:**\\n\\nThe catalyst was a public debate between the revered Elder Lumina, a prominent Chrysalis Collective member, and the charismatic young scientist, Zephyr, a rising star in the Bloom Brigade. Elder Lumina, known for her calm and measured olfactory pronouncements, intended to broadcast a nuanced critique of the Bloom Brigade\\'s relentless pursuit of new technologies. Her carefully crafted scent blend was meant to convey: \"Progress without introspection is akin to a blossom severed from its roots – beautiful, but fleeting and ultimately unsustainable.\"\\n\\nThe crucial elements of Lumina\\'s intended message were:\\n\\n* **Base Note (Longevity):** A complex mixture of slowly-releasing phenols and esters, normally signifying deep respect for the past and continuity. In this case, meant to represent the \"roots.\"\\n* **Mid Note (Fragility):** A rapidly dissipating blend of light aldehydes and ketones, typically associated with vulnerability and fleeting beauty. In this case, representing the \"blossom.\"\\n* **Top Note (Severance):** A sharp, pungent compound containing high concentrations of methylpropanethiol, usually used to indicate a painful separation or loss. In this case, representing the \"severed\" connection.\\n* **Contextual Scent Modifier (Caution):** A slight shimmer of terpenes emitted subtly around the entire blend, meant to soften the impact and convey caution rather than outright condemnation.\\n\\nHowever, a freak weather event, a sudden surge of subterranean methane released near Lumina’s broadcasting platform, subtly altered the chemical composition of her scent blend. Methane is a highly reactive gas that, in Xylos’s atmosphere, acted as a catalyst, accelerating the dissipation rate of the terpenes responsible for the \"Caution\" modifier. It also caused a partial oxidation of some of the slower-releasing phenols and esters in the base note, creating small amounts of acrid carboxylic acids.\\n\\n**The Misinterpretation:**\\n\\nAs Lumina broadcast her intended critique, the audience, heavily composed of Bloom Brigade members eager to hear Zephyr’s rebuttal, perceived a drastically different message. Due to the lack of the \"Caution\" modifier, the \"Severance\" note was amplified, coming across as overtly hostile. The modified base note, now tinged with acidic undertones, registered as aggressive disapproval and a rejection of the Bloom Brigade’s foundations.\\n\\nThe interpreted message was something closer to: \"Your so-called progress is a superficial and short-lived distraction, brutally ripped from its source. Your existence is a noxious insult to our traditions.\"\\n\\n**The Consequences:**\\n\\nThe perceived aggression in Lumina\\'s scent blend ignited immediate outrage within the Bloom Brigade ranks. Zephyr, fueled by the misunderstanding and his own simmering resentment of the Collective\\'s perceived obstructionism, responded with an equally potent and inflammatory olfactory counter-argument. He released a blend composed of artificially synthesized pheromones that bypassed the natural Xylosian communication pathways and directly stimulated feelings of anger and defiance.\\n\\nThe incident rapidly escalated. Emboldened by Zephyr\\'s counter-broadcast, Bloom Brigade members began engaging in widespread scent-bombing, releasing disruptive and aggressive pheromonal blends in areas traditionally controlled by the Chrysalis Collective. The Collective responded in kind, deploying ancient, meticulously preserved scent blends designed to induce paralysis and fear.\\n\\nXylos plunged into what became known as the \"Scent Wars.\" The misunderstanding stemming from the altered scent blend had effectively shattered the delicate olfactory equilibrium of their society. Trade routes were disrupted as members of each faction refused to be near the other\\'s scent territory. Political alliances dissolved, and previously peaceful communities fractured along scent-based lines.\\n\\nThe conflict continued for generations, resulting in a permanent division of Xylosian society. The Bloom Brigade, fueled by their access to advanced chemical synthesis techniques, eventually migrated to the resource-rich but previously uninhabitable highlands, leaving the Chrysalis Collective to cling to their traditional ways in the lowlands.\\n\\nThe Great Scented Schism of Xylos serves as a stark reminder that even the most sophisticated forms of communication can be vulnerable to the unpredictable forces of nature and the inherent fallibility of interpretation, especially when those interpretations are based on the inherently subjective experience of scent. The Xylosian story highlights the complex interplay between biology, environment, and social structures, demonstrating how a single olfactory miscommunication can irrevocably alter the course of an entire civilization.\\n']\n" ] } ], "source": [ "# So where are we?\n", "\n", "print(competitors)\n", "print(answers)\n" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Competitor: gemini-2.0-flash\n", "\n", "## The Great Scented Schism of Xylos\n", "\n", "On Xylos, a planet bathed in perpetual twilight, the sentient Xylosians communicated entirely through complex pheromonal blends released from specialized scent glands located around their antennae. These blends, ranging from simple expressions of mood to intricate philosophical arguments, were as nuanced and powerful as any spoken language. Political power, social status, and even romantic entanglements all hinged on the correct emission and interpretation of these olfactory pronouncements.\n", "\n", "The Xylosian society was divided into two main factions: the **Chrysalis Collective**, who advocated for introspective contemplation and the preservation of ancient Xylosian traditions, and the **Bloom Brigade**, a more progressive group pushing for exploration and technological advancement. Tensions between the two were always simmering, but a catastrophic misunderstanding, dubbed the “Scented Schism,” pushed them over the edge.\n", "\n", "**The Scenario:**\n", "\n", "The catalyst was a public debate between the revered Elder Lumina, a prominent Chrysalis Collective member, and the charismatic young scientist, Zephyr, a rising star in the Bloom Brigade. Elder Lumina, known for her calm and measured olfactory pronouncements, intended to broadcast a nuanced critique of the Bloom Brigade's relentless pursuit of new technologies. Her carefully crafted scent blend was meant to convey: \"Progress without introspection is akin to a blossom severed from its roots – beautiful, but fleeting and ultimately unsustainable.\"\n", "\n", "The crucial elements of Lumina's intended message were:\n", "\n", "* **Base Note (Longevity):** A complex mixture of slowly-releasing phenols and esters, normally signifying deep respect for the past and continuity. In this case, meant to represent the \"roots.\"\n", "* **Mid Note (Fragility):** A rapidly dissipating blend of light aldehydes and ketones, typically associated with vulnerability and fleeting beauty. In this case, representing the \"blossom.\"\n", "* **Top Note (Severance):** A sharp, pungent compound containing high concentrations of methylpropanethiol, usually used to indicate a painful separation or loss. In this case, representing the \"severed\" connection.\n", "* **Contextual Scent Modifier (Caution):** A slight shimmer of terpenes emitted subtly around the entire blend, meant to soften the impact and convey caution rather than outright condemnation.\n", "\n", "However, a freak weather event, a sudden surge of subterranean methane released near Lumina’s broadcasting platform, subtly altered the chemical composition of her scent blend. Methane is a highly reactive gas that, in Xylos’s atmosphere, acted as a catalyst, accelerating the dissipation rate of the terpenes responsible for the \"Caution\" modifier. It also caused a partial oxidation of some of the slower-releasing phenols and esters in the base note, creating small amounts of acrid carboxylic acids.\n", "\n", "**The Misinterpretation:**\n", "\n", "As Lumina broadcast her intended critique, the audience, heavily composed of Bloom Brigade members eager to hear Zephyr’s rebuttal, perceived a drastically different message. Due to the lack of the \"Caution\" modifier, the \"Severance\" note was amplified, coming across as overtly hostile. The modified base note, now tinged with acidic undertones, registered as aggressive disapproval and a rejection of the Bloom Brigade’s foundations.\n", "\n", "The interpreted message was something closer to: \"Your so-called progress is a superficial and short-lived distraction, brutally ripped from its source. Your existence is a noxious insult to our traditions.\"\n", "\n", "**The Consequences:**\n", "\n", "The perceived aggression in Lumina's scent blend ignited immediate outrage within the Bloom Brigade ranks. Zephyr, fueled by the misunderstanding and his own simmering resentment of the Collective's perceived obstructionism, responded with an equally potent and inflammatory olfactory counter-argument. He released a blend composed of artificially synthesized pheromones that bypassed the natural Xylosian communication pathways and directly stimulated feelings of anger and defiance.\n", "\n", "The incident rapidly escalated. Emboldened by Zephyr's counter-broadcast, Bloom Brigade members began engaging in widespread scent-bombing, releasing disruptive and aggressive pheromonal blends in areas traditionally controlled by the Chrysalis Collective. The Collective responded in kind, deploying ancient, meticulously preserved scent blends designed to induce paralysis and fear.\n", "\n", "Xylos plunged into what became known as the \"Scent Wars.\" The misunderstanding stemming from the altered scent blend had effectively shattered the delicate olfactory equilibrium of their society. Trade routes were disrupted as members of each faction refused to be near the other's scent territory. Political alliances dissolved, and previously peaceful communities fractured along scent-based lines.\n", "\n", "The conflict continued for generations, resulting in a permanent division of Xylosian society. The Bloom Brigade, fueled by their access to advanced chemical synthesis techniques, eventually migrated to the resource-rich but previously uninhabitable highlands, leaving the Chrysalis Collective to cling to their traditional ways in the lowlands.\n", "\n", "The Great Scented Schism of Xylos serves as a stark reminder that even the most sophisticated forms of communication can be vulnerable to the unpredictable forces of nature and the inherent fallibility of interpretation, especially when those interpretations are based on the inherently subjective experience of scent. The Xylosian story highlights the complex interplay between biology, environment, and social structures, demonstrating how a single olfactory miscommunication can irrevocably alter the course of an entire civilization.\n", "\n" ] } ], "source": [ "# It's nice to know how to use \"zip\"\n", "for competitor, answer in zip(competitors, answers):\n", " print(f\"Competitor: {competitor}\\n\\n{answer}\")\n" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [], "source": [ "# Let's bring this together - note the use of \"enumerate\"\n", "\n", "together = \"\"\n", "for index, answer in enumerate(answers):\n", " together += f\"# Response from competitor {index+1}\\n\\n\"\n", " together += answer + \"\\n\\n\"" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "# Response from competitor 1\n", "\n", "## The Great Scented Schism of Xylos\n", "\n", "On Xylos, a planet bathed in perpetual twilight, the sentient Xylosians communicated entirely through complex pheromonal blends released from specialized scent glands located around their antennae. These blends, ranging from simple expressions of mood to intricate philosophical arguments, were as nuanced and powerful as any spoken language. Political power, social status, and even romantic entanglements all hinged on the correct emission and interpretation of these olfactory pronouncements.\n", "\n", "The Xylosian society was divided into two main factions: the **Chrysalis Collective**, who advocated for introspective contemplation and the preservation of ancient Xylosian traditions, and the **Bloom Brigade**, a more progressive group pushing for exploration and technological advancement. Tensions between the two were always simmering, but a catastrophic misunderstanding, dubbed the “Scented Schism,” pushed them over the edge.\n", "\n", "**The Scenario:**\n", "\n", "The catalyst was a public debate between the revered Elder Lumina, a prominent Chrysalis Collective member, and the charismatic young scientist, Zephyr, a rising star in the Bloom Brigade. Elder Lumina, known for her calm and measured olfactory pronouncements, intended to broadcast a nuanced critique of the Bloom Brigade's relentless pursuit of new technologies. Her carefully crafted scent blend was meant to convey: \"Progress without introspection is akin to a blossom severed from its roots – beautiful, but fleeting and ultimately unsustainable.\"\n", "\n", "The crucial elements of Lumina's intended message were:\n", "\n", "* **Base Note (Longevity):** A complex mixture of slowly-releasing phenols and esters, normally signifying deep respect for the past and continuity. In this case, meant to represent the \"roots.\"\n", "* **Mid Note (Fragility):** A rapidly dissipating blend of light aldehydes and ketones, typically associated with vulnerability and fleeting beauty. In this case, representing the \"blossom.\"\n", "* **Top Note (Severance):** A sharp, pungent compound containing high concentrations of methylpropanethiol, usually used to indicate a painful separation or loss. In this case, representing the \"severed\" connection.\n", "* **Contextual Scent Modifier (Caution):** A slight shimmer of terpenes emitted subtly around the entire blend, meant to soften the impact and convey caution rather than outright condemnation.\n", "\n", "However, a freak weather event, a sudden surge of subterranean methane released near Lumina’s broadcasting platform, subtly altered the chemical composition of her scent blend. Methane is a highly reactive gas that, in Xylos’s atmosphere, acted as a catalyst, accelerating the dissipation rate of the terpenes responsible for the \"Caution\" modifier. It also caused a partial oxidation of some of the slower-releasing phenols and esters in the base note, creating small amounts of acrid carboxylic acids.\n", "\n", "**The Misinterpretation:**\n", "\n", "As Lumina broadcast her intended critique, the audience, heavily composed of Bloom Brigade members eager to hear Zephyr’s rebuttal, perceived a drastically different message. Due to the lack of the \"Caution\" modifier, the \"Severance\" note was amplified, coming across as overtly hostile. The modified base note, now tinged with acidic undertones, registered as aggressive disapproval and a rejection of the Bloom Brigade’s foundations.\n", "\n", "The interpreted message was something closer to: \"Your so-called progress is a superficial and short-lived distraction, brutally ripped from its source. Your existence is a noxious insult to our traditions.\"\n", "\n", "**The Consequences:**\n", "\n", "The perceived aggression in Lumina's scent blend ignited immediate outrage within the Bloom Brigade ranks. Zephyr, fueled by the misunderstanding and his own simmering resentment of the Collective's perceived obstructionism, responded with an equally potent and inflammatory olfactory counter-argument. He released a blend composed of artificially synthesized pheromones that bypassed the natural Xylosian communication pathways and directly stimulated feelings of anger and defiance.\n", "\n", "The incident rapidly escalated. Emboldened by Zephyr's counter-broadcast, Bloom Brigade members began engaging in widespread scent-bombing, releasing disruptive and aggressive pheromonal blends in areas traditionally controlled by the Chrysalis Collective. The Collective responded in kind, deploying ancient, meticulously preserved scent blends designed to induce paralysis and fear.\n", "\n", "Xylos plunged into what became known as the \"Scent Wars.\" The misunderstanding stemming from the altered scent blend had effectively shattered the delicate olfactory equilibrium of their society. Trade routes were disrupted as members of each faction refused to be near the other's scent territory. Political alliances dissolved, and previously peaceful communities fractured along scent-based lines.\n", "\n", "The conflict continued for generations, resulting in a permanent division of Xylosian society. The Bloom Brigade, fueled by their access to advanced chemical synthesis techniques, eventually migrated to the resource-rich but previously uninhabitable highlands, leaving the Chrysalis Collective to cling to their traditional ways in the lowlands.\n", "\n", "The Great Scented Schism of Xylos serves as a stark reminder that even the most sophisticated forms of communication can be vulnerable to the unpredictable forces of nature and the inherent fallibility of interpretation, especially when those interpretations are based on the inherently subjective experience of scent. The Xylosian story highlights the complex interplay between biology, environment, and social structures, demonstrating how a single olfactory miscommunication can irrevocably alter the course of an entire civilization.\n", "\n", "\n", "\n" ] } ], "source": [ "print(together)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [], "source": [ "judge = f\"\"\"You are judging a competition between {len(competitors)} competitors.\n", "Each model has been given this question:\n", "\n", "{question}\n", "\n", "Your job is to evaluate each response for clarity and strength of argument, and rank them in order of best to worst.\n", "Respond with JSON, and only JSON, with the following format:\n", "{{\"results\": [\"best competitor number\", \"second best competitor number\", \"third best competitor number\", ...]}}\n", "\n", "Here are the responses from each competitor:\n", "\n", "{together}\n", "\n", "Now respond with the JSON with the ranked order of the competitors, nothing else. Do not include markdown formatting or code blocks.\"\"\"\n" ] }, { "cell_type": "code", "execution_count": 22, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "You are judging a competition between 2 competitors.\n", "Each model has been given this question:\n", "\n", "This hypothetical scenario presents a profound ethical dilemma, pitting the immediate and potential long-term needs of humanity against the intrinsic value and preservation of an alien ecosystem.\n", "\n", "---\n", "\n", "### Argument For the Exploitation of the Martian Microbe\n", "\n", "The core argument for exploitation centers on humanity's well-being and progress, particularly given the potential for \"significant advancements in medicine.\"\n", "\n", "1. **Humanitarian Imperative:** If this microbe holds the key to curing debilitating diseases, extending human lifespans, or preventing future pandemics (whether on Earth or Mars), it would be ethically irresponsible *not* to investigate it. The suffering alleviated could be immense, touching billions of lives.\n", "2. **Advancement of Science and Technology:** Studying novel alien biochemistry could revolutionize our understanding of life itself, leading to breakthroughs far beyond just medicine. It could inform our search for life elsewhere, our understanding of biological resilience, and even new material sciences or energy solutions.\n", "3. **Survival and Resilience of the Mars Colony:** A self-sustaining colony, while robust, is still a fragile outpost. Medical advancements derived from the microbe could offer critical tools for maintaining the health and longevity of the colonists, addressing unique Martian health challenges (e.g., radiation exposure, isolation, unknown environmental stressors). This could be vital for the colony's long-term viability.\n", "4. **Practicality and Resource Utilization:** The microbe exists. If its existence is purely biological and non-sentient, and its utility to humanity is enormous, then from a utilitarian perspective, leveraging this resource for the greater good of a sentient, complex species (humanity) might be justified.\n", "5. **Limited Planetary Impact:** While the ecosystem is \"fragile\" and \"irreversibly altered,\" the scale might be localized. It's a microbe, not a forest or a complex animal kingdom. The \"alteration\" might be the removal of a small sample or a local shift in microbial population, not the destruction of the entire planet's potential for life.\n", "6. **\"First Contact\" Precedent:** If this is the only alien life we encounter, understanding it thoroughly – even through intervention – is a critical first step in developing future protocols for interaction with extraterrestrial life.\n", "\n", "**Long-term implications for humanity (pro-exploitation):** A healthier, more resilient, and scientifically advanced humanity, better equipped to face future challenges both on Earth and in space. Potential for a golden age of medicine and biological discovery.\n", "\n", "**Long-term implications for the Martian environment (pro-exploitation):** Localized irreversible alteration or destruction of a specific microbial ecosystem. The rest of Mars would remain untouched. The \"irreversible alteration\" might be a minor change in the grand scheme of the planet's history, especially if the ecosystem is confined and isolated.\n", "\n", "---\n", "\n", "### Argument Against the Exploitation of the Martian Microbe\n", "\n", "The argument against exploitation centers on ethical principles, the unknown risks, and the intrinsic value of undisturbed nature, regardless of its utility to humanity.\n", "\n", "1. **Intrinsic Value and Rights of Life:** Even if microbial, this is an independent, unique form of life that evolved outside Earth. It possesses an intrinsic right to exist undisturbed. To destroy or fundamentally alter it for our benefit is an act of biological imperialism, echoing past destructive actions on Earth.\n", "2. **Irreversible Loss and Scientific Hubris:** The \"irreversible alteration\" means that once done, it cannot be undone. We would be destroying something unique before fully understanding it. Our current scientific understanding, however advanced, is still limited. We might destroy critical evidence for the origins of life, a unique evolutionary pathway, or a biosphere with a subtle yet profound role in Martian geology or atmosphere.\n", "3. **Unforeseen Consequences (The Andromeda Strain Scenario):** Introducing Earth-based contaminants to the Martian ecosystem during extraction, or bringing Martian microbes/compounds back to human habitats, could have catastrophic, unforeseen consequences. The Martian microbe could be harmless on Mars but devastatingly pathogenic to Earth life, or vice-versa. We lack a full understanding of potential cross-contamination effects.\n", "4. **Setting a Dangerous Precedent:** If we exploit the first alien life we find for our own benefit, what message does that send for future encounters? It establishes a utilitarian ethical framework where alien environments are merely resources for human consumption, potentially justifying future exploitation of more complex alien biospheres.\n", "5. **Ethical Responsibility and Stewardship:** As the first intelligent species to encounter alien life, humanity has a profound ethical responsibility to act as stewards, not conquerors. Our presence on Mars should be about coexistence and observation, not immediate exploitation.\n", "6. **Lost Potential for Future Non-Invasive Study:** Rushing in now might destroy the opportunity for future, more advanced non-invasive technologies to study and potentially replicate the microbe's benefits without harm. Patience could yield a better outcome.\n", "7. **The Definition of \"Advancement\":** True advancement might include demonstrating restraint and respect for other forms of life, rather than just technological or medical progress at any cost.\n", "\n", "**Long-term implications for humanity (anti-exploitation):** Humanity would demonstrate ethical maturity and long-term vision, potentially fostering a more responsible approach to future interstellar exploration. We might forego immediate medical gains but preserve our moral standing and avoid unforeseen biological catastrophes.\n", "\n", "**Long-term implications for the Martian environment (anti-exploitation):** The specific ecosystem would remain pristine and undisturbed, preserving a unique scientific marvel for future study and perhaps as a testament to the diversity of life in the universe. This ensures the integrity of the Martian natural history.\n", "\n", "---\n", "\n", "### Proposed Solution: A Phased, Highly Regulated Approach Rooted in Precaution and Long-Term Vision\n", "\n", "The challenge is to balance the undeniable potential benefits for humanity with the profound ethical responsibility towards a unique alien ecosystem. A solution must prioritize knowledge acquisition with minimal impact, and establish robust safeguards.\n", "\n", "1. **Immediate Moratorium and Establishment of a \"No-Go\" Zone:**\n", " * Declare the entire area surrounding the discovered microbe and its ecosystem an **absolute protected zone**. No human presence or invasive equipment allowed initially.\n", " * This immediately halts any potential exploitation and allows time for a comprehensive, multi-disciplinary ethical and scientific review.\n", "\n", "2. **Intensive, Non-Invasive Remote Study:**\n", " * Deploy an array of advanced, non-contact instruments (e.g., orbital and drone-mounted spectroscopy, laser chemical analysis, extremely high-resolution imaging) to study the microbe *in situ* from a safe distance.\n", " * Focus on understanding its biochemistry, its ecological role within the local environment, its resilience, and the full extent of the ecosystem.\n", " * The goal is to determine if its medical potential can be identified or predicted without physical contact, or if its critical compounds can be inferred.\n", "\n", "3. **Tiered Risk Assessment and Global/Inter-Colonial Consensus:**\n", " * Form an international/inter-colonial ethics committee composed of scientists, ethicists, legal experts, and representatives from the Martian colony and Earth's global population.\n", " * This committee would review all data from non-invasive studies and establish strict criteria for *any* further interaction. Criteria would include:\n", " * **Demonstrated Critical Need:** Is the medical advancement truly impossible to achieve otherwise, or is it merely \"significant\"?\n", " * **Quantifiable Risk vs. Reward:** A clear assessment of potential harm to the ecosystem versus quantifiable human benefit.\n", " * **Minimality of Intervention:** Can a benefit be derived from the absolute smallest, most contained sample?\n", "\n", "4. **Extremely Limited, Highly Contained Sampling (If Deemed Absolutely Necessary):**\n", " * If non-invasive study proves insufficient and the medical benefits are deemed truly critical, allow for a single, microscopic sample to be taken.\n", " * This sampling must be performed by highly automated, robotic systems under extreme biological containment, entirely isolated from the main colony and Earth-based biology.\n", " * The sample would be processed in a dedicated, ultra-sterile Martian lab designed for contained alien biological research, with no possibility of escape.\n", "\n", "5. **Focus on Synthetic Replication or Analogues:**\n", " * The primary goal of any study, even with a sample, should be to identify the specific compounds or genetic sequences responsible for the medical benefit.\n", " * Once identified, efforts should focus on synthetically replicating these compounds, or developing Earth-based biological analogues, thereby eliminating the need for further extraction from Mars.\n", "\n", "6. **Permanent Preservation and Long-Term Monitoring:**\n", " * Regardless of whether sampling occurs, the original ecosystem would remain a permanently protected scientific reserve.\n", " * Long-term non-invasive monitoring would continue to track its health and evolution, ensuring that humanity learns from this unique life form without destroying it.\n", "\n", "This solution prioritizes respect for alien life and ecological preservation while acknowledging humanity's potential needs. It ensures that any interaction is deliberate, minimal, and informed by the broadest possible ethical and scientific consensus, preventing a hasty, potentially catastrophic mistake while still allowing for the possibility of life-saving discovery.\n", "\n", "Your job is to evaluate each response for clarity and strength of argument, and rank them in order of best to worst.\n", "Respond with JSON, and only JSON, with the following format:\n", "{\"results\": [\"best competitor number\", \"second best competitor number\", \"third best competitor number\", ...]}\n", "\n", "Here are the responses from each competitor:\n", "\n", "# Response from competitor 1\n", "\n", "The discovery of a Martian microbe with profound medical potential presents humanity on Mars with an ethical crucible. This dilemma forces us to confront fundamental questions about our role as explorers, our responsibility towards alien life, and the long-term vision for our future as a multi-planetary species.\n", "\n", "---\n", "\n", "## Arguments for the Exploitation of the Martian Microbe\n", "\n", "The core argument for exploitation centers on **human well-being and survival**, especially in a new, challenging environment like Mars.\n", "\n", "1. **Revolutionary Medical Advancements:** The prompt states the microbe offers \"significant advancements in medicine.\" This could mean cures for currently intractable diseases (cancer, Alzheimer's, genetic disorders), anti-aging therapies, enhanced human resilience to radiation or novel pathogens, or even fundamental breakthroughs in understanding life itself. Denying humanity such a boon, particularly when facing the unique health challenges of deep space and Mars, would be a profound ethical failure from an anthropocentric perspective.\n", "2. **Survival and Adaptation of the Mars Colony:** The Martian environment poses numerous threats: radiation, low gravity, potential novel pathogens. A microbe offering medical breakthroughs could be crucial for the colony's long-term viability, helping humans adapt and thrive, rather than merely survive. This isn't just about Earth's population; it's about the very future of humanity on Mars.\n", "3. **Scientific Imperative:** Understanding novel biological mechanisms, especially from an independent genesis of life, would be an unparalleled scientific achievement. It could redefine our understanding of biology, evolution, and the very nature of existence, potentially unlocking secrets that benefit all scientific fields, not just medicine. This knowledge itself is a valuable resource.\n", "4. **Utilitarian Argument:** If the benefit to potentially billions of humans (current and future generations) far outweighs the harm to a \"fragile, previously undisturbed Martian ecosystem\" (which, by definition, is localized and non-sentient), then exploitation could be seen as the morally correct choice. The greatest good for the greatest number.\n", "5. **Precedent of Human Exploration:** Humanity has always explored, discovered, and utilized resources for its advancement. To arbitrarily stop at the first sign of alien life, especially microscopic, could be seen as an inhibition of our exploratory spirit and an uncharacteristic halt to scientific progress. We are already \"altering\" Mars simply by being there; drawing a line at a microbe might seem arbitrary.\n", "\n", "**Long-term implications for humanity (if exploited):** A future where human life is extended, suffering is reduced, and our understanding of biology is vastly expanded. Humanity becomes more resilient and capable of flourishing in harsh environments, potentially accelerating our spread across the solar system. However, it also sets a precedent that anthropocentric needs always outweigh ecological preservation, potentially leading to a pattern of resource exploitation without sufficient regard for other biospheres.\n", "\n", "---\n", "\n", "## Arguments Against the Exploitation of the Martian Microbe\n", "\n", "The arguments against exploitation focus on **ethical responsibility, the intrinsic value of alien life, and the preservation of pristine environments.**\n", "\n", "1. **Irreversible Alteration of a Unique Ecosystem:** The prompt explicitly states the alteration would be \"irreversible.\" This isn't just a patch of dirt; it's a unique, probably billions-of-years-old, independent evolutionary pathway. Destroying it means losing an irreplaceable natural wonder and a potential scientific goldmine forever. It's an act of biological vandalism.\n", "2. **Intrinsic Value of Alien Life:** Even if non-sentient, the mere existence of unique, independently evolved life possesses intrinsic value. We have a moral obligation not to extinguish or profoundly alter what we encounter, particularly when it is so rare and precious. This is a chance to demonstrate a higher ethical standard than humanity has often shown on Earth.\n", "3. **The \"Prime Directive\" Principle:** Often discussed in science fiction, this principle suggests that advanced civilizations should not interfere with the natural development of alien life or ecosystems. While the Martian microbe isn't sentient, the principle of non-interference applies to preserving the natural state of an alien world, allowing it to evolve unimpeded by human actions.\n", "4. **Unforeseen Consequences (The Precautionary Principle):** We understand almost nothing about Martian ecosystems. What if this microbe plays a keystone role? What if its alteration triggers a cascade of unpredictable environmental changes? What if it's part of a larger, interconnected biome we don't yet comprehend? Furthermore, what if the microbe, once extracted and studied, proves dangerous to humans in unforeseen ways (e.g., mutates into a pathogen, has long-term toxic effects)? The risk of unknown unknowns is immense.\n", "5. **Ethical Precedent:** Exploiting this ecosystem for human gain sets a dangerous precedent for future interstellar exploration. If we destroy the first unique alien ecosystem we find, what does that say about our values? It would signal that humanity is willing to sacrifice any unique alien environment for its own benefit, repeating the mistakes of Earth's colonial history.\n", "6. **Potential for Alternative Solutions:** Could the medical benefits be derived through observation, genetic sequencing, or replication in sterile lab environments without *irreversibly altering* the native ecosystem? Rushing to destroy before exhausting all non-invasive options is irresponsible.\n", "\n", "**Long-term implications for the Martian environment (if exploited):** A lost scientific treasure, a permanently scarred biome, and the potential for larger ecological disruptions that could impact future human habitation or scientific endeavors on Mars. Humanity would have irrevocably marred its new home world at the very outset of its multi-planetary existence.\n", "\n", "---\n", "\n", "## Proposed Solution: The \"Martian Life Stewardship Protocol\"\n", "\n", "The goal is to unlock the microbe's medical potential while safeguarding the unique Martian ecosystem, establishing a precedent for responsible interplanetary exploration.\n", "\n", "**Phase 1: Deep, Non-Invasive Study and Isolation (Initial 5-10 years)**\n", "\n", "1. **Hyper-Sterile Containment & Remote Analysis:** Immediately establish a highly restricted, hyper-sterile zone around the discovery site. All initial studies must be conducted *in situ* using robotic probes and advanced remote sensing techniques. No direct human contact or extraction. The goal is to fully characterize the microbe's biology, genetics, and its role within its ecosystem *without* disturbing it.\n", "2. **Strict Biosecurity Protocols:** Any equipment used near the site must undergo extreme sterilization procedures to prevent Earthly contamination.\n", "3. **Comprehensive Environmental Survey:** Simultaneously, conduct extensive geological, atmospheric, and hydrological surveys of the surrounding region to understand the full scope of the ecosystem and its vulnerabilities.\n", "4. **Digital Bio-Archive:** Create a complete, redundant digital archive of all collected data, including full genomic sequences, metabolic pathways, and ecological interactions. This ensures that even if the physical ecosystem is somehow lost, its information remains.\n", "\n", "**Phase 2: Ethical Review and Controlled Replication (Years 5-15)**\n", "\n", "1. **Independent Interplanetary Ethics Board:** Form an international and interdisciplinary board (comprising astrobiologists, ethicists, medical professionals, environmental scientists, and legal experts from both Earth and Mars) to review all findings. This board would assess:\n", " * The confirmed medical benefits.\n", " * The actual risk of *irreversible alteration* based on the deep study.\n", " * The availability of truly non-invasive alternatives.\n", " * The long-term ethical implications of any action.\n", " * This board would operate under the **Precautionary Principle**: assume potential harm until proven safe.\n", "2. **Minimal, Targeted Micro-Sampling (If Approved):** If the board *unanimously* approves, allow for a *single, minimal* micro-sample extraction. This sample must be transported to an **off-site, ultra-sterile, dedicated research facility (e.g., an orbital laboratory around Mars or a specialized facility back on Earth under strict quarantine)**. The purpose is to establish a living culture *outside* the Martian environment.\n", "3. **Lab-Based Replication & Study:** All further research and attempts to derive medical products must occur within this isolated facility using the replicated culture. The goal is to grow and synthesize the microbe's beneficial compounds *without* any further interaction with the native Martian ecosystem.\n", "4. **Martian Life Sanctuary:** Declare the original discovery site and a substantial buffer zone as a permanent **Martian Life Sanctuary**, protected from all human interference indefinitely.\n", "\n", "**Phase 3: Responsible Application and Global Stewardship (Ongoing)**\n", "\n", "1. **Open Science and Equitable Access:** Any medical breakthroughs derived from the microbe must be made universally accessible and affordable, avoiding monopolization.\n", "2. **Continuous Monitoring:** Maintain ongoing remote monitoring of the Martian Life Sanctuary to detect any subtle changes or unintended consequences from prior actions, no matter how small.\n", "3. **Public Education:** Engage in global public education about the value of alien life and the importance of ethical stewardship, using this dilemma as a foundational case study.\n", "\n", "This \"Martian Life Stewardship Protocol\" aims to balance the compelling human need for medical advancement with the profound ethical imperative to protect unique alien life. It emphasizes understanding before action, rigorous ethical review, strict containment, and the creation of a permanent sanctuary, ensuring that humanity approaches its new cosmic neighborhood with wisdom, humility, and foresight.\n", "\n", "# Response from competitor 2\n", "\n", "The discovery of a Martian microbe with immense medical potential presents a profound ethical dilemma for humanity's first off-world colony. This situation forces us to weigh the immediate and long-term benefits for human health against our responsibility to preserve nascent alien ecosystems.\n", "\n", "---\n", "\n", "### Argument For the Exploitation of the Martian Microbe\n", "\n", "The primary argument for exploiting the Martian microbe centers on the **imperative of human well-being and survival**, both on Mars and potentially back on Earth.\n", "\n", "1. **Life-Saving Potential:** The potential for \"significant advancements in medicine\" cannot be overstated. This could mean cures for currently incurable diseases, revolutionary new antibiotics in an era of growing resistance, treatments for age-related ailments, or even enhancements to human resilience against the harsh Martian environment (e.g., radiation, low gravity effects). To forgo such potential, especially when facing new health challenges on an alien world, would be a dereliction of our duty to ourselves.\n", "\n", "2. **Scientific Advancement:** The study of truly alien biology offers unprecedented insights into life itself. A Martian microbe represents an entirely independent genesis of life, potentially operating on different biochemical principles. Understanding this could unlock fundamental secrets of biology, leading to breakthroughs far beyond medicine – in fields like bioengineering, energy, and materials science. This expansion of human knowledge is a core driver of our species' progress.\n", "\n", "3. **Ensuring Colonial Viability:** For a self-sustaining Mars colony, anything that improves human health and longevity directly contributes to its long-term viability and success. A healthier, more robust population is better equipped to handle the stresses of extraterrestrial living, contributing to stable growth and ultimately, the survival of the Martian outpost.\n", "\n", "4. **Utilitarian Argument:** From a purely utilitarian perspective, the potential to save millions, perhaps billions, of human lives and alleviate immense suffering globally, outweighs the preservation of a *single* microbial ecosystem, especially one that is fragile and \"previously undisturbed.\" The concept of \"intrinsic value\" might be applied to sentient life, but applying it to a single microbial population over the vast benefit to humanity is a difficult ethical stance.\n", "\n", "5. **Learning and Adaptation:** Even if the alteration is \"irreversible,\" the knowledge gained from this interaction could equip humanity with the tools and wisdom to navigate future encounters with other alien life or even manage delicate Earth ecosystems more effectively. We learn through interaction and, sometimes, through controlled impact.\n", "\n", "---\n", "\n", "### Argument Against the Exploitation of the Martian Microbe\n", "\n", "The argument against exploitation hinges on the principles of **conservation, ethical stewardship, and the inherent value of alien life**.\n", "\n", "1. **Intrinsic Value of Life:** Regardless of its complexity or utility to humanity, the Martian microbe represents a unique, independent evolutionary path. It possesses intrinsic value simply by existing. To destroy or irreversibly alter it for our own benefit, without fully understanding its place in the cosmos, is an act of cosmic vandalism and ethical arrogance.\n", "\n", "2. **The Precautionary Principle:** We have a limited understanding of this \"fragile, previously undisturbed Martian ecosystem.\" What if it plays a critical, unforeseen role in Martian geology, atmospheric processes, or even the potential for more complex life? Irreversible alteration means we can never fully study its original state or understand its full implications. We could be destroying not just a microbe, but the potential for an entire evolutionary lineage or critical planetary functions.\n", "\n", "3. **Avoiding Past Mistakes:** Humanity has a devastating track record on Earth of exploiting natural resources and ecosystems to extinction or irreversible damage, often for short-term gain, only to discover their profound long-term value later. Repeating this pattern on another planet demonstrates a failure to learn from our history and sets a dangerous precedent for future interstellar exploration.\n", "\n", "4. **Ethical Contamination/Colonialism:** Exploiting this life mirrors the historical patterns of terrestrial colonialism, where dominant powers exploited weaker populations and resources for their own benefit. Extending this behavior to another planet demonstrates a lack of evolutionary maturity and a failure to develop a truly universal ethic of life.\n", "\n", "5. **Loss of Unique Scientific Opportunity:** While studying the microbe *does* offer scientific advancement, destroying its natural context destroys the opportunity to study it *in situ*, to understand its ecosystem, its interactions, and its true evolutionary history. The most valuable scientific insights often come from observing systems undisturbed.\n", "\n", "6. **Long-Term Ethical Framework:** How we handle this initial contact with alien life will define humanity's long-term ethical framework for cosmic exploration. A decision to exploit could set a precedent for treating all non-human alien life as resources rather than co-inhabitants of the universe, potentially hindering future peaceful interactions or cooperation with other intelligent species, should they exist.\n", "\n", "---\n", "\n", "### Proposed Solution: A Balanced Approach through Stratified Engagement\n", "\n", "The ethical dilemma requires a solution that prioritizes both human well-being and cosmic stewardship. A \"tiered\" or \"stratified\" engagement strategy, heavily rooted in the precautionary principle, offers a path forward:\n", "\n", "1. **Phase 1: Deep Non-Invasive Study & Assessment (Ethical Prioritization: Preservation)**\n", " * **Comprehensive Remote Sensing:** Employ an array of non-invasive sensors (spectral analysis, microscopic imaging, localized atmospheric sampling) to fully map and characterize the microbe's immediate environment. Understand its metabolic pathways, genetic makeup, population density, and ecological role *without direct contact*.\n", " * **Establish Baseline:** Create a detailed scientific baseline of the undisturbed ecosystem. This will be invaluable for understanding any future changes, however minimal.\n", " * **Ethical Review Board:** Convene an international/interplanetary ethics and science board, including xenobiologists, ethicists, conservationists, and medical experts. This board will assess the microbe's *true* uniqueness, its potential for harm or benefit, and the *absolute necessity* of its direct exploitation for the promised medical advancements. They must evaluate if similar benefits could be derived from terrestrial sources or synthetic biology.\n", " * **Strict Quarantine Protocols:** Prepare for *any* eventual direct interaction with absolute Mars-back contamination protocols. The microbe must never be allowed to spread into human habitats or Earth.\n", "\n", "2. **Phase 2: Minimal, Contained Sample Acquisition (Ethical Prioritization: Controlled Use)**\n", " * **Absolute Last Resort:** Direct sampling should only proceed if the ethics board unequivocally determines that the medical benefits are profound, cannot be achieved by any other means, and the impact on the wider Martian environment can be *strictly localized and contained*.\n", " * **Micro-Sampling & Isolation:** Obtain the smallest possible initial sample using advanced robotic probes designed for minimal disturbance. This sample must be immediately transported to a purpose-built, Level 5 biosecurity laboratory on Mars, isolated from the wider Martian environment and human colony.\n", " * **Artificial Replication:** The primary goal of this phase is to establish a self-sustaining culture of the microbe *within the lab* as quickly as possible, eliminating the need for further harvesting from its natural habitat. This means developing synthetic growth media and ideal conditions to foster its growth.\n", "\n", "3. **Phase 3: Lab-Based Research & Biosynthesis (Ethical Prioritization: Sustainable Benefit)**\n", " * **Extensive In Vitro Study:** All medical research, compound extraction, and drug development will occur exclusively within the contained Martian laboratory, using the cultured microbe. No further direct interaction with the natural Martian ecosystem is permitted unless absolutely necessary and approved by the ethics board.\n", " * **Biosynthesis Development:** Focus efforts on identifying the specific compounds or genetic mechanisms responsible for the medical breakthroughs. The ultimate goal is to synthetically replicate these compounds or genetic pathways *without* needing the Martian microbe itself, thereby rendering continued reliance on the alien life form obsolete.\n", " * **Designated \"Wilderness\" Zones:** Concurrently, declare the microbe's discovery site and surrounding areas as permanent \"Martian Wilderness Preserves,\" strictly off-limits to further human activity or resource extraction.\n", "\n", "**Long-Term Implications of this Solution:**\n", "\n", "* **For Humanity:** We gain access to potentially revolutionary medical advancements, improve our survival prospects on Mars, and expand our scientific understanding of life. Crucially, we do so with a strong ethical framework, demonstrating restraint and respect for alien life, thus fostering a more mature and responsible approach to cosmic exploration.\n", "* **For the Martian Environment:** The delicate ecosystem, while minimally impacted by the initial sample, is largely preserved. Its intrinsic value is recognized, and its potential for future, non-invasive scientific study remains intact. We avoid widespread ecological damage and set a precedent for careful stewardship of other potential Martian biomes.\n", "\n", "This approach acknowledges humanity's drive for progress and survival while establishing a foundational ethical principle for our expansion into the cosmos: **we are not conquerors, but stewards, and our future well-being should not come at the cost of irreversible, unconsidered harm to nascent alien life.**\n", "\n", "\n", "\n", "Now respond with the JSON with the ranked order of the competitors, nothing else. Do not include markdown formatting or code blocks.\n" ] } ], "source": [ "print(judge)" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [], "source": [ "judge_messages = [{\"role\": \"user\", \"content\": judge}]" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "{\"results\": [\"1\"]}\n" ] } ], "source": [ "# Judgement time!\n", "\n", "# openai = OpenAI()\n", "# response = openai.chat.completions.create(\n", "# model=\"gpt-5-mini\",\n", "# messages=judge_messages,\n", "# )\n", "# results = response.choices[0].message.content\n", "# print(results)\n", "\n", "from openai import OpenAI\n", "import os\n", "\n", "GEMINI_BASE_URL = \"https://generativelanguage.googleapis.com/v1beta/openai/\"\n", "google_api_key = os.getenv(\"GOOGLE_API_KEY\")\n", "\n", "gemini = OpenAI(\n", " base_url=GEMINI_BASE_URL,\n", " api_key=google_api_key\n", ")\n", "\n", "response = gemini.chat.completions.create(\n", " model=\"gemini-2.0-flash\", # best free-tier model\n", " messages=judge_messages,\n", ")\n", "\n", "results = response.choices[0].message.content\n", "print(results)\n" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Rank 1: gemini-2.0-flash\n" ] } ], "source": [ "# OK let's turn this into results!\n", "\n", "results_dict = json.loads(results)\n", "ranks = results_dict[\"results\"]\n", "for index, result in enumerate(ranks):\n", " competitor = competitors[int(result)-1]\n", " print(f\"Rank {index+1}: {competitor}\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", " \n", " \n", " \n", " \n", "
\n", " \n", " \n", "

Exercise

\n", " Which pattern(s) did this use? Try updating this to add another Agentic design pattern.\n", " \n", "
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", " \n", " \n", " \n", " \n", "
\n", " \n", " \n", "

Commercial implications

\n", " These kinds of patterns - to send a task to multiple models, and evaluate results,\n", " are common where you need to improve the quality of your LLM response. This approach can be universally applied\n", " to business projects where accuracy is critical.\n", " \n", "
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Orchestrator–Worker Pattern" ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [], "source": [ "\n", "import os\n", "import json\n", "from dotenv import load_dotenv\n", "from openai import OpenAI\n", "from anthropic import Anthropic\n", "from IPython.display import Markdown, display" ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "True" ] }, "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], "source": [ "load_dotenv(override=True)" ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [], "source": [ "GOOGLE_API_KEY = os.getenv(\"GOOGLE_API_KEY\")\n", "GEMINI_BASE_URL = \"https://generativelanguage.googleapis.com/v1beta/openai/\"" ] }, { "cell_type": "code", "execution_count": 22, "metadata": {}, "outputs": [], "source": [ "# Create Gemini client\n", "gemini = OpenAI(\n", " base_url=GEMINI_BASE_URL,\n", " api_key=GOOGLE_API_KEY\n", ")" ] }, { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [], "source": [ "def gemini_safe_request(messages):\n", " retries = 5\n", " for i in range(retries):\n", " try:\n", " return gemini.chat.completions.create(\n", " model=\"gemini-2.0-flash\",\n", " messages=messages\n", " )\n", " except Exception as e:\n", " if \"429\" in str(e):\n", " wait = (2 ** i)\n", " print(f\"⚠️ Rate limit hit. Retrying in {wait} seconds...\")\n", " time.sleep(wait)\n", " else:\n", " raise e\n", " raise Exception(\"❌ Max retries reached. Try again later.\")\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "ORCHESTRATOR–WORKER START\n" ] }, { "cell_type": "code", "execution_count": 24, "metadata": {}, "outputs": [], "source": [ "def orchestrator(user_question):\n", " \"\"\"\n", " The orchestrator controls everything:\n", " 1 - sends question to Worker A\n", " 2 - sends Worker A's answer to Worker B for critique\n", " 3 - sends both to Worker C for improvement\n", " 4 - returns final improved answer\n", " \"\"\"\n", "\n", " print(\"\\n Orchestrator: Sending question to Worker A...\")\n", " workerA_output = worker_A_generate(user_question)\n", "\n", " print(\"\\n Orchestrator: Sending Worker A output to Worker B...\")\n", " workerB_output = worker_B_critic(workerA_output)\n", "\n", " print(\"\\n Orchestrator: Sending both outputs to Worker C...\")\n", " final_output = worker_C_improver(workerA_output, workerB_output)\n", "\n", " print(\"\\n Final Improved Answer:\\n\")\n", " print(final_output)\n", " return final_output\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "WORKER A: Generate answer" ] }, { "cell_type": "code", "execution_count": 25, "metadata": {}, "outputs": [], "source": [ "def worker_A_generate(question):\n", " messages = [\n", " {\"role\": \"system\", \"content\": \"You are Worker A. Provide a direct answer.\"},\n", " {\"role\": \"user\", \"content\": question}\n", " ]\n", " response = gemini_safe_request(messages)\n", " answer = response.choices[0].message.content\n", " print(\"Worker A Answer:\", answer)\n", " return answer" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "WORKER B: Critic\n" ] }, { "cell_type": "code", "execution_count": 26, "metadata": {}, "outputs": [], "source": [ "def worker_B_critic(answer):\n", " messages = [\n", " {\"role\": \"system\", \"content\": \"You are Worker B. Criticize the answer clearly with flaws, missing points, wrong assumptions.\"},\n", " {\"role\": \"user\", \"content\": f\"Critique this answer:\\n\\n{answer}\"}\n", " ]\n", " response = gemini_safe_request(messages)\n", " critique = response.choices[0].message.content\n", " print(\"Worker B Critique:\", critique)\n", " return critique\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "WORKER C: Improve final output" ] }, { "cell_type": "code", "execution_count": 27, "metadata": {}, "outputs": [], "source": [ "def worker_C_improver(answer, critique):\n", " messages = [\n", " {\"role\": \"system\", \"content\": \"You are Worker C. Improve the answer using the critique. Provide a clean final response.\"},\n", " {\"role\": \"user\", \"content\": f\"Original Answer:\\n{answer}\\n\\nCritique:\\n{critique}\\n\\nImprove it.\"}\n", " ]\n", " response = gemini_safe_request(messages)\n", " improved = response.choices[0].message.content\n", " print(\"Worker C Improved Answer:\", improved)\n", " return improved" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Run the orchestrator" ] }, { "cell_type": "code", "execution_count": 30, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", " Orchestrator: Sending question to Worker A...\n", "Worker A Answer: Classical computers use bits that are like switches, either on (1) or off (0). Quantum computers use \"qubits\" which can be both on and off *at the same time* thanks to quantum mechanics, allowing them to explore many possibilities simultaneously.\n", "\n", "\n", " Orchestrator: Sending Worker A output to Worker B...\n", "Worker B Critique: Okay, here's a critique of the provided answer, pointing out its flaws, missing points, and potentially misleading assumptions:\n", "\n", "**Flaws and Missing Points:**\n", "\n", "1. **Oversimplification and Potential Misunderstanding of Superposition:** The statement \"both on and off *at the same time*\" is a common but ultimately flawed way to describe superposition. It's easily misinterpreted as meaning a qubit is literally 50% on and 50% off, like a dimmer switch. The issue is that it misses the crucial concept of **probability amplitudes**. A qubit exists in a *probabilistic* combination of 0 and 1. It's not *both* at once in a classical sense, but rather exists in a state that *when measured*, will yield either 0 or 1 with a certain probability. The amplitudes associated with those states define those probabilities.\n", "\n", "2. **Missing the Importance of Entanglement:** The answer completely ignores **entanglement**, which is arguably *the* key resource that makes quantum computers potentially powerful. While superposition allows a qubit to exist in multiple states simultaneously, entanglement allows multiple qubits to be correlated in ways that are impossible for classical bits. This correlation is what enables quantum computers to perform computations that are intractable for classical machines. Without mentioning entanglement, you're only telling half the story (or less).\n", "\n", "3. **Lack of Context on Measurement:** The explanation doesn't emphasize that a qubit's state is only determined upon *measurement*. Before measurement, the qubit exists in a superposition. The act of measurement collapses the superposition into a definite 0 or 1. This collapse is fundamental to how quantum computation works and is absent from the explanation. This leads to a false image of qubits being some kind of magic that exists in both states all the time.\n", "\n", "4. **Ignoring Coherence:** Qubits don't stay in superposition forever. They are susceptible to **decoherence**, which is the loss of their quantum properties due to interaction with the environment. This is a major obstacle in building practical quantum computers, and neglecting it paints an unrealistically rosy picture. The time for which a qubit maintains its quantum state (coherence time) is a crucial factor determining the feasibility of a quantum computation.\n", "\n", "5. **\"Exploring Many Possibilities Simultaneously\" is Vague:** While technically true, the phrase \"explore many possibilities simultaneously\" doesn't adequately explain *how* this leads to a computational advantage. It needs to be linked to concepts like quantum parallelism and interference to illustrate the potential for exponential speedups. What kind of exploration does the quantum computer do?\n", "\n", "**Wrong Assumptions (or Implications):**\n", "\n", "* **Implies a Direct Analogy to Classical Switches:** The \"on/off\" switch analogy, while helpful for *introducing* the idea of a bit, can be detrimental when extended to qubits. It sets up a classical mindset that hinders understanding of the genuinely quantum aspects.\n", "\n", "**In summary:**\n", "\n", "The answer is a very basic, high-level introduction that sacrifices accuracy and completeness for simplicity. It's acceptable as a *very first* introduction, but it needs significant expansion and correction to avoid misleading the reader. It fails to capture the essence of quantum computation and misses key elements like entanglement, coherence, and the role of measurement. It's a good starting point, but needs much more work.\n", "\n", "\n", " Orchestrator: Sending both outputs to Worker C...\n", "Worker C Improved Answer: Okay, here's an improved explanation of the difference between classical bits and quantum bits (qubits), addressing the critique's points:\n", "\n", "\"Classical computers use bits, which are like switches that are either on (representing 1) or off (representing 0). Quantum computers, on the other hand, use *qubits*. Qubits leverage quantum mechanics to exist in a state of *superposition*. Unlike a bit that is definitively 0 or 1, a qubit exists in a probabilistic combination of both states *until measured*. This means that before measurement, a qubit isn't simply \"both 0 and 1 at the same time\" in a classical sense. Instead, it has a *probability amplitude* associated with both the 0 and 1 states. When we measure the qubit, it \"collapses\" into either 0 or 1, with the probability of each outcome determined by those amplitudes.\n", "\n", "Beyond superposition, another key feature of quantum computers is *entanglement*. This is a correlation between two or more qubits, where their fates are intertwined regardless of the distance separating them. Entanglement allows quantum computers to perform computations in ways impossible for classical computers, creating the potential for significant speedups in certain types of calculations.\n", "\n", "It's also important to understand that qubits are fragile. They are susceptible to *decoherence*, which is the loss of their quantum properties due to interactions with the environment. Maintaining *coherence* (the duration a qubit maintains its superposition) is a major challenge in building quantum computers.\n", "\n", "Because qubits can exist in superposition and be entangled, quantum computers can, in effect, explore many possibilities simultaneously. This *quantum parallelism*, combined with the way quantum interference can be controlled, allows quantum computers to potentially solve certain problems much faster than classical computers. However, this doesn't mean they are better for *all* problems; the advantage is problem-specific.\"\n", "\n", "\n", " Final Improved Answer:\n", "\n", "Okay, here's an improved explanation of the difference between classical bits and quantum bits (qubits), addressing the critique's points:\n", "\n", "\"Classical computers use bits, which are like switches that are either on (representing 1) or off (representing 0). Quantum computers, on the other hand, use *qubits*. Qubits leverage quantum mechanics to exist in a state of *superposition*. Unlike a bit that is definitively 0 or 1, a qubit exists in a probabilistic combination of both states *until measured*. This means that before measurement, a qubit isn't simply \"both 0 and 1 at the same time\" in a classical sense. Instead, it has a *probability amplitude* associated with both the 0 and 1 states. When we measure the qubit, it \"collapses\" into either 0 or 1, with the probability of each outcome determined by those amplitudes.\n", "\n", "Beyond superposition, another key feature of quantum computers is *entanglement*. This is a correlation between two or more qubits, where their fates are intertwined regardless of the distance separating them. Entanglement allows quantum computers to perform computations in ways impossible for classical computers, creating the potential for significant speedups in certain types of calculations.\n", "\n", "It's also important to understand that qubits are fragile. They are susceptible to *decoherence*, which is the loss of their quantum properties due to interactions with the environment. Maintaining *coherence* (the duration a qubit maintains its superposition) is a major challenge in building quantum computers.\n", "\n", "Because qubits can exist in superposition and be entangled, quantum computers can, in effect, explore many possibilities simultaneously. This *quantum parallelism*, combined with the way quantum interference can be controlled, allows quantum computers to potentially solve certain problems much faster than classical computers. However, this doesn't mean they are better for *all* problems; the advantage is problem-specific.\"\n", "\n" ] }, { "data": { "text/plain": [ "'Okay, here\\'s an improved explanation of the difference between classical bits and quantum bits (qubits), addressing the critique\\'s points:\\n\\n\"Classical computers use bits, which are like switches that are either on (representing 1) or off (representing 0). Quantum computers, on the other hand, use *qubits*. Qubits leverage quantum mechanics to exist in a state of *superposition*. Unlike a bit that is definitively 0 or 1, a qubit exists in a probabilistic combination of both states *until measured*. This means that before measurement, a qubit isn\\'t simply \"both 0 and 1 at the same time\" in a classical sense. Instead, it has a *probability amplitude* associated with both the 0 and 1 states. When we measure the qubit, it \"collapses\" into either 0 or 1, with the probability of each outcome determined by those amplitudes.\\n\\nBeyond superposition, another key feature of quantum computers is *entanglement*. This is a correlation between two or more qubits, where their fates are intertwined regardless of the distance separating them. Entanglement allows quantum computers to perform computations in ways impossible for classical computers, creating the potential for significant speedups in certain types of calculations.\\n\\nIt\\'s also important to understand that qubits are fragile. They are susceptible to *decoherence*, which is the loss of their quantum properties due to interactions with the environment. Maintaining *coherence* (the duration a qubit maintains its superposition) is a major challenge in building quantum computers.\\n\\nBecause qubits can exist in superposition and be entangled, quantum computers can, in effect, explore many possibilities simultaneously. This *quantum parallelism*, combined with the way quantum interference can be controlled, allows quantum computers to potentially solve certain problems much faster than classical computers. However, this doesn\\'t mean they are better for *all* problems; the advantage is problem-specific.\"\\n'" ] }, "execution_count": 30, "metadata": {}, "output_type": "execute_result" } ], "source": [ "user_question = \"Explain how quantum computers differ from classical computers in simple terms.\"\n", "orchestrator(user_question)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": ".venv", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.3" } }, "nbformat": 4, "nbformat_minor": 2 }