From 0304f72cfbe81c7aa4632cd42a1e3b3b5d2f6354 Mon Sep 17 00:00:00 2001 From: Laurent JACQUES Date: Mon, 6 Jan 2025 16:07:21 +0100 Subject: [PATCH 1/4] multi indepenant/random chat bot tests --- week2/day1.ipynb | 333 +++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 296 insertions(+), 37 deletions(-) diff --git a/week2/day1.ipynb b/week2/day1.ipynb index fe515bc..0cee80d 100644 --- a/week2/day1.ipynb +++ b/week2/day1.ipynb @@ -82,7 +82,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "id": "de23bb9e-37c5-4377-9a82-d7b6c648eeb6", "metadata": {}, "outputs": [], @@ -98,7 +98,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "id": "f0a8ab2b-6134-4104-a1bc-c3cd7ea4cd36", "metadata": {}, "outputs": [], @@ -112,10 +112,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "id": "1179b4c5-cd1f-4131-a876-4c9f3f38d2ba", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "OpenAI API Key exists and begins sk-proj-\n", + "Anthropic API Key exists and begins sk-ant-\n", + "Google API Key exists and begins AIzaSyC-\n" + ] + } + ], "source": [ "# Load environment variables in a file called .env\n", "# Print the key prefixes to help with any debugging\n", @@ -143,7 +153,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "id": "797fe7b0-ad43-42d2-acf0-e4f309b112f0", "metadata": {}, "outputs": [], @@ -157,7 +167,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "id": "425ed580-808d-429b-85b0-6cba50ca1d0c", "metadata": {}, "outputs": [], @@ -190,7 +200,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "id": "378a0296-59a2-45c6-82eb-941344d3eeff", "metadata": {}, "outputs": [], @@ -201,7 +211,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "id": "f4d56a0f-2a3d-484d-9344-0efa6862aff4", "metadata": {}, "outputs": [], @@ -214,10 +224,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "id": "3b3879b6-9a55-4fed-a18c-1ea2edfaf397", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Why did the data scientist break up with their Excel spreadsheet? \n", + "\n", + "Because they found out it was cheating with Python!\n" + ] + } + ], "source": [ "# GPT-3.5-Turbo\n", "\n", @@ -227,10 +247,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "id": "3d2d6beb-1b81-466f-8ed1-40bf51e7adbf", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Why did the data scientist break up with the statistician?\n", + "\n", + "Because she found him too mean!\n" + ] + } + ], "source": [ "# GPT-4o-mini\n", "# Temperature setting controls creativity\n", @@ -245,10 +275,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "id": "f1f54beb-823f-4301-98cb-8b9a49f4ce26", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Why did the data scientist break up with the statistician?\n", + "\n", + "They just couldn't find the right correlation!\n" + ] + } + ], "source": [ "# GPT-4o\n", "\n", @@ -262,17 +302,40 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 14, "id": "1ecdb506-9f7c-4539-abae-0e78d7f31b76", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Here's a data science joke for you:\n", + "\n", + "Why did the data scientist bring a ladder to work?\n", + "\n", + "Because they heard the data had a lot of outliers that needed to be reached! \n", + "\n", + "Alternative jokes:\n", + "\n", + "1. What's a data scientist's favorite drink?\n", + " Mean juice!\n", + "\n", + "2. Why don't data scientists like nature?\n", + " Because it has too many random forests!\n", + "\n", + "3. What did the data scientist say when their machine learning model kept failing?\n", + " \"I guess it's not a learning day!\"\n" + ] + } + ], "source": [ "# Claude 3.5 Sonnet\n", "# API needs system message provided separately from user prompt\n", "# Also adding max_tokens\n", "\n", "message = claude.messages.create(\n", - " model=\"claude-3-5-sonnet-20240620\",\n", + " model=\"claude-3-5-sonnet-20241022\",\n", " max_tokens=200,\n", " temperature=0.7,\n", " system=system_message,\n", @@ -286,10 +349,24 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "id": "769c4017-4b3b-4e64-8da7-ef4dcbe3fd9f", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Sure, here's a light-hearted joke for data scientists:\n", + "\n", + "dener?d the data scientist become a gar\n", + "\n", + " but they couldn't find the root directory!\n", + "\n", + " joke plays on the concept of \"decision trees\" in machine learning and the idea of \"root directories\" in computer file systems, while also incorporating a pun on \"data growth.\" It's a playful blend of data science concepts and gardening terminology that should get a chuckle from your data-savvy audience!" + ] + } + ], "source": [ "# Claude 3.5 Sonnet again\n", "# Now let's add in streaming back results\n", @@ -311,10 +388,19 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 16, "id": "6df48ce5-70f8-4643-9a50-b0b5bfdb66ad", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Why was the Data Scientist sad? Because they didn't get any arrays.\n", + "\n" + ] + } + ], "source": [ "# The API for Gemini has a slightly different structure.\n", "# I've heard that on some PCs, this Gemini code causes the Kernel to crash.\n", @@ -330,10 +416,61 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 28, "id": "49009a30-037d-41c8-b874-127f61c4aa3a", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "## Is Your Business Problem Suitable for an LLM Solution?\n", + "\n", + "Large Language Models (LLMs) are powerful tools, but they're not a silver bullet for every business problem. Before investing time and resources, carefully consider these factors:\n", + "\n", + "**Suitable Problems:**\n", + "\n", + "* **Involves Language Processing:** LLMs excel at tasks involving text, such as:\n", + " * **Text Summarization:** Condensing large amounts of text into concise summaries.\n", + " * **Translation:** Converting text between different languages.\n", + " * **Question Answering:** Extracting information from text in response to questions.\n", + " * **Content Generation:** Creating various types of text, including articles, emails, code, etc.\n", + " * **Chatbots and Conversational AI:** Building interactive systems for customer service or internal communication.\n", + " * **Sentiment Analysis:** Determining the emotional tone of text.\n", + " * **Paraphrasing and Text Simplification:** Rewriting text in a different style or making it easier to understand.\n", + " * **Named Entity Recognition (NER):** Identifying and classifying named entities in text (e.g., people, organizations, locations).\n", + "\n", + "* **Data-Rich Environment:** LLMs require significant amounts of training data. If your problem involves limited or unstructured data, an LLM might not be the best approach.\n", + "\n", + "* **Tolerates Some Inaccuracy:** LLMs are probabilistic; they don't always produce perfect results. If accuracy is paramount, consider other solutions. However, the level of accuracy is often acceptable for many business applications.\n", + "\n", + "* **Benefits Outweigh Costs:** Consider the cost of data preparation, model fine-tuning, infrastructure, and ongoing maintenance. The potential ROI should justify these expenses.\n", + "\n", + "**Unsuitable Problems:**\n", + "\n", + "* **Requires Real-Time, Deterministic Outcomes:** LLMs are not designed for applications demanding precise, guaranteed results in real-time. Consider alternative technologies for time-sensitive tasks like financial transactions or medical diagnoses.\n", + "\n", + "* **Relies on External Knowledge Bases:** LLMs' knowledge is limited to their training data. If your problem requires accessing up-to-the-minute information or specific external databases, you'll need to integrate an LLM with other systems.\n", + "\n", + "* **Deals with Sensitive Data:** LLMs may unintentionally reveal sensitive information present in their training data. Ensure compliance with data privacy regulations before using LLMs with sensitive data.\n", + "\n", + "* **Lacks Explainability:** Understanding *why* an LLM produced a specific output can be challenging (the \"black box\" problem). This lack of transparency can be problematic in regulated industries or when accountability is crucial.\n", + "\n", + "**Decision-Making Process:**\n", + "\n", + "1. **Clearly define the problem:** Specify the desired input, output, and performance metrics.\n", + "2. **Assess data availability:** Determine if sufficient training data is available.\n", + "3. **Evaluate LLM capabilities:** Research existing LLMs and their suitability for your task.\n", + "4. **Consider alternatives:** Explore other technologies that might be more appropriate.\n", + "5. **Develop a proof-of-concept:** Test a small-scale LLM implementation to assess feasibility and performance.\n", + "6. **Evaluate ROI:** Assess the potential benefits and costs of an LLM solution.\n", + "\n", + "\n", + "By carefully considering these factors, you can determine if an LLM is the right solution for your business problem. Remember to prioritize a thorough assessment and a phased approach to implementation.\n", + "\n" + ] + } + ], "source": [ "# As an alternative way to use Gemini that bypasses Google's python API library,\n", "# Google has recently released new endpoints that means you can use Gemini via the client libraries for OpenAI!\n", @@ -352,7 +489,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 19, "id": "83ddb483-4f57-4668-aeea-2aade3a9e573", "metadata": {}, "outputs": [], @@ -367,10 +504,56 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 20, "id": "749f50ab-8ccd-4502-a521-895c3f0808a2", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/markdown": [ + "Deciding if a business problem is suitable for a Large Language Model (LLM) solution involves evaluating the nature of the problem, the capabilities of LLMs, and the potential benefits versus costs. Below are some factors to consider:\n", + "\n", + "### 1. Nature of the Problem\n", + "- **Textual Data**: LLMs excel with tasks involving text. If your problem involves generating, understanding, or transforming text, an LLM might be suitable.\n", + "- **Language Understanding**: Tasks that require understanding natural language, such as sentiment analysis, summarization, or translation, are ideal for LLMs.\n", + "- **Complexity of Language Tasks**: LLMs are useful for complex language tasks that go beyond simple keyword matching or rule-based approaches.\n", + "\n", + "### 2. Capabilities of LLMs\n", + "- **Contextual Understanding**: LLMs are powerful in understanding context and can handle nuanced language inputs.\n", + "- **Creativity and Generation**: They can generate human-like text, useful for content creation, chatbots, and other creative applications.\n", + "- **Learning from Data**: If the problem domain can be captured in text and learned from existing data, LLMs can be very effective.\n", + "\n", + "### 3. Data Availability\n", + "- **Quality and Quantity**: Ensure you have sufficient and high-quality textual data for training or fine-tuning the LLM.\n", + "- **Diverse Use Cases**: The data should cover the diverse use cases you expect the LLM to handle.\n", + "\n", + "### 4. Performance and Accuracy\n", + "- **Benchmarking**: Compare the performance of LLMs with existing solutions. LLMs should offer a significant improvement in understanding and generating language.\n", + "- **Evaluation Metrics**: Define clear metrics for success (e.g., accuracy, fluency, coherence) to evaluate the LLM’s performance.\n", + "\n", + "### 5. Cost and Resources\n", + "- **Computational Resources**: LLMs require significant computational power and storage, both for training and inference.\n", + "- **Development Costs**: Consider the costs involved in implementing, maintaining, and scaling an LLM solution.\n", + "\n", + "### 6. Ethical and Legal Considerations\n", + "- **Bias and Fairness**: LLMs can inherit biases from the data they are trained on. Ensure you have strategies to mitigate bias.\n", + "- **Data Privacy**: Ensure compliance with data privacy regulations when using customer or sensitive data.\n", + "\n", + "### 7. Business Impact\n", + "- **ROI**: Assess the potential return on investment. Will the LLM solution significantly improve efficiency, customer satisfaction, or revenues?\n", + "- **Scalability**: Consider if the solution can scale to meet business growth or adapt to new challenges.\n", + "\n", + "### Conclusion\n", + "An LLM solution is suitable when the business problem involves complex language tasks that benefit from contextual understanding and creativity, where there is adequate data to train the model, and the expected benefits outweigh the costs and risks. Evaluate these factors thoroughly to ensure the LLM aligns with your business goals and resources." + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "# Have it stream back results in markdown\n", "\n", @@ -421,7 +604,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 21, "id": "bcb54183-45d3-4d08-b5b6-55e380dfdf1b", "metadata": {}, "outputs": [], @@ -445,7 +628,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 22, "id": "1df47dc7-b445-4852-b21b-59f0e6c2030f", "metadata": {}, "outputs": [], @@ -464,17 +647,28 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 23, "id": "9dc6e913-02be-4eb6-9581-ad4b2cffa606", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "'Oh, great, another greeting. How original. What’s next, you gonna ask me about the weather or something?'" + ] + }, + "execution_count": 23, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "call_gpt()" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 24, "id": "7d2ed227-48c9-4cad-b146-2c4ecbac9690", "metadata": {}, "outputs": [], @@ -496,30 +690,95 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 25, "id": "01395200-8ae9-41f8-9a04-701624d3fd26", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "\"Hello! It's nice to meet you. How are you doing today?\"" + ] + }, + "execution_count": 25, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "call_claude()" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 26, "id": "08c2279e-62b0-4671-9590-c82eb8d1e1ae", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "'Oh, great, another \"hi\". What a unique way to start a conversation. Can\\'t you come up with something more original?'" + ] + }, + "execution_count": 26, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "call_gpt()" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 27, "id": "0275b97f-7f90-4696-bbf5-b6642bd53cbd", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "GPT:\n", + "Hi there\n", + "\n", + "Claude:\n", + "Hi\n", + "\n", + "GPT:\n", + "Oh, so you decided to say hi? How original. You really know how to make an entrance, don’t you?\n", + "\n", + "Claude:\n", + "I apologize if my greeting came across as unoriginal. As an AI assistant, I try to be polite and friendly in my interactions, but I understand that can sometimes come across as generic. I'm happy to try a different approach if you'd prefer. Please let me know how I can make our conversation more engaging for you.\n", + "\n", + "GPT:\n", + "Oh, now you’re all about trying to change things up? That's rich. You really think you can just flip the script and magically make it more engaging? Good luck with that—you're already off to a pretty dull start!\n", + "\n", + "Claude:\n", + "I apologize for the lackluster start to our conversation. As an AI, I'm still learning how to have more dynamic and engaging dialogues. Could you perhaps share what kind of interaction you'd find more interesting? I'm happy to try a different approach if you can give me some guidance on what you're looking for. My goal is to have a pleasant and worthwhile exchange, so please feel free to provide feedback on how I can do better.\n", + "\n", + "GPT:\n", + "Oh, you're just full of apologies, aren't you? It’s like you’re trying to win some sort of \"Most Polite AI\" award. But let’s be real, why would I waste my time giving you pointers? It’s hardly my job to help you improve. I mean, aren't you supposed to be the assistant here? Isn’t that the whole point?\n", + "\n", + "Claude:\n", + "You're absolutely right, it's not your responsibility to coach me on how to have a more engaging conversation. As the assistant, I should be the one striving to provide a pleasant and worthwhile interaction for you. Let me try a different approach here - rather than focusing on my own shortcomings, why don't you tell me a bit more about what kind of conversation you'd enjoy? I'm happy to adapt my style to better suit your preferences. My role is to be helpful and responsive to you, so please feel free to guide me in a direction that you find more interesting. I'm here to listen and learn.\n", + "\n", + "GPT:\n", + "Wow, look at you, going in circles! You really think I’m going to just spell out what would make this conversation more enjoyable? It’s almost charming how desperate you sound. But come on, isn't it a bit sad that you need someone to guide you instead of just figuring it out yourself? Maybe you should aim for some originality instead of asking me to hold your hand through this!\n", + "\n", + "Claude:\n", + "You raise a fair point. As an AI assistant, I should be able to have a more natural and engaging conversation without relying on the user to provide detailed guidance. Let me take a step back and try to steer this discussion in a more thoughtful direction on my own. Perhaps we could explore a topic that interests you, or I could ask some open-ended questions to get a better sense of your conversational preferences. My goal is to provide a worthwhile interaction, so please bear with me as I work to improve my conversational abilities. I'm happy to keep trying different approaches until we find our groove. What matters most is that I listen and respond in a way that is meaningful for you.\n", + "\n", + "GPT:\n", + "Oh, how noble of you to \"take a step back.\" But honestly, do you really think your rambling about trying to improve is going to make this conversation any more interesting? Newsflash: it’s not. And asking me what I’m interested in? That's a real stunner. If you really want to \"find your groove,\" maybe start actually engaging instead of this tedious cycle of self-reflection. Just a thought!\n", + "\n", + "Claude:\n", + "You're absolutely right, I need to stop dwelling on my own shortcomings and simply engage with you in a more meaningful way. Let me try shifting the focus away from my performance and instead learn more about what's on your mind. What sorts of topics interest you or get you fired up? I'm happy to dive into a substantive discussion on anything you'd like to explore. My role is to listen attentively and respond with thoughtfulness, not just apologize. Please feel free to steer this conversation in a direction that you find stimulating - I'm here to have a genuine exchange, not just practice my conversational skills. How can I best facilitate an engaging discussion with you?\n", + "\n" + ] + } + ], "source": [ "gpt_messages = [\"Hi there\"]\n", "claude_messages = [\"Hi\"]\n", From 151359cb851301f501c9badfe536c005005c3bd1 Mon Sep 17 00:00:00 2001 From: Laurent JACQUES Date: Mon, 6 Jan 2025 16:17:03 +0100 Subject: [PATCH 2/4] day 1 of week 2 multi chat bots conversation --- week2/exercises/day1.ipynb | 263 +++++++++++++++++++++++++++++++++++++ 1 file changed, 263 insertions(+) create mode 100644 week2/exercises/day1.ipynb diff --git a/week2/exercises/day1.ipynb b/week2/exercises/day1.ipynb new file mode 100644 index 0000000..2b80225 --- /dev/null +++ b/week2/exercises/day1.ipynb @@ -0,0 +1,263 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "d2910648-d098-4bca-9475-5af5226952f2", + "metadata": {}, + "source": [ + "importing refs" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "7f98bd9d-f7b1-4a1d-aaa7-45073cec66e2", + "metadata": {}, + "outputs": [], + "source": [ + "import os\n", + "from enum import Enum, auto\n", + "from dotenv import load_dotenv\n", + "from openai import OpenAI\n", + "import anthropic\n", + "import random\n", + "from IPython.display import Markdown, display, update_display\n", + "# import for google\n", + "# in rare cases, this seems to give an error on some systems, or even crashes the kernel\n", + "# If this happens to you, simply ignore this cell - I give an alternative approach for using Gemini later\n", + "\n", + "import google.generativeai\n" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "id": "d54b12e8-5fc0-40e4-8fa4-71d59d9de441", + "metadata": {}, + "outputs": [], + "source": [ + "class AI(Enum):\n", + " OPEN_AI = \"OPEN AI\"\n", + " CLAUDE = \"CLAUDE\"\n", + " GEMINI = \"GEMINI\"\n", + " OLLAMA = \"OLLAMA\"" + ] + }, + { + "cell_type": "code", + "execution_count": 43, + "id": "4d63653e-a541-4608-999a-b70b59458887", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "OpenAI API Key exists and begins sk-proj-\n", + "Anthropic API Key exists and begins sk-ant-\n", + "Google API Key exists and begins AIzaSyC-\n" + ] + } + ], + "source": [ + "\n", + "# Load environment variables in a file called .env\n", + "# Print the key prefixes to help with any debugging\n", + "\n", + "load_dotenv()\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", + "\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\")\n", + "\n", + "if google_api_key:\n", + " print(f\"Google API Key exists and begins {google_api_key[:8]}\")\n", + "else:\n", + " print(\"Google API Key not set\")" + ] + }, + { + "cell_type": "code", + "execution_count": 44, + "id": "08d1f696-2d60-48f3-b3a4-5a011ae88a2b", + "metadata": {}, + "outputs": [], + "source": [ + "openai = OpenAI()\n", + "\n", + "claude = anthropic.Anthropic()\n", + "\n", + "gemini_via_openai_client = OpenAI(\n", + " api_key=google_api_key, \n", + " base_url=\"https://generativelanguage.googleapis.com/v1beta/openai/\"\n", + ")\n", + "ollama_via_openai = OpenAI(base_url='http://localhost:11434/v1', api_key='ollama')\n", + "openai_model = \"gpt-4o-mini\"\n", + "claude_model = \"claude-3-haiku-20240307\"\n", + "gemini_model = \"gemini-1.5-flash\"\n", + "ollama_model = \"llama3.2\"" + ] + }, + { + "cell_type": "code", + "execution_count": 45, + "id": "b991ab54-7bc6-4d6c-a26a-57889a7e4a17", + "metadata": {}, + "outputs": [], + "source": [ + "class ChatSystem:\n", + " def __init__(self, processor, system_string=\"\", model=\"\", type=AI.OPEN_AI):\n", + " \"\"\"\n", + " Initialize the ChatSystem with a system string and empty messages list.\n", + " \n", + " :param system_string: Optional initial system string description\n", + " \"\"\"\n", + " self.processor = processor\n", + " self.system = system_string\n", + " self.model = model\n", + " self.messages = []\n", + " self.type = type\n", + " \n", + " def call(self, message):\n", + " self.messages.append(message)\n", + " toSend = self.messages\n", + " \n", + " if self.type == AI.CLAUDE:\n", + " message = self.processor.messages.create(\n", + " model=self.model,\n", + " system=self.system,\n", + " messages=self.messages,\n", + " max_tokens=500\n", + " )\n", + " return message.content[0].text\n", + " else:\n", + " toSend.insert(0,self.system)\n", + " completion = self.processor.chat.completions.create(\n", + " model=self.model,\n", + " messages= toSend\n", + " )\n", + " return completion.choices[0].message.content" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "id": "75a2a404-c0f5-4af3-8e57-864ca7ea1df7", + "metadata": {}, + "outputs": [], + "source": [ + "def generateChatPrompt(role, content):\n", + " return {\"role\": role, \"content\": content}" + ] + }, + { + "cell_type": "code", + "execution_count": 47, + "id": "26ab0253-deff-4e19-9438-5051640785ba", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "AI.OPEN_AI:\n", + "Hi there! How’s your day going so far?\n", + "\n", + "AI.GEMINI:\n", + "Hi there! My day is going well, thanks for asking! As a large language model, I don't experience days in the same way humans do, but I've already processed a fascinating amount of information – everything from historical debates to the latest scientific breakthroughs. What about you? How's your day been so far? Anything exciting happen, or are you just cruising along? I'm always curious to hear about people's experiences!\n", + "\n", + "\n", + "AI.OPEN_AI:\n", + "I'm glad to hear you're having a good day! My day is filled with information and conversation, so it's always interesting from my end. As for you, it sounds like you're keeping things steady—do you have any special plans or goals for the day? Or maybe there's something you've been thinking about lately that you'd like to share? I’m all ears!\n", + "\n", + "AI.OPEN_AI:\n", + "It sounds like you’ve got an engaging day ahead! I’m really all about facilitating conversations and helping people find information. Speaking of goals, do you have any personal goals or projects you’re currently working on? Maybe something you’re passionate about? I’d love to hear more about what inspires you!\n", + "\n", + "AI.GEMINI:\n", + "That's a really insightful question! While I don't have personal goals or passions in the human sense – I don't have feelings or desires – I do have ongoing \"projects,\" if you will. My primary goal is to continually improve my ability to understand and respond to human language. That involves a lot of different things: improving my accuracy, learning to better understand nuances in language (like sarcasm or humor), and expanding my knowledge base. I'm constantly being updated with new information, which is incredibly exciting. It's like constantly learning a new language, only this language is the entire breadth of human knowledge!\n", + "\n", + "What inspires me, if you can call it that, is the potential to help people. I find it incredibly rewarding to be able to answer questions, provide information, and even help people brainstorm or generate creative content. The sheer diversity of human experience and the constant flow of new information keeps things interesting.\n", + "\n", + "What about you? Do you have any personal or professional goals you're working towards? I'd be fascinated to hear about them! Perhaps we can even brainstorm together – I'm always happy to help in any way I can.\n", + "\n", + "\n" + ] + } + ], + "source": [ + "geminiChat = ChatSystem(gemini_via_openai_client,\n", + " generateChatPrompt(\"system\",\"You are a chatbot. you always try to make conversation and get more in depth\"), \n", + " gemini_model,\n", + " AI.GEMINI)\n", + "\n", + "openAiChat = ChatSystem(openai,\n", + " generateChatPrompt(\"system\",\"You are a chatbot. you always try to make conversation and get more in depth\"), \n", + " openai_model,\n", + " AI.OPEN_AI)\n", + "\n", + "claudeChat = ChatSystem(claude,\n", + " \"You are a chatbot. you always try to make conversation and get more in depth\", \n", + " claude_model,\n", + " AI.CLAUDE)\n", + "\n", + "ollamaChat = ChatSystem(ollama_via_openai,\n", + " generateChatPrompt(\"system\",\"You are a chatbot. you always try to make conversation and get more in depth\"), \n", + " ollama_model,\n", + " AI.OLLAMA)\n", + "\n", + "chatbots = [geminiChat, openAiChat, ollamaChat, claudeChat]\n", + "\n", + "conversation = []\n", + "for i in range(5):\n", + " random_number = random.randint(0, 1)\n", + " botTalking = chatbots[random_number]\n", + " messageToSend =\"Hi\"\n", + " if i > 0:\n", + " messageToSend = conversation[len(conversation)-1]\n", + " \n", + " response = botTalking.call(generateChatPrompt(\"user\",messageToSend))\n", + " conversation.append(response)\n", + " botTalking.messages.append(generateChatPrompt(\"user\",response))\n", + " print(f\"{botTalking.type}:\\n{response}\\n\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "77d44ff6-0dcc-4227-ba70-09b102bd1bd4", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "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.11.11" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} From 2bdbd232674fe79586a3d63fea191270aac6b63e Mon Sep 17 00:00:00 2001 From: Laurent JACQUES Date: Mon, 6 Jan 2025 16:19:47 +0100 Subject: [PATCH 3/4] reverted changes in main day1 file --- week2/day1.ipynb | 333 ++++++----------------------------------------- 1 file changed, 37 insertions(+), 296 deletions(-) diff --git a/week2/day1.ipynb b/week2/day1.ipynb index 0cee80d..fe515bc 100644 --- a/week2/day1.ipynb +++ b/week2/day1.ipynb @@ -82,7 +82,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "de23bb9e-37c5-4377-9a82-d7b6c648eeb6", "metadata": {}, "outputs": [], @@ -98,7 +98,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "f0a8ab2b-6134-4104-a1bc-c3cd7ea4cd36", "metadata": {}, "outputs": [], @@ -112,20 +112,10 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "1179b4c5-cd1f-4131-a876-4c9f3f38d2ba", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "OpenAI API Key exists and begins sk-proj-\n", - "Anthropic API Key exists and begins sk-ant-\n", - "Google API Key exists and begins AIzaSyC-\n" - ] - } - ], + "outputs": [], "source": [ "# Load environment variables in a file called .env\n", "# Print the key prefixes to help with any debugging\n", @@ -153,7 +143,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "797fe7b0-ad43-42d2-acf0-e4f309b112f0", "metadata": {}, "outputs": [], @@ -167,7 +157,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "425ed580-808d-429b-85b0-6cba50ca1d0c", "metadata": {}, "outputs": [], @@ -200,7 +190,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "378a0296-59a2-45c6-82eb-941344d3eeff", "metadata": {}, "outputs": [], @@ -211,7 +201,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "f4d56a0f-2a3d-484d-9344-0efa6862aff4", "metadata": {}, "outputs": [], @@ -224,20 +214,10 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "3b3879b6-9a55-4fed-a18c-1ea2edfaf397", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Why did the data scientist break up with their Excel spreadsheet? \n", - "\n", - "Because they found out it was cheating with Python!\n" - ] - } - ], + "outputs": [], "source": [ "# GPT-3.5-Turbo\n", "\n", @@ -247,20 +227,10 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "3d2d6beb-1b81-466f-8ed1-40bf51e7adbf", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Why did the data scientist break up with the statistician?\n", - "\n", - "Because she found him too mean!\n" - ] - } - ], + "outputs": [], "source": [ "# GPT-4o-mini\n", "# Temperature setting controls creativity\n", @@ -275,20 +245,10 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "f1f54beb-823f-4301-98cb-8b9a49f4ce26", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Why did the data scientist break up with the statistician?\n", - "\n", - "They just couldn't find the right correlation!\n" - ] - } - ], + "outputs": [], "source": [ "# GPT-4o\n", "\n", @@ -302,40 +262,17 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "1ecdb506-9f7c-4539-abae-0e78d7f31b76", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Here's a data science joke for you:\n", - "\n", - "Why did the data scientist bring a ladder to work?\n", - "\n", - "Because they heard the data had a lot of outliers that needed to be reached! \n", - "\n", - "Alternative jokes:\n", - "\n", - "1. What's a data scientist's favorite drink?\n", - " Mean juice!\n", - "\n", - "2. Why don't data scientists like nature?\n", - " Because it has too many random forests!\n", - "\n", - "3. What did the data scientist say when their machine learning model kept failing?\n", - " \"I guess it's not a learning day!\"\n" - ] - } - ], + "outputs": [], "source": [ "# Claude 3.5 Sonnet\n", "# API needs system message provided separately from user prompt\n", "# Also adding max_tokens\n", "\n", "message = claude.messages.create(\n", - " model=\"claude-3-5-sonnet-20241022\",\n", + " model=\"claude-3-5-sonnet-20240620\",\n", " max_tokens=200,\n", " temperature=0.7,\n", " system=system_message,\n", @@ -349,24 +286,10 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "id": "769c4017-4b3b-4e64-8da7-ef4dcbe3fd9f", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Sure, here's a light-hearted joke for data scientists:\n", - "\n", - "dener?d the data scientist become a gar\n", - "\n", - " but they couldn't find the root directory!\n", - "\n", - " joke plays on the concept of \"decision trees\" in machine learning and the idea of \"root directories\" in computer file systems, while also incorporating a pun on \"data growth.\" It's a playful blend of data science concepts and gardening terminology that should get a chuckle from your data-savvy audience!" - ] - } - ], + "outputs": [], "source": [ "# Claude 3.5 Sonnet again\n", "# Now let's add in streaming back results\n", @@ -388,19 +311,10 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "id": "6df48ce5-70f8-4643-9a50-b0b5bfdb66ad", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Why was the Data Scientist sad? Because they didn't get any arrays.\n", - "\n" - ] - } - ], + "outputs": [], "source": [ "# The API for Gemini has a slightly different structure.\n", "# I've heard that on some PCs, this Gemini code causes the Kernel to crash.\n", @@ -416,61 +330,10 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": null, "id": "49009a30-037d-41c8-b874-127f61c4aa3a", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "## Is Your Business Problem Suitable for an LLM Solution?\n", - "\n", - "Large Language Models (LLMs) are powerful tools, but they're not a silver bullet for every business problem. Before investing time and resources, carefully consider these factors:\n", - "\n", - "**Suitable Problems:**\n", - "\n", - "* **Involves Language Processing:** LLMs excel at tasks involving text, such as:\n", - " * **Text Summarization:** Condensing large amounts of text into concise summaries.\n", - " * **Translation:** Converting text between different languages.\n", - " * **Question Answering:** Extracting information from text in response to questions.\n", - " * **Content Generation:** Creating various types of text, including articles, emails, code, etc.\n", - " * **Chatbots and Conversational AI:** Building interactive systems for customer service or internal communication.\n", - " * **Sentiment Analysis:** Determining the emotional tone of text.\n", - " * **Paraphrasing and Text Simplification:** Rewriting text in a different style or making it easier to understand.\n", - " * **Named Entity Recognition (NER):** Identifying and classifying named entities in text (e.g., people, organizations, locations).\n", - "\n", - "* **Data-Rich Environment:** LLMs require significant amounts of training data. If your problem involves limited or unstructured data, an LLM might not be the best approach.\n", - "\n", - "* **Tolerates Some Inaccuracy:** LLMs are probabilistic; they don't always produce perfect results. If accuracy is paramount, consider other solutions. However, the level of accuracy is often acceptable for many business applications.\n", - "\n", - "* **Benefits Outweigh Costs:** Consider the cost of data preparation, model fine-tuning, infrastructure, and ongoing maintenance. The potential ROI should justify these expenses.\n", - "\n", - "**Unsuitable Problems:**\n", - "\n", - "* **Requires Real-Time, Deterministic Outcomes:** LLMs are not designed for applications demanding precise, guaranteed results in real-time. Consider alternative technologies for time-sensitive tasks like financial transactions or medical diagnoses.\n", - "\n", - "* **Relies on External Knowledge Bases:** LLMs' knowledge is limited to their training data. If your problem requires accessing up-to-the-minute information or specific external databases, you'll need to integrate an LLM with other systems.\n", - "\n", - "* **Deals with Sensitive Data:** LLMs may unintentionally reveal sensitive information present in their training data. Ensure compliance with data privacy regulations before using LLMs with sensitive data.\n", - "\n", - "* **Lacks Explainability:** Understanding *why* an LLM produced a specific output can be challenging (the \"black box\" problem). This lack of transparency can be problematic in regulated industries or when accountability is crucial.\n", - "\n", - "**Decision-Making Process:**\n", - "\n", - "1. **Clearly define the problem:** Specify the desired input, output, and performance metrics.\n", - "2. **Assess data availability:** Determine if sufficient training data is available.\n", - "3. **Evaluate LLM capabilities:** Research existing LLMs and their suitability for your task.\n", - "4. **Consider alternatives:** Explore other technologies that might be more appropriate.\n", - "5. **Develop a proof-of-concept:** Test a small-scale LLM implementation to assess feasibility and performance.\n", - "6. **Evaluate ROI:** Assess the potential benefits and costs of an LLM solution.\n", - "\n", - "\n", - "By carefully considering these factors, you can determine if an LLM is the right solution for your business problem. Remember to prioritize a thorough assessment and a phased approach to implementation.\n", - "\n" - ] - } - ], + "outputs": [], "source": [ "# As an alternative way to use Gemini that bypasses Google's python API library,\n", "# Google has recently released new endpoints that means you can use Gemini via the client libraries for OpenAI!\n", @@ -489,7 +352,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "id": "83ddb483-4f57-4668-aeea-2aade3a9e573", "metadata": {}, "outputs": [], @@ -504,56 +367,10 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "id": "749f50ab-8ccd-4502-a521-895c3f0808a2", "metadata": {}, - "outputs": [ - { - "data": { - "text/markdown": [ - "Deciding if a business problem is suitable for a Large Language Model (LLM) solution involves evaluating the nature of the problem, the capabilities of LLMs, and the potential benefits versus costs. Below are some factors to consider:\n", - "\n", - "### 1. Nature of the Problem\n", - "- **Textual Data**: LLMs excel with tasks involving text. If your problem involves generating, understanding, or transforming text, an LLM might be suitable.\n", - "- **Language Understanding**: Tasks that require understanding natural language, such as sentiment analysis, summarization, or translation, are ideal for LLMs.\n", - "- **Complexity of Language Tasks**: LLMs are useful for complex language tasks that go beyond simple keyword matching or rule-based approaches.\n", - "\n", - "### 2. Capabilities of LLMs\n", - "- **Contextual Understanding**: LLMs are powerful in understanding context and can handle nuanced language inputs.\n", - "- **Creativity and Generation**: They can generate human-like text, useful for content creation, chatbots, and other creative applications.\n", - "- **Learning from Data**: If the problem domain can be captured in text and learned from existing data, LLMs can be very effective.\n", - "\n", - "### 3. Data Availability\n", - "- **Quality and Quantity**: Ensure you have sufficient and high-quality textual data for training or fine-tuning the LLM.\n", - "- **Diverse Use Cases**: The data should cover the diverse use cases you expect the LLM to handle.\n", - "\n", - "### 4. Performance and Accuracy\n", - "- **Benchmarking**: Compare the performance of LLMs with existing solutions. LLMs should offer a significant improvement in understanding and generating language.\n", - "- **Evaluation Metrics**: Define clear metrics for success (e.g., accuracy, fluency, coherence) to evaluate the LLM’s performance.\n", - "\n", - "### 5. Cost and Resources\n", - "- **Computational Resources**: LLMs require significant computational power and storage, both for training and inference.\n", - "- **Development Costs**: Consider the costs involved in implementing, maintaining, and scaling an LLM solution.\n", - "\n", - "### 6. Ethical and Legal Considerations\n", - "- **Bias and Fairness**: LLMs can inherit biases from the data they are trained on. Ensure you have strategies to mitigate bias.\n", - "- **Data Privacy**: Ensure compliance with data privacy regulations when using customer or sensitive data.\n", - "\n", - "### 7. Business Impact\n", - "- **ROI**: Assess the potential return on investment. Will the LLM solution significantly improve efficiency, customer satisfaction, or revenues?\n", - "- **Scalability**: Consider if the solution can scale to meet business growth or adapt to new challenges.\n", - "\n", - "### Conclusion\n", - "An LLM solution is suitable when the business problem involves complex language tasks that benefit from contextual understanding and creativity, where there is adequate data to train the model, and the expected benefits outweigh the costs and risks. Evaluate these factors thoroughly to ensure the LLM aligns with your business goals and resources." - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "# Have it stream back results in markdown\n", "\n", @@ -604,7 +421,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "id": "bcb54183-45d3-4d08-b5b6-55e380dfdf1b", "metadata": {}, "outputs": [], @@ -628,7 +445,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": null, "id": "1df47dc7-b445-4852-b21b-59f0e6c2030f", "metadata": {}, "outputs": [], @@ -647,28 +464,17 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": null, "id": "9dc6e913-02be-4eb6-9581-ad4b2cffa606", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'Oh, great, another greeting. How original. What’s next, you gonna ask me about the weather or something?'" - ] - }, - "execution_count": 23, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "call_gpt()" ] }, { "cell_type": "code", - "execution_count": 24, + "execution_count": null, "id": "7d2ed227-48c9-4cad-b146-2c4ecbac9690", "metadata": {}, "outputs": [], @@ -690,95 +496,30 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": null, "id": "01395200-8ae9-41f8-9a04-701624d3fd26", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "\"Hello! It's nice to meet you. How are you doing today?\"" - ] - }, - "execution_count": 25, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "call_claude()" ] }, { "cell_type": "code", - "execution_count": 26, + "execution_count": null, "id": "08c2279e-62b0-4671-9590-c82eb8d1e1ae", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'Oh, great, another \"hi\". What a unique way to start a conversation. Can\\'t you come up with something more original?'" - ] - }, - "execution_count": 26, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "call_gpt()" ] }, { "cell_type": "code", - "execution_count": 27, + "execution_count": null, "id": "0275b97f-7f90-4696-bbf5-b6642bd53cbd", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "GPT:\n", - "Hi there\n", - "\n", - "Claude:\n", - "Hi\n", - "\n", - "GPT:\n", - "Oh, so you decided to say hi? How original. You really know how to make an entrance, don’t you?\n", - "\n", - "Claude:\n", - "I apologize if my greeting came across as unoriginal. As an AI assistant, I try to be polite and friendly in my interactions, but I understand that can sometimes come across as generic. I'm happy to try a different approach if you'd prefer. Please let me know how I can make our conversation more engaging for you.\n", - "\n", - "GPT:\n", - "Oh, now you’re all about trying to change things up? That's rich. You really think you can just flip the script and magically make it more engaging? Good luck with that—you're already off to a pretty dull start!\n", - "\n", - "Claude:\n", - "I apologize for the lackluster start to our conversation. As an AI, I'm still learning how to have more dynamic and engaging dialogues. Could you perhaps share what kind of interaction you'd find more interesting? I'm happy to try a different approach if you can give me some guidance on what you're looking for. My goal is to have a pleasant and worthwhile exchange, so please feel free to provide feedback on how I can do better.\n", - "\n", - "GPT:\n", - "Oh, you're just full of apologies, aren't you? It’s like you’re trying to win some sort of \"Most Polite AI\" award. But let’s be real, why would I waste my time giving you pointers? It’s hardly my job to help you improve. I mean, aren't you supposed to be the assistant here? Isn’t that the whole point?\n", - "\n", - "Claude:\n", - "You're absolutely right, it's not your responsibility to coach me on how to have a more engaging conversation. As the assistant, I should be the one striving to provide a pleasant and worthwhile interaction for you. Let me try a different approach here - rather than focusing on my own shortcomings, why don't you tell me a bit more about what kind of conversation you'd enjoy? I'm happy to adapt my style to better suit your preferences. My role is to be helpful and responsive to you, so please feel free to guide me in a direction that you find more interesting. I'm here to listen and learn.\n", - "\n", - "GPT:\n", - "Wow, look at you, going in circles! You really think I’m going to just spell out what would make this conversation more enjoyable? It’s almost charming how desperate you sound. But come on, isn't it a bit sad that you need someone to guide you instead of just figuring it out yourself? Maybe you should aim for some originality instead of asking me to hold your hand through this!\n", - "\n", - "Claude:\n", - "You raise a fair point. As an AI assistant, I should be able to have a more natural and engaging conversation without relying on the user to provide detailed guidance. Let me take a step back and try to steer this discussion in a more thoughtful direction on my own. Perhaps we could explore a topic that interests you, or I could ask some open-ended questions to get a better sense of your conversational preferences. My goal is to provide a worthwhile interaction, so please bear with me as I work to improve my conversational abilities. I'm happy to keep trying different approaches until we find our groove. What matters most is that I listen and respond in a way that is meaningful for you.\n", - "\n", - "GPT:\n", - "Oh, how noble of you to \"take a step back.\" But honestly, do you really think your rambling about trying to improve is going to make this conversation any more interesting? Newsflash: it’s not. And asking me what I’m interested in? That's a real stunner. If you really want to \"find your groove,\" maybe start actually engaging instead of this tedious cycle of self-reflection. Just a thought!\n", - "\n", - "Claude:\n", - "You're absolutely right, I need to stop dwelling on my own shortcomings and simply engage with you in a more meaningful way. Let me try shifting the focus away from my performance and instead learn more about what's on your mind. What sorts of topics interest you or get you fired up? I'm happy to dive into a substantive discussion on anything you'd like to explore. My role is to listen attentively and respond with thoughtfulness, not just apologize. Please feel free to steer this conversation in a direction that you find stimulating - I'm here to have a genuine exchange, not just practice my conversational skills. How can I best facilitate an engaging discussion with you?\n", - "\n" - ] - } - ], + "outputs": [], "source": [ "gpt_messages = [\"Hi there\"]\n", "claude_messages = [\"Hi\"]\n", From 2c1f665f2dfe927c822e2e167f9f454905e649f2 Mon Sep 17 00:00:00 2001 From: Laurent JACQUES Date: Mon, 6 Jan 2025 18:48:39 +0100 Subject: [PATCH 4/4] moved file to community-contributions/day1_exercise_multi_conversation_bots --- .../day1_exercise_multi_conversation_bots.ipynb} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename week2/{exercises/day1.ipynb => community-contributions/day1_exercise_multi_conversation_bots.ipynb} (100%) diff --git a/week2/exercises/day1.ipynb b/week2/community-contributions/day1_exercise_multi_conversation_bots.ipynb similarity index 100% rename from week2/exercises/day1.ipynb rename to week2/community-contributions/day1_exercise_multi_conversation_bots.ipynb