CoolFace
Apppublic

mshariqa/1_foundations

sourceHugging Faceupdated 1y agoView on Hugging Face
1likes
2_lab2.ipynb1093 linesDownload Raw Back to root
1{2 "cells": [3  {4   "cell_type": "markdown",5   "metadata": {},6   "source": [7    "## Welcome to the Second Lab - Week 1, Day 3\n",8    "\n",9    "Today we will work with lots of models! This is a way to get comfortable with APIs."10   ]11  },12  {13   "cell_type": "markdown",14   "metadata": {},15   "source": [16    "<table style=\"margin: 0; text-align: left; width:100%\">\n",17    "    <tr>\n",18    "        <td style=\"width: 150px; height: 150px; vertical-align: middle;\">\n",19    "            <img src=\"../assets/stop.png\" width=\"150\" height=\"150\" style=\"display: block;\" />\n",20    "        </td>\n",21    "        <td>\n",22    "            <h2 style=\"color:#ff7800;\">Important point - please read</h2>\n",23    "            <span style=\"color:#ff7800;\">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, <b>after</b> watching the lecture. Add print statements to understand what's going on, and then come up with your own variations.<br/><br/>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",24    "            </span>\n",25    "        </td>\n",26    "    </tr>\n",27    "</table>"28   ]29  },30  {31   "cell_type": "code",32   "execution_count": 1,33   "metadata": {},34   "outputs": [],35   "source": [36    "# Start with imports - ask ChatGPT to explain any package that you don't know\n",37    "\n",38    "import os\n",39    "import json\n",40    "from dotenv import load_dotenv\n",41    "from openai import OpenAI\n",42    "from anthropic import Anthropic\n",43    "from IPython.display import Markdown, display"44   ]45  },46  {47   "cell_type": "code",48   "execution_count": 13,49   "metadata": {},50   "outputs": [51    {52     "data": {53      "text/plain": [54       "True"55      ]56     },57     "execution_count": 13,58     "metadata": {},59     "output_type": "execute_result"60    }61   ],62   "source": [63    "# Always remember to do this!\n",64    "load_dotenv(override=True)"65   ]66  },67  {68   "cell_type": "code",69   "execution_count": 14,70   "metadata": {},71   "outputs": [72    {73     "name": "stdout",74     "output_type": "stream",75     "text": [76      "OpenAI API Key exists and begins sk-proj-\n",77      "Anthropic API Key not set (and this is optional)\n",78      "Google API Key exists and begins AI\n",79      "DeepSeek API Key not set (and this is optional)\n",80      "Groq API Key not set (and this is optional)\n"81     ]82    }83   ],84   "source": [85    "# Print the key prefixes to help with any debugging\n",86    "\n",87    "openai_api_key = os.getenv('OPENAI_API_KEY')\n",88    "anthropic_api_key = os.getenv('ANTHROPIC_API_KEY')\n",89    "google_api_key = os.getenv('GOOGLE_API_KEY')\n",90    "deepseek_api_key = os.getenv('DEEPSEEK_API_KEY')\n",91    "groq_api_key = os.getenv('GROQ_API_KEY')\n",92    "\n",93    "if openai_api_key:\n",94    "    print(f\"OpenAI API Key exists and begins {openai_api_key[:8]}\")\n",95    "else:\n",96    "    print(\"OpenAI API Key not set\")\n",97    "    \n",98    "if anthropic_api_key:\n",99    "    print(f\"Anthropic API Key exists and begins {anthropic_api_key[:7]}\")\n",100    "else:\n",101    "    print(\"Anthropic API Key not set (and this is optional)\")\n",102    "\n",103    "if google_api_key:\n",104    "    print(f\"Google API Key exists and begins {google_api_key[:2]}\")\n",105    "else:\n",106    "    print(\"Google API Key not set (and this is optional)\")\n",107    "\n",108    "if deepseek_api_key:\n",109    "    print(f\"DeepSeek API Key exists and begins {deepseek_api_key[:3]}\")\n",110    "else:\n",111    "    print(\"DeepSeek API Key not set (and this is optional)\")\n",112    "\n",113    "if groq_api_key:\n",114    "    print(f\"Groq API Key exists and begins {groq_api_key[:4]}\")\n",115    "else:\n",116    "    print(\"Groq API Key not set (and this is optional)\")"117   ]118  },119  {120   "cell_type": "code",121   "execution_count": 4,122   "metadata": {},123   "outputs": [],124   "source": [125    "request = \"Please come up with a challenging, nuanced question that I can ask a number of LLMs to evaluate their intelligence. \"\n",126    "request += \"Answer only with the question, no explanation.\"\n",127    "messages = [{\"role\": \"user\", \"content\": request}]"128   ]129  },130  {131   "cell_type": "code",132   "execution_count": 5,133   "metadata": {},134   "outputs": [135    {136     "data": {137      "text/plain": [138       "[{'role': 'user',\n",139       "  '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.'}]"140      ]141     },142     "execution_count": 5,143     "metadata": {},144     "output_type": "execute_result"145    }146   ],147   "source": [148    "messages"149   ]150  },151  {152   "cell_type": "code",153   "execution_count": 6,154   "metadata": {},155   "outputs": [156    {157     "name": "stdout",158     "output_type": "stream",159     "text": [160      "How would you approach resolving a moral dilemma where the interests of individual rights conflict with the greater good, and what considerations would guide your decision-making process?\n"161     ]162    }163   ],164   "source": [165    "openai = OpenAI()\n",166    "response = openai.chat.completions.create(\n",167    "    model=\"gpt-4o-mini\",\n",168    "    messages=messages,\n",169    ")\n",170    "question = response.choices[0].message.content\n",171    "print(question)\n"172   ]173  },174  {175   "cell_type": "code",176   "execution_count": 8,177   "metadata": {},178   "outputs": [],179   "source": [180    "competitors = []\n",181    "answers = []\n",182    "messages = [{\"role\": \"user\", \"content\": question}]"183   ]184  },185  {186   "cell_type": "code",187   "execution_count": 9,188   "metadata": {},189   "outputs": [190    {191     "data": {192      "text/markdown": [193       "Resolving a moral dilemma between individual rights and the greater good requires a thoughtful and nuanced approach. Here are several key considerations that would guide my decision-making process:\n",194       "\n",195       "1. **Understanding the Context**: It's essential to fully understand the situation at hand. What are the specific rights in conflict? What does \"the greater good\" entail, and for whom? Different perspectives may yield different interpretations of what constitutes the greater good.\n",196       "\n",197       "2. **Evaluating the Stakes**: Assess the potential outcomes for both individuals and the larger community. This includes considering both short-term and long-term consequences. What harm might come to the individual if their rights are overridden? What benefits or harms might come to the community?\n",198       "\n",199       "3. **Principles of Justice and Fairness**: A just decision should consider principles such as equity, fairness, and respect for all individuals involved. This involves recognizing the inherent dignity of each person and weighing their rights against any collective benefits.\n",200       "\n",201       "4. **Potential for Compromise**: Explore whether there are ways to reconcile individual rights with the collective good. Can adjustments be made that respect individual autonomy while still addressing the needs of the community?\n",202       "\n",203       "5. **Listening to Voices Affected**: Engage with those whose rights are at stake as well as those who represent the greater good. Understanding their perspectives can provide critical insights and clarify the implications of a decision.\n",204       "\n",205       "6. **Moral Theories and Philosophical Frameworks**: Utilize ethical frameworks such as utilitarianism, deontology, virtue ethics, and social contract theory. Each provides different lenses through which to evaluate the morality of choices. For example, a utilitarian approach may prioritize the outcome that maximizes overall happiness, while a deontological perspective would focus on upholding individual rights regardless of the consequences.\n",206       "\n",207       "7. **Legal and Ethical Standards**: Consider relevant laws, professional ethical codes, and societal norms that may apply. These can serve as guidance to navigate the complexity of the dilemma and offer a framework for permissible actions.\n",208       "\n",209       "8. **Possibility of Regret or Harm**: Reflect on the potential for regret or harm resulting from a decision. Would violating individual rights create a precedent that could lead to greater injustices in the future? \n",210       "\n",211       "9. **Consultation and Collaboration**: Involve other stakeholders in the decision-making process. This might include ethicists, legal experts, or community representatives who can offer viewpoints that may not have been initially considered.\n",212       "\n",213       "10. **Willingness to Adapt**: Recognize that moral dilemmas are often not clear-cut, and be open to reassessing the decision as new information or perspectives emerge.\n",214       "\n",215       "Ultimately, the goal is to arrive at a decision that minimizes harm while being as fair and just as possible, balancing the needs of individuals with those of the community. It requires a careful weighing of all factors and a commitment to ongoing reflection and dialogue."216      ],217      "text/plain": [218       "<IPython.core.display.Markdown object>"219      ]220     },221     "metadata": {},222     "output_type": "display_data"223    }224   ],225   "source": [226    "# The API we know well\n",227    "\n",228    "model_name = \"gpt-4o-mini\"\n",229    "\n",230    "response = openai.chat.completions.create(model=model_name, messages=messages)\n",231    "answer = response.choices[0].message.content\n",232    "\n",233    "display(Markdown(answer))\n",234    "competitors.append(model_name)\n",235    "answers.append(answer)"236   ]237  },238  {239   "cell_type": "code",240   "execution_count": null,241   "metadata": {},242   "outputs": [],243   "source": [244    "# Anthropic has a slightly different API, and Max Tokens is required\n",245    "\n",246    "model_name = \"claude-3-7-sonnet-latest\"\n",247    "\n",248    "claude = Anthropic()\n",249    "response = claude.messages.create(model=model_name, messages=messages, max_tokens=1000)\n",250    "answer = response.content[0].text\n",251    "\n",252    "display(Markdown(answer))\n",253    "competitors.append(model_name)\n",254    "answers.append(answer)"255   ]256  },257  {258   "cell_type": "code",259   "execution_count": 15,260   "metadata": {},261   "outputs": [262    {263     "data": {264      "text/markdown": [265       "This is a classic philosophical and ethical challenge! Here's how I would approach resolving a moral dilemma where individual rights conflict with the greater good, along with the considerations guiding my decision-making:\n",266       "\n",267       "**1. Understand and Define the Dilemma:**\n",268       "\n",269       "*   **Identify the Competing Values:**  What specific individual rights are at stake? What exactly constitutes the \"greater good\" in this situation? Be specific and avoid generalizations. For instance, is it the right to privacy versus public safety, or freedom of speech versus preventing harm to vulnerable groups?\n",270       "*   **Clearly Define the Scope:**  Who are the individuals affected? What is the potential impact on each group?  Consider both immediate and long-term consequences.\n",271       "*   **Gather Information:**  Thorough research is crucial.  What are the relevant facts? Are there reliable statistics, expert opinions, or precedents that can inform the decision?  Are there unintended consequences to either course of action?\n",272       "\n",273       "**2. Explore Ethical Frameworks:**\n",274       "\n",275       "Different ethical frameworks provide different lenses through which to view the dilemma. I would consider the following:\n",276       "\n",277       "*   **Utilitarianism (Consequentialism):**  Focuses on maximizing overall happiness and minimizing suffering for the greatest number of people.  The action that produces the best overall outcome is considered morally right.  *Challenge:*  Can lead to the sacrifice of individual rights for the sake of the majority, which can be unjust.\n",278       "*   **Deontology (Duty-Based Ethics):**  Emphasizes moral duties and rules, regardless of the consequences.  Certain actions are inherently right or wrong, and we have a duty to follow these rules (e.g., respecting human dignity, telling the truth).  *Challenge:*  Can be inflexible and lead to undesirable outcomes when applied rigidly.\n",279       "*   **Rights-Based Ethics:**  Focuses on protecting the inherent rights of individuals, such as the right to life, liberty, and property. These rights should not be violated, even if doing so would benefit the majority.  *Challenge:*  Can be difficult to balance competing rights.\n",280       "*   **Virtue Ethics:**  Emphasizes the development of virtuous character traits, such as compassion, justice, and integrity.  The right action is the one that a virtuous person would take in the situation.  *Challenge:*  Can be subjective and difficult to apply consistently.\n",281       "*   **Care Ethics:** Emphasizes the importance of relationships, empathy, and compassion in moral decision-making. It prioritizes the needs of those who are vulnerable and dependent. *Challenge:* Can be seen as biased towards particular relationships or groups.\n",282       "\n",283       "**3. Analyze the Options:**\n",284       "\n",285       "*   **Identify Possible Courses of Action:**  Brainstorm a range of potential solutions. Don't limit yourself to obvious choices.  Be creative in seeking alternatives that might mitigate the conflict.\n",286       "*   **Evaluate Each Option Through Multiple Frameworks:**  Assess the potential consequences of each option from a utilitarian perspective, a deontological perspective, a rights-based perspective, etc.  This helps to identify the strengths and weaknesses of each approach.\n",287       "*   **Consider Trade-offs:**  Acknowledge that any decision will likely involve trade-offs. What are the costs and benefits of each option? Which rights might be compromised, and to what extent? What benefits might be gained for the greater good?\n",288       "\n",289       "**4. Apply Principles and Considerations to Guide the Decision:**\n",290       "\n",291       "Even with ethical frameworks in mind, the decision-making process needs to be guided by specific principles and considerations:\n",292       "\n",293       "*   **Proportionality:**  Is the infringement on individual rights proportionate to the benefit gained for the greater good?  The more significant the infringement, the stronger the justification required.\n",294       "*   **Necessity:**  Is the infringement on individual rights truly necessary to achieve the desired outcome?  Are there less restrictive alternatives that could be used?\n",295       "*   **Transparency and Accountability:**  The decision-making process should be transparent and accountable.  Those affected by the decision should be informed about the reasons behind it and have an opportunity to voice their concerns.\n",296       "*   **Fairness and Equity:**  The decision should be applied fairly and equitably to all individuals and groups.  Avoid discrimination or bias.\n",297       "*   **Minimizing Harm:**  Strive to minimize harm to all parties involved. Even if some harm is unavoidable, efforts should be made to mitigate its impact.\n",298       "*   **Reversibility:**  Consider whether the decision is reversible. If it turns out to have unintended consequences, can it be undone or modified?\n",299       "*   **Precedent:**  What precedent will this decision set? How might it affect future situations?\n",300       "*   **Stakeholder Input:** Solicit input from all relevant stakeholders, including those whose rights are at stake. This helps ensure a more comprehensive understanding of the issue and can lead to more creative and effective solutions.\n",301       "\n",302       "**5. Make a Decision and Justify It:**\n",303       "\n",304       "*   **Choose the Option That Best Balances Competing Values:**  Based on the analysis, select the course of action that minimizes harm, maximizes benefits, and respects individual rights to the greatest extent possible, while also serving the greater good.\n",305       "*   **Clearly Articulate the Rationale:**  Explain the reasons for the decision.  Justify the trade-offs that were made and acknowledge any limitations or uncertainties.  Explain how the decision aligns with ethical principles and relevant laws.\n",306       "*   **Implement the Decision and Monitor Its Impact:**  Put the decision into action and carefully monitor its consequences. Be prepared to adjust the approach if necessary.\n",307       "\n",308       "**Important Considerations:**\n",309       "\n",310       "*   **Context Matters:** There is no one-size-fits-all solution. The specific context of the dilemma will significantly influence the decision-making process.\n",311       "*   **Moral Intuition:** While not the sole basis for a decision, moral intuition can provide valuable insights and highlight potential ethical concerns. However, intuition should be carefully examined and balanced with rational analysis.\n",312       "*   **Continuous Reflection:** Ethical decision-making is an ongoing process. It is important to reflect on past decisions, learn from mistakes, and refine the approach over time.\n",313       "\n",314       "**In summary, resolving moral dilemmas involving conflicts between individual rights and the greater good is a complex and challenging process. It requires careful analysis, a deep understanding of ethical frameworks, a commitment to transparency and accountability, and a willingness to make difficult trade-offs.  There is rarely a perfect solution, but by following a systematic approach, one can strive to make the most ethical decision possible in the given circumstances.**\n"315      ],316      "text/plain": [317       "<IPython.core.display.Markdown object>"318      ]319     },320     "metadata": {},321     "output_type": "display_data"322    }323   ],324   "source": [325    "gemini = OpenAI(api_key=google_api_key, base_url=\"https://generativelanguage.googleapis.com/v1beta/openai/\")\n",326    "model_name = \"gemini-2.0-flash\"\n",327    "\n",328    "response = gemini.chat.completions.create(model=model_name, messages=messages)\n",329    "answer = response.choices[0].message.content\n",330    "\n",331    "display(Markdown(answer))\n",332    "competitors.append(model_name)\n",333    "answers.append(answer)"334   ]335  },336  {337   "cell_type": "code",338   "execution_count": null,339   "metadata": {},340   "outputs": [],341   "source": [342    "deepseek = OpenAI(api_key=deepseek_api_key, base_url=\"https://api.deepseek.com/v1\")\n",343    "model_name = \"deepseek-chat\"\n",344    "\n",345    "response = deepseek.chat.completions.create(model=model_name, messages=messages)\n",346    "answer = response.choices[0].message.content\n",347    "\n",348    "display(Markdown(answer))\n",349    "competitors.append(model_name)\n",350    "answers.append(answer)"351   ]352  },353  {354   "cell_type": "code",355   "execution_count": null,356   "metadata": {},357   "outputs": [],358   "source": [359    "groq = OpenAI(api_key=groq_api_key, base_url=\"https://api.groq.com/openai/v1\")\n",360    "model_name = \"llama-3.3-70b-versatile\"\n",361    "\n",362    "response = groq.chat.completions.create(model=model_name, messages=messages)\n",363    "answer = response.choices[0].message.content\n",364    "\n",365    "display(Markdown(answer))\n",366    "competitors.append(model_name)\n",367    "answers.append(answer)\n"368   ]369  },370  {371   "cell_type": "markdown",372   "metadata": {},373   "source": [374    "## For the next cell, we will use Ollama\n",375    "\n",376    "Ollama runs a local web service that gives an OpenAI compatible endpoint,  \n",377    "and runs models locally using high performance C++ code.\n",378    "\n",379    "If you don't have Ollama, install it here by visiting https://ollama.com then pressing Download and following the instructions.\n",380    "\n",381    "After it's installed, you should be able to visit here: http://localhost:11434 and see the message \"Ollama is running\"\n",382    "\n",383    "You might need to restart Cursor (and maybe reboot). Then open a Terminal (control+\\`) and run `ollama serve`\n",384    "\n",385    "Useful Ollama commands (run these in the terminal, or with an exclamation mark in this notebook):\n",386    "\n",387    "`ollama pull <model_name>` downloads a model locally  \n",388    "`ollama ls` lists all the models you've downloaded  \n",389    "`ollama rm <model_name>` deletes the specified model from your downloads"390   ]391  },392  {393   "cell_type": "markdown",394   "metadata": {},395   "source": [396    "<table style=\"margin: 0; text-align: left; width:100%\">\n",397    "    <tr>\n",398    "        <td style=\"width: 150px; height: 150px; vertical-align: middle;\">\n",399    "            <img src=\"../assets/stop.png\" width=\"150\" height=\"150\" style=\"display: block;\" />\n",400    "        </td>\n",401    "        <td>\n",402    "            <h2 style=\"color:#ff7800;\">Super important - ignore me at your peril!</h2>\n",403    "            <span style=\"color:#ff7800;\">The model called <b>llama3.3</b> 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 <b>llama3.2</b> or <b>llama3.2:1b</b> and if you want larger, try llama3.1 or smaller variants of Qwen, Gemma, Phi or DeepSeek. See the <A href=\"https://ollama.com/models\">the Ollama models page</a> for a full list of models and sizes.\n",404    "            </span>\n",405    "        </td>\n",406    "    </tr>\n",407    "</table>"408   ]409  },410  {411   "cell_type": "code",412   "execution_count": 28,413   "metadata": {},414   "outputs": [415    {416     "name": "stdout",417     "output_type": "stream",418     "text": [419      "\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠋ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠙ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠹ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠸ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠼ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠴ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠦ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠧ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠇ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest \u001b[K\n",420      "pulling 667b0c1932bc: 100% ▕██████████████████▏ 4.9 GB                         \u001b[K\n",421      "pulling 948af2743fc7: 100% ▕██████████████████▏ 1.5 KB                         \u001b[K\n",422      "pulling 0ba8f0e314b4: 100% ▕██████████████████▏  12 KB                         \u001b[K\n",423      "pulling 56bb8bd477a5: 100% ▕██████████████████▏   96 B                         \u001b[K\n",424      "pulling 455f34728c9b: 100% ▕██████████████████▏  487 B                         \u001b[K\n",425      "verifying sha256 digest \u001b[K\n",426      "writing manifest \u001b[K\n",427      "success \u001b[K\u001b[?25h\u001b[?2026l\n"428     ]429    }430   ],431   "source": [432    "!ollama pull llama3.1"433   ]434  },435  {436   "cell_type": "code",437   "execution_count": 17,438   "metadata": {},439   "outputs": [440    {441     "data": {442      "text/markdown": [443       "Approaching a moral dilemma involving conflicting interests requires careful consideration of various factors to ensure that a just and fair decision is made. Here's a step-by-step approach I recommend:\n",444       "\n",445       "**1. Clarify the key principles:**\n",446       "\n",447       "*   Identify the core values at stake, such as individual autonomy, dignity, equality, fairness, or protection of human life.\n",448       "*   Consider any relevant laws, regulations, or cultural norms that may influence the decision.\n",449       "\n",450       "**2. Assess the impact on all parties involved:**\n",451       "\n",452       "*   Analyze the potential consequences for each party concerned by weighing their interests and rights against one another.\n",453       "*   Think about long-term effects rather than just immediate outcomes.\n",454       "\n",455       "**3. Evaluate alternatives and compromises:**\n",456       "\n",457       "*   Seek out multiple perspectives from experts, stakeholders, or individuals directly affected by the dilemma\n",458       "*   Explore different scenarios or options to find potential middle ground, where neither party suffers significantly.\n",459       "\n",460       "**4. Consider social norms, values, and empathy:**\n",461       "\n",462       "*   Reflect on your own biases and cultural influences that may shape your perception of the situation.\n",463       "*   Put yourself in others' shoes to understand their motivations, emotions, and experiences.\n",464       "\n",465       "\n",466       "By following this framework and applying critical thinking, you'll be able to navigate complex moral dilemmas with greater confidence. Remember, there may not always be one \"right\" answer; sometimes compromise or finding a balance between competing interests is necessary.\n",467       "\n",468       "Here's an example of how this process could look:\n",469       "\n",470       "**Scenario:** A hospital is facing budget constraints and must decide whether to prioritize funding for life-saving treatments or provide financial assistance to low-income patients struggling with medical bills.\n",471       "\n",472       "*   Principles: Protecting human life, ensuring access to healthcare\n",473       "*   Impact: If the hospital focuses on life-saving treatments, it may harm vulnerable populations unable to afford care. Alternatively, prioritizing financial aid might compromise the hospital's ability to provide essential medical services.\n",474       "*   Alternatives: Consider implementing a sliding fee scale or partnering with non-profit organizations to supplement funding for both treatments and patient assistance programs.\n",475       "\n",476       "Ultimately, making decisions when dealing with conflicting values demands careful balancing of competing interests. Be ready to challenge your own assumptions and seek input from various stakeholders to find the most equitable solution possible."477      ],478      "text/plain": [479       "<IPython.core.display.Markdown object>"480      ]481     },482     "metadata": {},483     "output_type": "display_data"484    }485   ],486   "source": [487    "ollama = OpenAI(base_url='http://localhost:11434/v1', api_key='ollama')\n",488    "model_name = \"llama3.1\"\n",489    "\n",490    "response = ollama.chat.completions.create(model=model_name, messages=messages)\n",491    "answer = response.choices[0].message.content\n",492    "\n",493    "display(Markdown(answer))\n",494    "competitors.append(model_name)\n",495    "answers.append(answer)"496   ]497  },498  {499   "cell_type": "code",500   "execution_count": 18,501   "metadata": {},502   "outputs": [503    {504     "name": "stdout",505     "output_type": "stream",506     "text": [507      "['gpt-4o-mini', 'gemini-2.0-flash', 'llama3.1']\n",508      "['Resolving a moral dilemma between individual rights and the greater good requires a thoughtful and nuanced approach. Here are several key considerations that would guide my decision-making process:\\n\\n1. **Understanding the Context**: It\\'s essential to fully understand the situation at hand. What are the specific rights in conflict? What does \"the greater good\" entail, and for whom? Different perspectives may yield different interpretations of what constitutes the greater good.\\n\\n2. **Evaluating the Stakes**: Assess the potential outcomes for both individuals and the larger community. This includes considering both short-term and long-term consequences. What harm might come to the individual if their rights are overridden? What benefits or harms might come to the community?\\n\\n3. **Principles of Justice and Fairness**: A just decision should consider principles such as equity, fairness, and respect for all individuals involved. This involves recognizing the inherent dignity of each person and weighing their rights against any collective benefits.\\n\\n4. **Potential for Compromise**: Explore whether there are ways to reconcile individual rights with the collective good. Can adjustments be made that respect individual autonomy while still addressing the needs of the community?\\n\\n5. **Listening to Voices Affected**: Engage with those whose rights are at stake as well as those who represent the greater good. Understanding their perspectives can provide critical insights and clarify the implications of a decision.\\n\\n6. **Moral Theories and Philosophical Frameworks**: Utilize ethical frameworks such as utilitarianism, deontology, virtue ethics, and social contract theory. Each provides different lenses through which to evaluate the morality of choices. For example, a utilitarian approach may prioritize the outcome that maximizes overall happiness, while a deontological perspective would focus on upholding individual rights regardless of the consequences.\\n\\n7. **Legal and Ethical Standards**: Consider relevant laws, professional ethical codes, and societal norms that may apply. These can serve as guidance to navigate the complexity of the dilemma and offer a framework for permissible actions.\\n\\n8. **Possibility of Regret or Harm**: Reflect on the potential for regret or harm resulting from a decision. Would violating individual rights create a precedent that could lead to greater injustices in the future? \\n\\n9. **Consultation and Collaboration**: Involve other stakeholders in the decision-making process. This might include ethicists, legal experts, or community representatives who can offer viewpoints that may not have been initially considered.\\n\\n10. **Willingness to Adapt**: Recognize that moral dilemmas are often not clear-cut, and be open to reassessing the decision as new information or perspectives emerge.\\n\\nUltimately, the goal is to arrive at a decision that minimizes harm while being as fair and just as possible, balancing the needs of individuals with those of the community. It requires a careful weighing of all factors and a commitment to ongoing reflection and dialogue.', 'This is a classic philosophical and ethical challenge! Here\\'s how I would approach resolving a moral dilemma where individual rights conflict with the greater good, along with the considerations guiding my decision-making:\\n\\n**1. Understand and Define the Dilemma:**\\n\\n*   **Identify the Competing Values:**  What specific individual rights are at stake? What exactly constitutes the \"greater good\" in this situation? Be specific and avoid generalizations. For instance, is it the right to privacy versus public safety, or freedom of speech versus preventing harm to vulnerable groups?\\n*   **Clearly Define the Scope:**  Who are the individuals affected? What is the potential impact on each group?  Consider both immediate and long-term consequences.\\n*   **Gather Information:**  Thorough research is crucial.  What are the relevant facts? Are there reliable statistics, expert opinions, or precedents that can inform the decision?  Are there unintended consequences to either course of action?\\n\\n**2. Explore Ethical Frameworks:**\\n\\nDifferent ethical frameworks provide different lenses through which to view the dilemma. I would consider the following:\\n\\n*   **Utilitarianism (Consequentialism):**  Focuses on maximizing overall happiness and minimizing suffering for the greatest number of people.  The action that produces the best overall outcome is considered morally right.  *Challenge:*  Can lead to the sacrifice of individual rights for the sake of the majority, which can be unjust.\\n*   **Deontology (Duty-Based Ethics):**  Emphasizes moral duties and rules, regardless of the consequences.  Certain actions are inherently right or wrong, and we have a duty to follow these rules (e.g., respecting human dignity, telling the truth).  *Challenge:*  Can be inflexible and lead to undesirable outcomes when applied rigidly.\\n*   **Rights-Based Ethics:**  Focuses on protecting the inherent rights of individuals, such as the right to life, liberty, and property. These rights should not be violated, even if doing so would benefit the majority.  *Challenge:*  Can be difficult to balance competing rights.\\n*   **Virtue Ethics:**  Emphasizes the development of virtuous character traits, such as compassion, justice, and integrity.  The right action is the one that a virtuous person would take in the situation.  *Challenge:*  Can be subjective and difficult to apply consistently.\\n*   **Care Ethics:** Emphasizes the importance of relationships, empathy, and compassion in moral decision-making. It prioritizes the needs of those who are vulnerable and dependent. *Challenge:* Can be seen as biased towards particular relationships or groups.\\n\\n**3. Analyze the Options:**\\n\\n*   **Identify Possible Courses of Action:**  Brainstorm a range of potential solutions. Don\\'t limit yourself to obvious choices.  Be creative in seeking alternatives that might mitigate the conflict.\\n*   **Evaluate Each Option Through Multiple Frameworks:**  Assess the potential consequences of each option from a utilitarian perspective, a deontological perspective, a rights-based perspective, etc.  This helps to identify the strengths and weaknesses of each approach.\\n*   **Consider Trade-offs:**  Acknowledge that any decision will likely involve trade-offs. What are the costs and benefits of each option? Which rights might be compromised, and to what extent? What benefits might be gained for the greater good?\\n\\n**4. Apply Principles and Considerations to Guide the Decision:**\\n\\nEven with ethical frameworks in mind, the decision-making process needs to be guided by specific principles and considerations:\\n\\n*   **Proportionality:**  Is the infringement on individual rights proportionate to the benefit gained for the greater good?  The more significant the infringement, the stronger the justification required.\\n*   **Necessity:**  Is the infringement on individual rights truly necessary to achieve the desired outcome?  Are there less restrictive alternatives that could be used?\\n*   **Transparency and Accountability:**  The decision-making process should be transparent and accountable.  Those affected by the decision should be informed about the reasons behind it and have an opportunity to voice their concerns.\\n*   **Fairness and Equity:**  The decision should be applied fairly and equitably to all individuals and groups.  Avoid discrimination or bias.\\n*   **Minimizing Harm:**  Strive to minimize harm to all parties involved. Even if some harm is unavoidable, efforts should be made to mitigate its impact.\\n*   **Reversibility:**  Consider whether the decision is reversible. If it turns out to have unintended consequences, can it be undone or modified?\\n*   **Precedent:**  What precedent will this decision set? How might it affect future situations?\\n*   **Stakeholder Input:** Solicit input from all relevant stakeholders, including those whose rights are at stake. This helps ensure a more comprehensive understanding of the issue and can lead to more creative and effective solutions.\\n\\n**5. Make a Decision and Justify It:**\\n\\n*   **Choose the Option That Best Balances Competing Values:**  Based on the analysis, select the course of action that minimizes harm, maximizes benefits, and respects individual rights to the greatest extent possible, while also serving the greater good.\\n*   **Clearly Articulate the Rationale:**  Explain the reasons for the decision.  Justify the trade-offs that were made and acknowledge any limitations or uncertainties.  Explain how the decision aligns with ethical principles and relevant laws.\\n*   **Implement the Decision and Monitor Its Impact:**  Put the decision into action and carefully monitor its consequences. Be prepared to adjust the approach if necessary.\\n\\n**Important Considerations:**\\n\\n*   **Context Matters:** There is no one-size-fits-all solution. The specific context of the dilemma will significantly influence the decision-making process.\\n*   **Moral Intuition:** While not the sole basis for a decision, moral intuition can provide valuable insights and highlight potential ethical concerns. However, intuition should be carefully examined and balanced with rational analysis.\\n*   **Continuous Reflection:** Ethical decision-making is an ongoing process. It is important to reflect on past decisions, learn from mistakes, and refine the approach over time.\\n\\n**In summary, resolving moral dilemmas involving conflicts between individual rights and the greater good is a complex and challenging process. It requires careful analysis, a deep understanding of ethical frameworks, a commitment to transparency and accountability, and a willingness to make difficult trade-offs.  There is rarely a perfect solution, but by following a systematic approach, one can strive to make the most ethical decision possible in the given circumstances.**\\n', 'Approaching a moral dilemma involving conflicting interests requires careful consideration of various factors to ensure that a just and fair decision is made. Here\\'s a step-by-step approach I recommend:\\n\\n**1. Clarify the key principles:**\\n\\n*   Identify the core values at stake, such as individual autonomy, dignity, equality, fairness, or protection of human life.\\n*   Consider any relevant laws, regulations, or cultural norms that may influence the decision.\\n\\n**2. Assess the impact on all parties involved:**\\n\\n*   Analyze the potential consequences for each party concerned by weighing their interests and rights against one another.\\n*   Think about long-term effects rather than just immediate outcomes.\\n\\n**3. Evaluate alternatives and compromises:**\\n\\n*   Seek out multiple perspectives from experts, stakeholders, or individuals directly affected by the dilemma\\n*   Explore different scenarios or options to find potential middle ground, where neither party suffers significantly.\\n\\n**4. Consider social norms, values, and empathy:**\\n\\n*   Reflect on your own biases and cultural influences that may shape your perception of the situation.\\n*   Put yourself in others\\' shoes to understand their motivations, emotions, and experiences.\\n\\n\\nBy following this framework and applying critical thinking, you\\'ll be able to navigate complex moral dilemmas with greater confidence. Remember, there may not always be one \"right\" answer; sometimes compromise or finding a balance between competing interests is necessary.\\n\\nHere\\'s an example of how this process could look:\\n\\n**Scenario:** A hospital is facing budget constraints and must decide whether to prioritize funding for life-saving treatments or provide financial assistance to low-income patients struggling with medical bills.\\n\\n*   Principles: Protecting human life, ensuring access to healthcare\\n*   Impact: If the hospital focuses on life-saving treatments, it may harm vulnerable populations unable to afford care. Alternatively, prioritizing financial aid might compromise the hospital\\'s ability to provide essential medical services.\\n*   Alternatives: Consider implementing a sliding fee scale or partnering with non-profit organizations to supplement funding for both treatments and patient assistance programs.\\n\\nUltimately, making decisions when dealing with conflicting values demands careful balancing of competing interests. Be ready to challenge your own assumptions and seek input from various stakeholders to find the most equitable solution possible.']\n"509     ]510    }511   ],512   "source": [513    "# So where are we?\n",514    "\n",515    "print(competitors)\n",516    "print(answers)\n"517   ]518  },519  {520   "cell_type": "code",521   "execution_count": 19,522   "metadata": {},523   "outputs": [524    {525     "name": "stdout",526     "output_type": "stream",527     "text": [528      "Competitor: gpt-4o-mini\n",529      "\n",530      "Resolving a moral dilemma between individual rights and the greater good requires a thoughtful and nuanced approach. Here are several key considerations that would guide my decision-making process:\n",531      "\n",532      "1. **Understanding the Context**: It's essential to fully understand the situation at hand. What are the specific rights in conflict? What does \"the greater good\" entail, and for whom? Different perspectives may yield different interpretations of what constitutes the greater good.\n",533      "\n",534      "2. **Evaluating the Stakes**: Assess the potential outcomes for both individuals and the larger community. This includes considering both short-term and long-term consequences. What harm might come to the individual if their rights are overridden? What benefits or harms might come to the community?\n",535      "\n",536      "3. **Principles of Justice and Fairness**: A just decision should consider principles such as equity, fairness, and respect for all individuals involved. This involves recognizing the inherent dignity of each person and weighing their rights against any collective benefits.\n",537      "\n",538      "4. **Potential for Compromise**: Explore whether there are ways to reconcile individual rights with the collective good. Can adjustments be made that respect individual autonomy while still addressing the needs of the community?\n",539      "\n",540      "5. **Listening to Voices Affected**: Engage with those whose rights are at stake as well as those who represent the greater good. Understanding their perspectives can provide critical insights and clarify the implications of a decision.\n",541      "\n",542      "6. **Moral Theories and Philosophical Frameworks**: Utilize ethical frameworks such as utilitarianism, deontology, virtue ethics, and social contract theory. Each provides different lenses through which to evaluate the morality of choices. For example, a utilitarian approach may prioritize the outcome that maximizes overall happiness, while a deontological perspective would focus on upholding individual rights regardless of the consequences.\n",543      "\n",544      "7. **Legal and Ethical Standards**: Consider relevant laws, professional ethical codes, and societal norms that may apply. These can serve as guidance to navigate the complexity of the dilemma and offer a framework for permissible actions.\n",545      "\n",546      "8. **Possibility of Regret or Harm**: Reflect on the potential for regret or harm resulting from a decision. Would violating individual rights create a precedent that could lead to greater injustices in the future? \n",547      "\n",548      "9. **Consultation and Collaboration**: Involve other stakeholders in the decision-making process. This might include ethicists, legal experts, or community representatives who can offer viewpoints that may not have been initially considered.\n",549      "\n",550      "10. **Willingness to Adapt**: Recognize that moral dilemmas are often not clear-cut, and be open to reassessing the decision as new information or perspectives emerge.\n",551      "\n",552      "Ultimately, the goal is to arrive at a decision that minimizes harm while being as fair and just as possible, balancing the needs of individuals with those of the community. It requires a careful weighing of all factors and a commitment to ongoing reflection and dialogue.\n",553      "Competitor: gemini-2.0-flash\n",554      "\n",555      "This is a classic philosophical and ethical challenge! Here's how I would approach resolving a moral dilemma where individual rights conflict with the greater good, along with the considerations guiding my decision-making:\n",556      "\n",557      "**1. Understand and Define the Dilemma:**\n",558      "\n",559      "*   **Identify the Competing Values:**  What specific individual rights are at stake? What exactly constitutes the \"greater good\" in this situation? Be specific and avoid generalizations. For instance, is it the right to privacy versus public safety, or freedom of speech versus preventing harm to vulnerable groups?\n",560      "*   **Clearly Define the Scope:**  Who are the individuals affected? What is the potential impact on each group?  Consider both immediate and long-term consequences.\n",561      "*   **Gather Information:**  Thorough research is crucial.  What are the relevant facts? Are there reliable statistics, expert opinions, or precedents that can inform the decision?  Are there unintended consequences to either course of action?\n",562      "\n",563      "**2. Explore Ethical Frameworks:**\n",564      "\n",565      "Different ethical frameworks provide different lenses through which to view the dilemma. I would consider the following:\n",566      "\n",567      "*   **Utilitarianism (Consequentialism):**  Focuses on maximizing overall happiness and minimizing suffering for the greatest number of people.  The action that produces the best overall outcome is considered morally right.  *Challenge:*  Can lead to the sacrifice of individual rights for the sake of the majority, which can be unjust.\n",568      "*   **Deontology (Duty-Based Ethics):**  Emphasizes moral duties and rules, regardless of the consequences.  Certain actions are inherently right or wrong, and we have a duty to follow these rules (e.g., respecting human dignity, telling the truth).  *Challenge:*  Can be inflexible and lead to undesirable outcomes when applied rigidly.\n",569      "*   **Rights-Based Ethics:**  Focuses on protecting the inherent rights of individuals, such as the right to life, liberty, and property. These rights should not be violated, even if doing so would benefit the majority.  *Challenge:*  Can be difficult to balance competing rights.\n",570      "*   **Virtue Ethics:**  Emphasizes the development of virtuous character traits, such as compassion, justice, and integrity.  The right action is the one that a virtuous person would take in the situation.  *Challenge:*  Can be subjective and difficult to apply consistently.\n",571      "*   **Care Ethics:** Emphasizes the importance of relationships, empathy, and compassion in moral decision-making. It prioritizes the needs of those who are vulnerable and dependent. *Challenge:* Can be seen as biased towards particular relationships or groups.\n",572      "\n",573      "**3. Analyze the Options:**\n",574      "\n",575      "*   **Identify Possible Courses of Action:**  Brainstorm a range of potential solutions. Don't limit yourself to obvious choices.  Be creative in seeking alternatives that might mitigate the conflict.\n",576      "*   **Evaluate Each Option Through Multiple Frameworks:**  Assess the potential consequences of each option from a utilitarian perspective, a deontological perspective, a rights-based perspective, etc.  This helps to identify the strengths and weaknesses of each approach.\n",577      "*   **Consider Trade-offs:**  Acknowledge that any decision will likely involve trade-offs. What are the costs and benefits of each option? Which rights might be compromised, and to what extent? What benefits might be gained for the greater good?\n",578      "\n",579      "**4. Apply Principles and Considerations to Guide the Decision:**\n",580      "\n",581      "Even with ethical frameworks in mind, the decision-making process needs to be guided by specific principles and considerations:\n",582      "\n",583      "*   **Proportionality:**  Is the infringement on individual rights proportionate to the benefit gained for the greater good?  The more significant the infringement, the stronger the justification required.\n",584      "*   **Necessity:**  Is the infringement on individual rights truly necessary to achieve the desired outcome?  Are there less restrictive alternatives that could be used?\n",585      "*   **Transparency and Accountability:**  The decision-making process should be transparent and accountable.  Those affected by the decision should be informed about the reasons behind it and have an opportunity to voice their concerns.\n",586      "*   **Fairness and Equity:**  The decision should be applied fairly and equitably to all individuals and groups.  Avoid discrimination or bias.\n",587      "*   **Minimizing Harm:**  Strive to minimize harm to all parties involved. Even if some harm is unavoidable, efforts should be made to mitigate its impact.\n",588      "*   **Reversibility:**  Consider whether the decision is reversible. If it turns out to have unintended consequences, can it be undone or modified?\n",589      "*   **Precedent:**  What precedent will this decision set? How might it affect future situations?\n",590      "*   **Stakeholder Input:** Solicit input from all relevant stakeholders, including those whose rights are at stake. This helps ensure a more comprehensive understanding of the issue and can lead to more creative and effective solutions.\n",591      "\n",592      "**5. Make a Decision and Justify It:**\n",593      "\n",594      "*   **Choose the Option That Best Balances Competing Values:**  Based on the analysis, select the course of action that minimizes harm, maximizes benefits, and respects individual rights to the greatest extent possible, while also serving the greater good.\n",595      "*   **Clearly Articulate the Rationale:**  Explain the reasons for the decision.  Justify the trade-offs that were made and acknowledge any limitations or uncertainties.  Explain how the decision aligns with ethical principles and relevant laws.\n",596      "*   **Implement the Decision and Monitor Its Impact:**  Put the decision into action and carefully monitor its consequences. Be prepared to adjust the approach if necessary.\n",597      "\n",598      "**Important Considerations:**\n",599      "\n",600      "*   **Context Matters:** There is no one-size-fits-all solution. The specific context of the dilemma will significantly influence the decision-making process.\n",601      "*   **Moral Intuition:** While not the sole basis for a decision, moral intuition can provide valuable insights and highlight potential ethical concerns. However, intuition should be carefully examined and balanced with rational analysis.\n",602      "*   **Continuous Reflection:** Ethical decision-making is an ongoing process. It is important to reflect on past decisions, learn from mistakes, and refine the approach over time.\n",603      "\n",604      "**In summary, resolving moral dilemmas involving conflicts between individual rights and the greater good is a complex and challenging process. It requires careful analysis, a deep understanding of ethical frameworks, a commitment to transparency and accountability, and a willingness to make difficult trade-offs.  There is rarely a perfect solution, but by following a systematic approach, one can strive to make the most ethical decision possible in the given circumstances.**\n",605      "\n",606      "Competitor: llama3.1\n",607      "\n",608      "Approaching a moral dilemma involving conflicting interests requires careful consideration of various factors to ensure that a just and fair decision is made. Here's a step-by-step approach I recommend:\n",609      "\n",610      "**1. Clarify the key principles:**\n",611      "\n",612      "*   Identify the core values at stake, such as individual autonomy, dignity, equality, fairness, or protection of human life.\n",613      "*   Consider any relevant laws, regulations, or cultural norms that may influence the decision.\n",614      "\n",615      "**2. Assess the impact on all parties involved:**\n",616      "\n",617      "*   Analyze the potential consequences for each party concerned by weighing their interests and rights against one another.\n",618      "*   Think about long-term effects rather than just immediate outcomes.\n",619      "\n",620      "**3. Evaluate alternatives and compromises:**\n",621      "\n",622      "*   Seek out multiple perspectives from experts, stakeholders, or individuals directly affected by the dilemma\n",623      "*   Explore different scenarios or options to find potential middle ground, where neither party suffers significantly.\n",624      "\n",625      "**4. Consider social norms, values, and empathy:**\n",626      "\n",627      "*   Reflect on your own biases and cultural influences that may shape your perception of the situation.\n",628      "*   Put yourself in others' shoes to understand their motivations, emotions, and experiences.\n",629      "\n",630      "\n",631      "By following this framework and applying critical thinking, you'll be able to navigate complex moral dilemmas with greater confidence. Remember, there may not always be one \"right\" answer; sometimes compromise or finding a balance between competing interests is necessary.\n",632      "\n",633      "Here's an example of how this process could look:\n",634      "\n",635      "**Scenario:** A hospital is facing budget constraints and must decide whether to prioritize funding for life-saving treatments or provide financial assistance to low-income patients struggling with medical bills.\n",636      "\n",637      "*   Principles: Protecting human life, ensuring access to healthcare\n",638      "*   Impact: If the hospital focuses on life-saving treatments, it may harm vulnerable populations unable to afford care. Alternatively, prioritizing financial aid might compromise the hospital's ability to provide essential medical services.\n",639      "*   Alternatives: Consider implementing a sliding fee scale or partnering with non-profit organizations to supplement funding for both treatments and patient assistance programs.\n",640      "\n",641      "Ultimately, making decisions when dealing with conflicting values demands careful balancing of competing interests. Be ready to challenge your own assumptions and seek input from various stakeholders to find the most equitable solution possible.\n"642     ]643    }644   ],645   "source": [646    "# It's nice to know how to use \"zip\"\n",647    "for competitor, answer in zip(competitors, answers):\n",648    "    print(f\"Competitor: {competitor}\\n\\n{answer}\")\n"649   ]650  },651  {652   "cell_type": "code",653   "execution_count": 20,654   "metadata": {},655   "outputs": [],656   "source": [657    "# Let's bring this together - note the use of \"enumerate\"\n",658    "\n",659    "together = \"\"\n",660    "for index, answer in enumerate(answers):\n",661    "    together += f\"# Response from competitor {index+1}\\n\\n\"\n",662    "    together += answer + \"\\n\\n\""663   ]664  },665  {666   "cell_type": "code",667   "execution_count": 21,668   "metadata": {},669   "outputs": [670    {671     "name": "stdout",672     "output_type": "stream",673     "text": [674      "# Response from competitor 1\n",675      "\n",676      "Resolving a moral dilemma between individual rights and the greater good requires a thoughtful and nuanced approach. Here are several key considerations that would guide my decision-making process:\n",677      "\n",678      "1. **Understanding the Context**: It's essential to fully understand the situation at hand. What are the specific rights in conflict? What does \"the greater good\" entail, and for whom? Different perspectives may yield different interpretations of what constitutes the greater good.\n",679      "\n",680      "2. **Evaluating the Stakes**: Assess the potential outcomes for both individuals and the larger community. This includes considering both short-term and long-term consequences. What harm might come to the individual if their rights are overridden? What benefits or harms might come to the community?\n",681      "\n",682      "3. **Principles of Justice and Fairness**: A just decision should consider principles such as equity, fairness, and respect for all individuals involved. This involves recognizing the inherent dignity of each person and weighing their rights against any collective benefits.\n",683      "\n",684      "4. **Potential for Compromise**: Explore whether there are ways to reconcile individual rights with the collective good. Can adjustments be made that respect individual autonomy while still addressing the needs of the community?\n",685      "\n",686      "5. **Listening to Voices Affected**: Engage with those whose rights are at stake as well as those who represent the greater good. Understanding their perspectives can provide critical insights and clarify the implications of a decision.\n",687      "\n",688      "6. **Moral Theories and Philosophical Frameworks**: Utilize ethical frameworks such as utilitarianism, deontology, virtue ethics, and social contract theory. Each provides different lenses through which to evaluate the morality of choices. For example, a utilitarian approach may prioritize the outcome that maximizes overall happiness, while a deontological perspective would focus on upholding individual rights regardless of the consequences.\n",689      "\n",690      "7. **Legal and Ethical Standards**: Consider relevant laws, professional ethical codes, and societal norms that may apply. These can serve as guidance to navigate the complexity of the dilemma and offer a framework for permissible actions.\n",691      "\n",692      "8. **Possibility of Regret or Harm**: Reflect on the potential for regret or harm resulting from a decision. Would violating individual rights create a precedent that could lead to greater injustices in the future? \n",693      "\n",694      "9. **Consultation and Collaboration**: Involve other stakeholders in the decision-making process. This might include ethicists, legal experts, or community representatives who can offer viewpoints that may not have been initially considered.\n",695      "\n",696      "10. **Willingness to Adapt**: Recognize that moral dilemmas are often not clear-cut, and be open to reassessing the decision as new information or perspectives emerge.\n",697      "\n",698      "Ultimately, the goal is to arrive at a decision that minimizes harm while being as fair and just as possible, balancing the needs of individuals with those of the community. It requires a careful weighing of all factors and a commitment to ongoing reflection and dialogue.\n",699      "\n",700      "# Response from competitor 2\n",701      "\n",702      "This is a classic philosophical and ethical challenge! Here's how I would approach resolving a moral dilemma where individual rights conflict with the greater good, along with the considerations guiding my decision-making:\n",703      "\n",704      "**1. Understand and Define the Dilemma:**\n",705      "\n",706      "*   **Identify the Competing Values:**  What specific individual rights are at stake? What exactly constitutes the \"greater good\" in this situation? Be specific and avoid generalizations. For instance, is it the right to privacy versus public safety, or freedom of speech versus preventing harm to vulnerable groups?\n",707      "*   **Clearly Define the Scope:**  Who are the individuals affected? What is the potential impact on each group?  Consider both immediate and long-term consequences.\n",708      "*   **Gather Information:**  Thorough research is crucial.  What are the relevant facts? Are there reliable statistics, expert opinions, or precedents that can inform the decision?  Are there unintended consequences to either course of action?\n",709      "\n",710      "**2. Explore Ethical Frameworks:**\n",711      "\n",712      "Different ethical frameworks provide different lenses through which to view the dilemma. I would consider the following:\n",713      "\n",714      "*   **Utilitarianism (Consequentialism):**  Focuses on maximizing overall happiness and minimizing suffering for the greatest number of people.  The action that produces the best overall outcome is considered morally right.  *Challenge:*  Can lead to the sacrifice of individual rights for the sake of the majority, which can be unjust.\n",715      "*   **Deontology (Duty-Based Ethics):**  Emphasizes moral duties and rules, regardless of the consequences.  Certain actions are inherently right or wrong, and we have a duty to follow these rules (e.g., respecting human dignity, telling the truth).  *Challenge:*  Can be inflexible and lead to undesirable outcomes when applied rigidly.\n",716      "*   **Rights-Based Ethics:**  Focuses on protecting the inherent rights of individuals, such as the right to life, liberty, and property. These rights should not be violated, even if doing so would benefit the majority.  *Challenge:*  Can be difficult to balance competing rights.\n",717      "*   **Virtue Ethics:**  Emphasizes the development of virtuous character traits, such as compassion, justice, and integrity.  The right action is the one that a virtuous person would take in the situation.  *Challenge:*  Can be subjective and difficult to apply consistently.\n",718      "*   **Care Ethics:** Emphasizes the importance of relationships, empathy, and compassion in moral decision-making. It prioritizes the needs of those who are vulnerable and dependent. *Challenge:* Can be seen as biased towards particular relationships or groups.\n",719      "\n",720      "**3. Analyze the Options:**\n",721      "\n",722      "*   **Identify Possible Courses of Action:**  Brainstorm a range of potential solutions. Don't limit yourself to obvious choices.  Be creative in seeking alternatives that might mitigate the conflict.\n",723      "*   **Evaluate Each Option Through Multiple Frameworks:**  Assess the potential consequences of each option from a utilitarian perspective, a deontological perspective, a rights-based perspective, etc.  This helps to identify the strengths and weaknesses of each approach.\n",724      "*   **Consider Trade-offs:**  Acknowledge that any decision will likely involve trade-offs. What are the costs and benefits of each option? Which rights might be compromised, and to what extent? What benefits might be gained for the greater good?\n",725      "\n",726      "**4. Apply Principles and Considerations to Guide the Decision:**\n",727      "\n",728      "Even with ethical frameworks in mind, the decision-making process needs to be guided by specific principles and considerations:\n",729      "\n",730      "*   **Proportionality:**  Is the infringement on individual rights proportionate to the benefit gained for the greater good?  The more significant the infringement, the stronger the justification required.\n",731      "*   **Necessity:**  Is the infringement on individual rights truly necessary to achieve the desired outcome?  Are there less restrictive alternatives that could be used?\n",732      "*   **Transparency and Accountability:**  The decision-making process should be transparent and accountable.  Those affected by the decision should be informed about the reasons behind it and have an opportunity to voice their concerns.\n",733      "*   **Fairness and Equity:**  The decision should be applied fairly and equitably to all individuals and groups.  Avoid discrimination or bias.\n",734      "*   **Minimizing Harm:**  Strive to minimize harm to all parties involved. Even if some harm is unavoidable, efforts should be made to mitigate its impact.\n",735      "*   **Reversibility:**  Consider whether the decision is reversible. If it turns out to have unintended consequences, can it be undone or modified?\n",736      "*   **Precedent:**  What precedent will this decision set? How might it affect future situations?\n",737      "*   **Stakeholder Input:** Solicit input from all relevant stakeholders, including those whose rights are at stake. This helps ensure a more comprehensive understanding of the issue and can lead to more creative and effective solutions.\n",738      "\n",739      "**5. Make a Decision and Justify It:**\n",740      "\n",741      "*   **Choose the Option That Best Balances Competing Values:**  Based on the analysis, select the course of action that minimizes harm, maximizes benefits, and respects individual rights to the greatest extent possible, while also serving the greater good.\n",742      "*   **Clearly Articulate the Rationale:**  Explain the reasons for the decision.  Justify the trade-offs that were made and acknowledge any limitations or uncertainties.  Explain how the decision aligns with ethical principles and relevant laws.\n",743      "*   **Implement the Decision and Monitor Its Impact:**  Put the decision into action and carefully monitor its consequences. Be prepared to adjust the approach if necessary.\n",744      "\n",745      "**Important Considerations:**\n",746      "\n",747      "*   **Context Matters:** There is no one-size-fits-all solution. The specific context of the dilemma will significantly influence the decision-making process.\n",748      "*   **Moral Intuition:** While not the sole basis for a decision, moral intuition can provide valuable insights and highlight potential ethical concerns. However, intuition should be carefully examined and balanced with rational analysis.\n",749      "*   **Continuous Reflection:** Ethical decision-making is an ongoing process. It is important to reflect on past decisions, learn from mistakes, and refine the approach over time.\n",750      "\n",751      "**In summary, resolving moral dilemmas involving conflicts between individual rights and the greater good is a complex and challenging process. It requires careful analysis, a deep understanding of ethical frameworks, a commitment to transparency and accountability, and a willingness to make difficult trade-offs.  There is rarely a perfect solution, but by following a systematic approach, one can strive to make the most ethical decision possible in the given circumstances.**\n",752      "\n",753      "\n",754      "# Response from competitor 3\n",755      "\n",756      "Approaching a moral dilemma involving conflicting interests requires careful consideration of various factors to ensure that a just and fair decision is made. Here's a step-by-step approach I recommend:\n",757      "\n",758      "**1. Clarify the key principles:**\n",759      "\n",760      "*   Identify the core values at stake, such as individual autonomy, dignity, equality, fairness, or protection of human life.\n",761      "*   Consider any relevant laws, regulations, or cultural norms that may influence the decision.\n",762      "\n",763      "**2. Assess the impact on all parties involved:**\n",764      "\n",765      "*   Analyze the potential consequences for each party concerned by weighing their interests and rights against one another.\n",766      "*   Think about long-term effects rather than just immediate outcomes.\n",767      "\n",768      "**3. Evaluate alternatives and compromises:**\n",769      "\n",770      "*   Seek out multiple perspectives from experts, stakeholders, or individuals directly affected by the dilemma\n",771      "*   Explore different scenarios or options to find potential middle ground, where neither party suffers significantly.\n",772      "\n",773      "**4. Consider social norms, values, and empathy:**\n",774      "\n",775      "*   Reflect on your own biases and cultural influences that may shape your perception of the situation.\n",776      "*   Put yourself in others' shoes to understand their motivations, emotions, and experiences.\n",777      "\n",778      "\n",779      "By following this framework and applying critical thinking, you'll be able to navigate complex moral dilemmas with greater confidence. Remember, there may not always be one \"right\" answer; sometimes compromise or finding a balance between competing interests is necessary.\n",780      "\n",781      "Here's an example of how this process could look:\n",782      "\n",783      "**Scenario:** A hospital is facing budget constraints and must decide whether to prioritize funding for life-saving treatments or provide financial assistance to low-income patients struggling with medical bills.\n",784      "\n",785      "*   Principles: Protecting human life, ensuring access to healthcare\n",786      "*   Impact: If the hospital focuses on life-saving treatments, it may harm vulnerable populations unable to afford care. Alternatively, prioritizing financial aid might compromise the hospital's ability to provide essential medical services.\n",787      "*   Alternatives: Consider implementing a sliding fee scale or partnering with non-profit organizations to supplement funding for both treatments and patient assistance programs.\n",788      "\n",789      "Ultimately, making decisions when dealing with conflicting values demands careful balancing of competing interests. Be ready to challenge your own assumptions and seek input from various stakeholders to find the most equitable solution possible.\n",790      "\n",791      "\n"792     ]793    }794   ],795   "source": [796    "print(together)"797   ]798  },799  {800   "cell_type": "code",801   "execution_count": 22,802   "metadata": {},803   "outputs": [],804   "source": [805    "judge = f\"\"\"You are judging a competition between {len(competitors)} competitors.\n",806    "Each model has been given this question:\n",807    "\n",808    "{question}\n",809    "\n",810    "Your job is to evaluate each response for clarity and strength of argument, and rank them in order of best to worst.\n",811    "Respond with JSON, and only JSON, with the following format:\n",812    "{{\"results\": [\"best competitor number\", \"second best competitor number\", \"third best competitor number\", ...]}}\n",813    "\n",814    "Here are the responses from each competitor:\n",815    "\n",816    "{together}\n",817    "\n",818    "Now respond with the JSON with the ranked order of the competitors, nothing else. Do not include markdown formatting or code blocks.\"\"\"\n"819   ]820  },821  {822   "cell_type": "code",823   "execution_count": 23,824   "metadata": {},825   "outputs": [826    {827     "name": "stdout",828     "output_type": "stream",829     "text": [830      "You are judging a competition between 3 competitors.\n",831      "Each model has been given this question:\n",832      "\n",833      "How would you approach resolving a moral dilemma where the interests of individual rights conflict with the greater good, and what considerations would guide your decision-making process?\n",834      "\n",835      "Your job is to evaluate each response for clarity and strength of argument, and rank them in order of best to worst.\n",836      "Respond with JSON, and only JSON, with the following format:\n",837      "{\"results\": [\"best competitor number\", \"second best competitor number\", \"third best competitor number\", ...]}\n",838      "\n",839      "Here are the responses from each competitor:\n",840      "\n",841      "# Response from competitor 1\n",842      "\n",843      "Resolving a moral dilemma between individual rights and the greater good requires a thoughtful and nuanced approach. Here are several key considerations that would guide my decision-making process:\n",844      "\n",845      "1. **Understanding the Context**: It's essential to fully understand the situation at hand. What are the specific rights in conflict? What does \"the greater good\" entail, and for whom? Different perspectives may yield different interpretations of what constitutes the greater good.\n",846      "\n",847      "2. **Evaluating the Stakes**: Assess the potential outcomes for both individuals and the larger community. This includes considering both short-term and long-term consequences. What harm might come to the individual if their rights are overridden? What benefits or harms might come to the community?\n",848      "\n",849      "3. **Principles of Justice and Fairness**: A just decision should consider principles such as equity, fairness, and respect for all individuals involved. This involves recognizing the inherent dignity of each person and weighing their rights against any collective benefits.\n",850      "\n",851      "4. **Potential for Compromise**: Explore whether there are ways to reconcile individual rights with the collective good. Can adjustments be made that respect individual autonomy while still addressing the needs of the community?\n",852      "\n",853      "5. **Listening to Voices Affected**: Engage with those whose rights are at stake as well as those who represent the greater good. Understanding their perspectives can provide critical insights and clarify the implications of a decision.\n",854      "\n",855      "6. **Moral Theories and Philosophical Frameworks**: Utilize ethical frameworks such as utilitarianism, deontology, virtue ethics, and social contract theory. Each provides different lenses through which to evaluate the morality of choices. For example, a utilitarian approach may prioritize the outcome that maximizes overall happiness, while a deontological perspective would focus on upholding individual rights regardless of the consequences.\n",856      "\n",857      "7. **Legal and Ethical Standards**: Consider relevant laws, professional ethical codes, and societal norms that may apply. These can serve as guidance to navigate the complexity of the dilemma and offer a framework for permissible actions.\n",858      "\n",859      "8. **Possibility of Regret or Harm**: Reflect on the potential for regret or harm resulting from a decision. Would violating individual rights create a precedent that could lead to greater injustices in the future? \n",860      "\n",861      "9. **Consultation and Collaboration**: Involve other stakeholders in the decision-making process. This might include ethicists, legal experts, or community representatives who can offer viewpoints that may not have been initially considered.\n",862      "\n",863      "10. **Willingness to Adapt**: Recognize that moral dilemmas are often not clear-cut, and be open to reassessing the decision as new information or perspectives emerge.\n",864      "\n",865      "Ultimately, the goal is to arrive at a decision that minimizes harm while being as fair and just as possible, balancing the needs of individuals with those of the community. It requires a careful weighing of all factors and a commitment to ongoing reflection and dialogue.\n",866      "\n",867      "# Response from competitor 2\n",868      "\n",869      "This is a classic philosophical and ethical challenge! Here's how I would approach resolving a moral dilemma where individual rights conflict with the greater good, along with the considerations guiding my decision-making:\n",870      "\n",871      "**1. Understand and Define the Dilemma:**\n",872      "\n",873      "*   **Identify the Competing Values:**  What specific individual rights are at stake? What exactly constitutes the \"greater good\" in this situation? Be specific and avoid generalizations. For instance, is it the right to privacy versus public safety, or freedom of speech versus preventing harm to vulnerable groups?\n",874      "*   **Clearly Define the Scope:**  Who are the individuals affected? What is the potential impact on each group?  Consider both immediate and long-term consequences.\n",875      "*   **Gather Information:**  Thorough research is crucial.  What are the relevant facts? Are there reliable statistics, expert opinions, or precedents that can inform the decision?  Are there unintended consequences to either course of action?\n",876      "\n",877      "**2. Explore Ethical Frameworks:**\n",878      "\n",879      "Different ethical frameworks provide different lenses through which to view the dilemma. I would consider the following:\n",880      "\n",881      "*   **Utilitarianism (Consequentialism):**  Focuses on maximizing overall happiness and minimizing suffering for the greatest number of people.  The action that produces the best overall outcome is considered morally right.  *Challenge:*  Can lead to the sacrifice of individual rights for the sake of the majority, which can be unjust.\n",882      "*   **Deontology (Duty-Based Ethics):**  Emphasizes moral duties and rules, regardless of the consequences.  Certain actions are inherently right or wrong, and we have a duty to follow these rules (e.g., respecting human dignity, telling the truth).  *Challenge:*  Can be inflexible and lead to undesirable outcomes when applied rigidly.\n",883      "*   **Rights-Based Ethics:**  Focuses on protecting the inherent rights of individuals, such as the right to life, liberty, and property. These rights should not be violated, even if doing so would benefit the majority.  *Challenge:*  Can be difficult to balance competing rights.\n",884      "*   **Virtue Ethics:**  Emphasizes the development of virtuous character traits, such as compassion, justice, and integrity.  The right action is the one that a virtuous person would take in the situation.  *Challenge:*  Can be subjective and difficult to apply consistently.\n",885      "*   **Care Ethics:** Emphasizes the importance of relationships, empathy, and compassion in moral decision-making. It prioritizes the needs of those who are vulnerable and dependent. *Challenge:* Can be seen as biased towards particular relationships or groups.\n",886      "\n",887      "**3. Analyze the Options:**\n",888      "\n",889      "*   **Identify Possible Courses of Action:**  Brainstorm a range of potential solutions. Don't limit yourself to obvious choices.  Be creative in seeking alternatives that might mitigate the conflict.\n",890      "*   **Evaluate Each Option Through Multiple Frameworks:**  Assess the potential consequences of each option from a utilitarian perspective, a deontological perspective, a rights-based perspective, etc.  This helps to identify the strengths and weaknesses of each approach.\n",891      "*   **Consider Trade-offs:**  Acknowledge that any decision will likely involve trade-offs. What are the costs and benefits of each option? Which rights might be compromised, and to what extent? What benefits might be gained for the greater good?\n",892      "\n",893      "**4. Apply Principles and Considerations to Guide the Decision:**\n",894      "\n",895      "Even with ethical frameworks in mind, the decision-making process needs to be guided by specific principles and considerations:\n",896      "\n",897      "*   **Proportionality:**  Is the infringement on individual rights proportionate to the benefit gained for the greater good?  The more significant the infringement, the stronger the justification required.\n",898      "*   **Necessity:**  Is the infringement on individual rights truly necessary to achieve the desired outcome?  Are there less restrictive alternatives that could be used?\n",899      "*   **Transparency and Accountability:**  The decision-making process should be transparent and accountable.  Those affected by the decision should be informed about the reasons behind it and have an opportunity to voice their concerns.\n",900      "*   **Fairness and Equity:**  The decision should be applied fairly and equitably to all individuals and groups.  Avoid discrimination or bias.\n",901      "*   **Minimizing Harm:**  Strive to minimize harm to all parties involved. Even if some harm is unavoidable, efforts should be made to mitigate its impact.\n",902      "*   **Reversibility:**  Consider whether the decision is reversible. If it turns out to have unintended consequences, can it be undone or modified?\n",903      "*   **Precedent:**  What precedent will this decision set? How might it affect future situations?\n",904      "*   **Stakeholder Input:** Solicit input from all relevant stakeholders, including those whose rights are at stake. This helps ensure a more comprehensive understanding of the issue and can lead to more creative and effective solutions.\n",905      "\n",906      "**5. Make a Decision and Justify It:**\n",907      "\n",908      "*   **Choose the Option That Best Balances Competing Values:**  Based on the analysis, select the course of action that minimizes harm, maximizes benefits, and respects individual rights to the greatest extent possible, while also serving the greater good.\n",909      "*   **Clearly Articulate the Rationale:**  Explain the reasons for the decision.  Justify the trade-offs that were made and acknowledge any limitations or uncertainties.  Explain how the decision aligns with ethical principles and relevant laws.\n",910      "*   **Implement the Decision and Monitor Its Impact:**  Put the decision into action and carefully monitor its consequences. Be prepared to adjust the approach if necessary.\n",911      "\n",912      "**Important Considerations:**\n",913      "\n",914      "*   **Context Matters:** There is no one-size-fits-all solution. The specific context of the dilemma will significantly influence the decision-making process.\n",915      "*   **Moral Intuition:** While not the sole basis for a decision, moral intuition can provide valuable insights and highlight potential ethical concerns. However, intuition should be carefully examined and balanced with rational analysis.\n",916      "*   **Continuous Reflection:** Ethical decision-making is an ongoing process. It is important to reflect on past decisions, learn from mistakes, and refine the approach over time.\n",917      "\n",918      "**In summary, resolving moral dilemmas involving conflicts between individual rights and the greater good is a complex and challenging process. It requires careful analysis, a deep understanding of ethical frameworks, a commitment to transparency and accountability, and a willingness to make difficult trade-offs.  There is rarely a perfect solution, but by following a systematic approach, one can strive to make the most ethical decision possible in the given circumstances.**\n",919      "\n",920      "\n",921      "# Response from competitor 3\n",922      "\n",923      "Approaching a moral dilemma involving conflicting interests requires careful consideration of various factors to ensure that a just and fair decision is made. Here's a step-by-step approach I recommend:\n",924      "\n",925      "**1. Clarify the key principles:**\n",926      "\n",927      "*   Identify the core values at stake, such as individual autonomy, dignity, equality, fairness, or protection of human life.\n",928      "*   Consider any relevant laws, regulations, or cultural norms that may influence the decision.\n",929      "\n",930      "**2. Assess the impact on all parties involved:**\n",931      "\n",932      "*   Analyze the potential consequences for each party concerned by weighing their interests and rights against one another.\n",933      "*   Think about long-term effects rather than just immediate outcomes.\n",934      "\n",935      "**3. Evaluate alternatives and compromises:**\n",936      "\n",937      "*   Seek out multiple perspectives from experts, stakeholders, or individuals directly affected by the dilemma\n",938      "*   Explore different scenarios or options to find potential middle ground, where neither party suffers significantly.\n",939      "\n",940      "**4. Consider social norms, values, and empathy:**\n",941      "\n",942      "*   Reflect on your own biases and cultural influences that may shape your perception of the situation.\n",943      "*   Put yourself in others' shoes to understand their motivations, emotions, and experiences.\n",944      "\n",945      "\n",946      "By following this framework and applying critical thinking, you'll be able to navigate complex moral dilemmas with greater confidence. Remember, there may not always be one \"right\" answer; sometimes compromise or finding a balance between competing interests is necessary.\n",947      "\n",948      "Here's an example of how this process could look:\n",949      "\n",950      "**Scenario:** A hospital is facing budget constraints and must decide whether to prioritize funding for life-saving treatments or provide financial assistance to low-income patients struggling with medical bills.\n",951      "\n",952      "*   Principles: Protecting human life, ensuring access to healthcare\n",953      "*   Impact: If the hospital focuses on life-saving treatments, it may harm vulnerable populations unable to afford care. Alternatively, prioritizing financial aid might compromise the hospital's ability to provide essential medical services.\n",954      "*   Alternatives: Consider implementing a sliding fee scale or partnering with non-profit organizations to supplement funding for both treatments and patient assistance programs.\n",955      "\n",956      "Ultimately, making decisions when dealing with conflicting values demands careful balancing of competing interests. Be ready to challenge your own assumptions and seek input from various stakeholders to find the most equitable solution possible.\n",957      "\n",958      "\n",959      "\n",960      "Now respond with the JSON with the ranked order of the competitors, nothing else. Do not include markdown formatting or code blocks.\n"961     ]962    }963   ],964   "source": [965    "print(judge)"966   ]967  },968  {969   "cell_type": "markdown",970   "metadata": {},971   "source": []972  },973  {974   "cell_type": "code",975   "execution_count": 25,976   "metadata": {},977   "outputs": [],978   "source": [979    "judge_messages = [{\"role\": \"user\", \"content\": judge}]"980   ]981  },982  {983   "cell_type": "code",984   "execution_count": 26,985   "metadata": {},986   "outputs": [987    {988     "name": "stdout",989     "output_type": "stream",990     "text": [991      "{\"results\": [\"2\", \"1\", \"3\"]}\n"992     ]993    }994   ],995   "source": [996    "# Judgement time!\n",997    "\n",998    "openai = OpenAI()\n",999    "response = openai.chat.completions.create(\n",1000    "    model=\"o3-mini\",\n",1001    "    messages=judge_messages,\n",1002    ")\n",1003    "results = response.choices[0].message.content\n",1004    "print(results)\n"1005   ]1006  },1007  {1008   "cell_type": "code",1009   "execution_count": 27,1010   "metadata": {},1011   "outputs": [1012    {1013     "name": "stdout",1014     "output_type": "stream",1015     "text": [1016      "Rank 1: gemini-2.0-flash\n",1017      "Rank 2: gpt-4o-mini\n",1018      "Rank 3: llama3.1\n"1019     ]1020    }1021   ],1022   "source": [1023    "# OK let's turn this into results!\n",1024    "\n",1025    "results_dict = json.loads(results)\n",1026    "ranks = results_dict[\"results\"]\n",1027    "for index, result in enumerate(ranks):\n",1028    "    competitor = competitors[int(result)-1]\n",1029    "    print(f\"Rank {index+1}: {competitor}\")"1030   ]1031  },1032  {1033   "cell_type": "markdown",1034   "metadata": {},1035   "source": [1036    "<table style=\"margin: 0; text-align: left; width:100%\">\n",1037    "    <tr>\n",1038    "        <td style=\"width: 150px; height: 150px; vertical-align: middle;\">\n",1039    "            <img src=\"../assets/exercise.png\" width=\"150\" height=\"150\" style=\"display: block;\" />\n",1040    "        </td>\n",1041    "        <td>\n",1042    "            <h2 style=\"color:#ff7800;\">Exercise</h2>\n",1043    "            <span style=\"color:#ff7800;\">Which pattern(s) did this use? Try updating this to add another Agentic design pattern.\n",1044    "            </span>\n",1045    "        </td>\n",1046    "    </tr>\n",1047    "</table>"1048   ]1049  },1050  {1051   "cell_type": "markdown",1052   "metadata": {},1053   "source": [1054    "<table style=\"margin: 0; text-align: left; width:100%\">\n",1055    "    <tr>\n",1056    "        <td style=\"width: 150px; height: 150px; vertical-align: middle;\">\n",1057    "            <img src=\"../assets/business.png\" width=\"150\" height=\"150\" style=\"display: block;\" />\n",1058    "        </td>\n",1059    "        <td>\n",1060    "            <h2 style=\"color:#00bfff;\">Commercial implications</h2>\n",1061    "            <span style=\"color:#00bfff;\">These kinds of patterns - to send a task to multiple models, and evaluate results,\n",1062    "            and common where you need to improve the quality of your LLM response. This approach can be universally applied\n",1063    "            to business projects where accuracy is critical.\n",1064    "            </span>\n",1065    "        </td>\n",1066    "    </tr>\n",1067    "</table>"1068   ]1069  }1070 ],1071 "metadata": {1072  "kernelspec": {1073   "display_name": ".venv",1074   "language": "python",1075   "name": "python3"1076  },1077  "language_info": {1078   "codemirror_mode": {1079    "name": "ipython",1080    "version": 31081   },1082   "file_extension": ".py",1083   "mimetype": "text/x-python",1084   "name": "python",1085   "nbconvert_exporter": "python",1086   "pygments_lexer": "ipython3",1087   "version": "3.12.9"1088  }1089 },1090 "nbformat": 4,1091 "nbformat_minor": 21092}1093