{ "cells": [ { "cell_type": "markdown", "metadata": { "id": "view-in-github", "colab_type": "text" }, "source": [ "\"Open" ] }, { "cell_type": "markdown", "metadata": { "id": "Nb7bctoXt2_e" }, "source": [ "# **Autonomous Ideation Agent for Novel Invention Generation**\n", "\n", "---\n", "\n", "> ## **Project Overview**\n", "> *Invention Ideation through AI-Driven Autonomy*\n", "\n", "---\n", "\n", "> ## **Technical Approach**\n", ">\n", "> **AI-Driven Invention Generation**\n", "> Simulating creative genius, our agent employs cutting-edge AI to forge **unconstrained** invention ideas across domains.\n", ">\n", "> **Iterative Learning Framework**\n", "> Learning from both successes and failures, the agent adapts, evolving its understanding of **innovation landscapes**.\n", ">\n", "> **Multidimensional Idea Evaluation**\n", "> Quantitative metrics and qualitative insights converge to **evaluate** feasibility, innovation, complexity, cost, and market potential.\n", ">\n", "> **Failure Analysis and Refinement**\n", "> Failures breed growth. Dissecting setbacks, the agent refines strategies, ensuring each iteration **surpasses the last**.\n", "\n", "---\n", "\n", "> ## **Significance**\n", ">\n", "> 1. **AI-Powered Creativity**\n", "> - Synthesizing unconventional ideas **beyond boundaries**.\n", ">\n", "> 2. **Iterative Adaptation**\n", "> - Continuous improvement driven by **evolving preferences**.\n", ">\n", "> 3. **Qualitative-Quantitative Fusion**\n", "> - Holistic evaluation enlightening **potential and feasibility**.\n", ">\n", "> 4. **Failure-Driven Innovation**\n", "> - Setbacks as **stepping stones** for enhanced ideation.\n", "\n", "---\n", "\n", "> ## **Implications**\n", ">\n", "> Reshaping innovation in an evolving technological era, the project fuses AI, creativity, innovation, and the [`simpleaichat` library](https://github.com/minimaxir/simpleaichat) by [@minimaxir](https://github.com/minimaxir). Applications span diverse fields, envisioning the **future of ideation**.\n", "\n", "---\n", "\n", "> ## **Technology Leveraged**\n", ">\n", "> An update to ChatGPT on June 13th, 2023 allows the user to set a predefined schema to have ChatGPT output data according to that schema and/or take in an input schema and respond better to that data. This \"function calling,\" as OpenAI calls it, can be used as a form of tools, but the schema, enabled by a JSON-finetuning of ChatGPT, is much more useful for typical generative AI use cases, particularly when not using GPT-4.\n", ">\n", "> OpenAI's [official demos](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_call_functions_with_chat_models.ipynb) for this feature are complicated, but with `simpleaichat`, it's very easy to support placing your own data.\n", ">\n", "> **NOTE: Ensuring input and output follows a complex predefined structure is very new in the field of prompt engineering, and although it is very powerful, your mileage may vary.**\n", "\n", "---\n" ] }, { "cell_type": "markdown", "source": [ "## Install and Import Required Libraries" ], "metadata": { "id": "DxGCiWIwzGFy" } }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "kGb-HZX7t2_h" }, "outputs": [], "source": [ "!pip install -q simpleaichat\n", "!pip install openai\n", "\n", "from simpleaichat import AIChat\n", "import orjson\n", "from rich.console import Console\n", "from getpass import getpass\n", "\n", "from typing import List, Literal, Optional, Union\n", "from pydantic import BaseModel, Field" ] }, { "cell_type": "code", "source": [ "from simpleaichat import AIChat\n", "import os\n", "import pandas as pd\n", "import openai\n", "import time\n", "from IPython.display import display, Markdown\n", "from IPython.core.display import HTML\n", "from PIL import Image as PILImage\n", "from io import BytesIO\n", "import requests\n", "\n", "# Replace YOUR_API_KEY with the actual OpenAI API key\n", "os.environ['OPENAI_API_KEY'] = \"Your OpenAI API Key\"\n", "\n", "# Function to generate image from text\n", "def generate_image_from_text(prompt_text, api_key, imagefilename):\n", " r = requests.post('https://clipdrop-api.co/text-to-image/v1',\n", " files = {'prompt': (None, prompt_text, 'text/plain')},\n", " headers = {'x-api-key': api_key}\n", " )\n", "\n", " if r.ok:\n", " image_data = r.content\n", " image = PILImage.open(BytesIO(image_data))\n", "\n", " # Replace spaces with underscores and remove special characters for filename\n", " print(f\"Image Filename: {imagefilename}\")\n", " filename = imagefilename.replace(\" \", \"_\") + \".png\"\n", "\n", " # Save the image\n", " image.save(filename)\n", " display(Markdown(f\"### Image Prototype Rendering Using Stability.AI\"))\n", " display(image)\n", " return filename\n", " else:\n", " r.raise_for_status()\n", "\n", "\n", "\n", "# Define separate AIChat instances for different tools\n", "params_audience_analyzer = {\"model\": \"gpt-3.5-turbo-16k\", \"temperature\": 0.5, \"max_tokens\": 100}\n", "params_ideator= {\"model\": \"gpt-4\", \"temperature\": 0.2, \"max_tokens\": 100}\n", "params_critiquer = {\"model\": \"gpt-3.5-turbo-16k\", \"temperature\": 0.7, \"max_tokens\": 100}\n", "params_integrator = {\"model\": \"gpt-4\", \"temperature\": 0.7, \"max_tokens\": 600}\n", "params_scorer = {\"model\": \"gpt-3.5-turbo-16k\", \"temperature\": 0.2, \"max_tokens\": 10, \"logit_bias\": {str(k): 10 for k in range(1, 9)}}\n", "params_learning_agent = {\"model\": \"gpt-3.5-turbo-16k\", \"temperature\": 0.5, \"max_tokens\": 200}\n", "params_image_prompter = {\"model\": \"gpt-4\", \"temperature\": 0.5, \"max_tokens\": 200}\n", "params_markdown_formatter = {\"model\": \"gpt-4\", \"temperature\": 0.5, \"max_tokens\": 800}\n", "\n", "\n", "\n", "# Define a new AIChat instance for analyzing the target audience\n", "ai_audience_analyzer = AIChat(system=\"You are an expert in analyzing the target audience for various products and services. Based on a given query, provide insights into the potential target audience, their preferences, needs, and any other relevant details that would be helpful for an inventor who is trying to create a blockbuster invention for this audience.\", params=params_audience_analyzer, console=False)\n", "ai_ideator = AIChat(system=\"You are an invention ideation genius. Your goal is to come up with a single genius blockbuster innovative idea for the given invention category. Start your response with Invention Idea:\",params=params_ideator, console=False)\n", "ai_critiquer = AIChat(system=\"You are a critiquer.You poke holes in an idea and think of counterfactuals. You also make suggestions for solving found issues and signficicant improvements. Start your response with Critique:\",params=params_critiquer, console=False)\n", "ai_integrator = AIChat(system=\"You are an integrator of invention and invention critique. You provide an improved version of the idea based on the original idea and the critique You return an updated idea based on your synthesis of the critique. Start your response with Revised Idea:\",params=params_integrator, console=False)\n", "ai_scorer = AIChat(system=\"You are a scorer providing only a single 1-9 score for the quality of the invention idea. You provide no other text before or after your score.\",params=params_scorer, console=False)\n", "ai_scorer_originality = AIChat(system=\"You are a scorer for the invention's originality, providing only a single 1-9 score.You provide no other text before or after your score. \", params=params_scorer, console=False)\n", "ai_scorer_practicality = AIChat(system=\"You are a scorer for the invention's practicality, providing only a single 1-9 score. You provide no other text before or after your score.\", params=params_scorer, console=False)\n", "ai_scorer_impact = AIChat(system=\"You are a scorer for the invention's impact, providing only a single 1-9 score. You provide no other text before or after your score.\", params=params_scorer, console=False)\n", "ai_scorer_alignment = AIChat(system=\"You are a scorer for the invention's alignment with target audience, providing only a single 1-9 score.You provide no other text before or after your score. \", params=params_scorer, console=False)\n", "ai_scorer_aesthetic = AIChat(system=\"You are a scorer for the invention's aesthetic and design quality, providing only a single 1-9 score.You provide no other text before or after your score. \", params=params_scorer, console=False)\n", "ai_learning_agent = AIChat(system=\"You are a learning agent responsible for analyzing previous iterations, identifying patterns, and providing insights to guide the invention process. Your readout should be directive and non-generic, preferencing specific recommendations for the product itself, and not the process of improvement\", params=params_learning_agent, console=False)\n", "ai_image_prompter = AIChat(system=\"You are an expert in crafting prompts for text-to-image models like Midjourney/Dalle2. Based on the given synthesized idea, create a prompt that follows best practices for generating successful text-to-image outputs.\", params=params_image_prompter, console=False)\n", "ai_markdown_formatter = AIChat(system=\"You are an expert in formatting text into beautiful markdown. Take the given idea and present it in a well-organized and visually appealing markdown format, adding any missing details as needed.\", params=params_markdown_formatter, console=False)\n", "\n", "\n", "# Number of critique and synthesis iterations per idea\n", "NUM_STAGES = 3\n", "\n", "# Define thresholds for various scores\n", "QUALITY_THRESHOLD = 8.0\n", "ORIGINALITY_THRESHOLD = 8.0\n", "PRACTICALITY_THRESHOLD = 9.0\n", "IMPACT_THRESHOLD = 9.0\n", "ALIGNMENT_THRESHOLD = 7.0\n", "AESTHETIC_THRESHOLD = 7.0\n", "\n", "# Define DataFrame columns\n", "columns = ['Iteration', 'Query', 'Target Audience', 'Idea']\n", "for i in range(1, NUM_STAGES + 1):\n", " columns += [f'Critique{i}', f'Synthesis{i}']\n", "columns += ['Quality Score', 'Originality', 'Practicality', 'Impact', 'Alignment', 'Aesthetic', 'Learning_Agent_Insights']\n", "\n", "# Initialize DataFrame with columns\n", "progress_df = pd.DataFrame(columns=columns)\n", "\n", "iteration_count = 0\n", "\n", "# Outer loop to continue until quality threshold is met\n", "while True:\n", " time.sleep(60)\n", " iteration_count += 1\n", " print(f\"Iteration {iteration_count}\")\n", " query = \"Invent a blockbuster toy for Autistic Teens\"\n", "\n", " # Analyze the target audience based on the query\n", " audience_details = ai_audience_analyzer(f\"Analyze the target audience for the query: {query}\")\n", "\n", " # Collect and analyze previous iterations (if available)\n", " if iteration_count > 1:\n", " previous_ideas = progress_df[['Idea'] + [f'Critique{i}' for i in range(1, NUM_STAGES + 1)]]\n", " idea_insights = ai_learning_agent(f\"Analyze previous iterations and provide insights and learnings that would make the next round of invention ideas more fruitful and likely to succeed in a blockbuster invention. {previous_ideas.to_string()}\")\n", " previous_critiques = progress_df[[f'Critique{i}' for i in range(1, NUM_STAGES + 1)]]\n", " critique_insights = ai_learning_agent(f\"Analyze previous critiques and provide insights: {previous_critiques.to_string()}\")\n", "\n", " else:\n", " idea_insights = \"No previous iterations to analyze.\"\n", " critique_insights = \"No previous critiques to analyze.\"\n", "\n", " # Generate creative ideas, incorporating insights from the learning agent\n", " idea = ai_ideator(f\"\"\"Generate creative ideas for {query} based on a deep understanding of the needs, wants, and specific challenges of the target audience: {audience_details}.\n", " Make good use of the Insights from previous ideas so you do not repeat your mistakes or suggest an identical failed idea and can iteratively improve. In some cases there will be opportunities to think laterally and combine elements of previous ideas. Previous Ideas: {idea_insights}.\n", " Also leverage learnings from previous idea critiques to inform and improve subsequent ideas by not repeating mistakes and having a deeper ongoing understanding of what will be required for a highly successful idea. Previous Critiques: {critique_insights}\"\"\")\n", "\n", " # Add a new row for this idea\n", " row_data = {'Iteration': iteration_count, 'Target Audience': audience_details, 'Query': query, 'Idea': idea, 'Learning Agent Idea Insights': idea_insights, 'Learning Agent Critique Insights': critique_insights}\n", " synthesis = idea\n", "\n", " # Loop through critique and synthesis stages\n", " for stage in range(1, NUM_STAGES + 1):\n", " time.sleep(60)\n", " critique = ai_critiquer(f\"Critique the given idea: {synthesis}\")\n", " synthesis = ai_integrator(f\"\"\"Synthesize the given idea and critique into an improved version that considers the suggestions and feedback.\n", " The output should be a revised idea starting with Revised Idea: Data to use for revised idea: Previous iteration idea:{synthesis} \\n Previous iteration critique:{critique}\"\"\")\n", " row_data[f'Critique{stage}'] = critique\n", " row_data[f'Synthesis{stage}'] = synthesis\n", "\n", " # Evaluate the final synthesis\n", " row_data['Quality Score'] = float(ai_scorer(f\"Evaluate the quality of this synthesis: {synthesis}\"))\n", " row_data['Originality'] = float(ai_scorer_originality(f\"Score the originality of this synthesis: {synthesis}\"))\n", " row_data['Practicality'] = float(ai_scorer_practicality(f\"Score the practicality of this synthesis: {synthesis}\"))\n", " row_data['Impact'] = float(ai_scorer_impact(f\"Score the impact of this synthesis: {synthesis}\"))\n", " row_data['Alignment'] = float(ai_scorer_alignment(f\"Score the alignment of this synthesis: {synthesis} based on value to the target audience {audience_details}\"))\n", " row_data['Aesthetic'] = float(ai_scorer_aesthetic(f\"Score the aesthetic of this synthesis: {synthesis}\"))\n", "\n", " # Append the row data to the DataFrame\n", " progress_df = pd.concat([progress_df, pd.DataFrame([row_data])], ignore_index=True)\n", "\n", " # Check whether all thresholds have been met\n", " if (row_data['Quality Score'] >= QUALITY_THRESHOLD and\n", " row_data['Originality'] >= ORIGINALITY_THRESHOLD and\n", " row_data['Practicality'] >= PRACTICALITY_THRESHOLD and\n", " row_data['Impact'] >= IMPACT_THRESHOLD and\n", " row_data['Alignment'] >= ALIGNMENT_THRESHOLD and\n", " row_data['Aesthetic'] >= AESTHETIC_THRESHOLD):\n", " final_synthesis = synthesis\n", "\n", " # Generate the image prompt\n", " image_prompt = ai_image_prompter(f\"Create a text-to-image prompt based on the final synthesized idea. Make sure to describe the idea in terms that would be needed for an artist to render it visually, showing off it's specific features: {final_synthesis}\")\n", " markdown_text = ai_markdown_formatter(f\"Please further flesh out the finalized idea if any details or specifics are missing. Return your answer in beautiful Markdown making full use of all relevant markdown formats. Idea for fleshing out and markdown enhancement: {final_synthesis}\")\n", "\n", " # Generate the image\n", " api_key_image = \"Your ClipDrop API Key\"\n", " filename = \"final_idea_image\"\n", " image_filename = generate_image_from_text(image_prompt, api_key_image, filename)\n", "\n", " # Display the final idea, its scores, and the image\n", " display(Markdown(f\"### Final Synthesis:\"))\n", " display(Markdown(markdown_text))\n", " display(Markdown(f\"### Evaluation Scores:\"))\n", " table_html = f\"\"\"\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
MetricScore
Quality{row_data['Quality Score']}
Originality{row_data['Originality']}
Practicality{row_data['Practicality']}
Impact{row_data['Impact']}
Alignment{row_data['Alignment']}
Aesthetic{row_data['Aesthetic']}
\n", " \"\"\"\n", "\n", " display(HTML(table_html))\n", "\n", " # Save the DataFrame\n", " progress_df.to_csv('Full_Ideas_Dataframe.csv')\n", " print(\"Final DataFrame saved to 'Full_Ideas_Dataframe.csv'\")\n", " break\n", "\n", "print(f\"Final Synthesis: {synthesis}\")\n", "\n", "\n", "\n", "\n", "\n", "\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "T1jiff6eeiWE", "outputId": "b9e47a87-4204-40fd-bc31-c765ec962c98" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Iteration 1\n", "Iteration 2\n", "Iteration 3\n" ] } ] }, { "cell_type": "code", "source": [ "image_prompt #print this and try it in Midjourney if you want an even better result. Stability AI's latest model (Via ClipDrop) is good, but not nearly as good as Midjourney." ], "metadata": { "id": "nY5IIcfmG_0W" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "progress_df #print the dataframe of inventions for a quick look" ], "metadata": { "id": "yhD0URMcejwT" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "progress_df.to_csv('inventioneval.csv')" ], "metadata": { "id": "pDfw0aaNelMD" }, "execution_count": null, "outputs": [] }, { "cell_type": "markdown", "source": [ "## Previous Approach I Tried (More prone to errors, perhaps somewhat inferior to the above approach but you are welcome to try it as well)" ], "metadata": { "id": "p1jDaPklzMi9" } }, { "cell_type": "code", "source": [ "from simpleaichat import AIChat\n", "from pydantic import BaseModel, Field\n", "import pandas as pd\n", "from IPython.display import display, Markdown\n", "import time\n", "import requests\n", "from PIL import Image as PILImage\n", "from io import BytesIO\n", "\n", "from simpleaichat import AIChat\n", "from pydantic import BaseModel, Field\n", "import pandas as pd\n", "from IPython.display import display, Markdown\n", "import time\n", "import requests\n", "from PIL import Image as PILImage\n", "from io import BytesIO\n", "import openai\n", "\n", "\n", "\n", "\n", "def generate_image_from_text(prompt_text, api_key, imagefilename):\n", " r = requests.post('https://clipdrop-api.co/text-to-image/v1',\n", " files = {'prompt': (None, prompt_text, 'text/plain')},\n", " headers = {'x-api-key': \"Your Stability AI ClipDrop API Key\"}\n", " )\n", "\n", " if r.ok:\n", " image_data = r.content\n", " image = PILImage.open(BytesIO(image_data)) # use PILImage instead of Image\n", "\n", " # Replace spaces with underscores and remove special characters for filename\n", " print(f\"Image Filename: {imagefilename}\")\n", " filename = imagefilename\n", " filename = filename.replace(\" \", \"_\") + \".png\"\n", "\n", " # Save the image\n", " image.save(filename)\n", " display(Markdown(\"#### Stability.AI Generated Prototype Rendering \"))\n", "\n", " display(image)\n", " return filename\n", " else:\n", " r.raise_for_status()\n", "\n", "\n", "\n", "\n", "\n", "def generate_invention_image_prompt(prompt, model=\"gpt-4\", max_tokens=400, temperature=0.4):\n", " gpt_response = openai.ChatCompletion.create(\n", " model=model,\n", " messages=[\n", " {\"role\": \"system\", \"content\": \"\"\"You will be given an extremely detailed new invention product overview. Your job is to use this to write an image prompt for Dalle2.\n", " The goal is to describe it in high visual detail so the AI model will be able to clearly understand exactly what to draw and how.\n", " Please provide specific direction on how to draw the prototype, a specific style to render it in based on your understanding of the product, and great detail\n", " so that the prompt you are writing when given to the image generating AI will perform accurately. Keep in mind best practices for image AI prompting for systems like midjourney or Dalle2 \"\"\"},\n", " {\"role\": \"user\", \"content\": f\"Product Details: {prompt}\"}],\n", " max_tokens=max_tokens,\n", " n=1,\n", " stop=None,\n", " temperature=temperature,\n", " )\n", " response = gpt_response['choices'][0]['message']['content'].strip()\n", " return response\n", "\n", "\n", "class Invention(BaseModel):\n", " \"\"\"Container for invention details\"\"\"\n", " Name: str = Field(description=\"Name of the invention\")\n", " Description: str = Field(description=\"A detailed description of the invention\")\n", " Potential_Usage: str = Field(description=\"Possible use cases for the invention\")\n", " Unique_Features: str = Field(description=\"Unique and innovative features of the invention\")\n", " Materials_Required: str = Field(description=\"List of materials required for building the invention\")\n", "\n", "\n", "class Invent(BaseModel):\n", " \"\"\"Container for multiple invention ideas\"\"\"\n", " Invention_1: Invention = Field(description=\"The first invention\")\n", " Invention_2: Invention = Field(description=\"The second invention\")\n", " Invention_3: Invention = Field(description=\"The third Invention\")\n", " Invention_4: Invention = Field(description=\"The fourth Invention\")\n", "\n", "\n", "class Evaluate(BaseModel):\n", " \"\"\"Evaluation information for an idea or invention\"\"\"\n", "\n", " feasibility_score: int = Field(\n", " ...,\n", " description=\"Score for feasibility (1-10): 10 indicates that the idea is highly feasible and easy to create, while 1 suggests it's nearly impossible or presents exceptional roadblocks.\"\n", " )\n", " feasibility_description: str = Field(\n", " ...,\n", " description=\"Provide a detailed analysis of the feasibility score, outlining challenges, opportunities, and potential roadblocks.\"\n", " )\n", "\n", " innovation_score: int = Field(\n", " ...,\n", " description=\"Score for innovation (1-10): 10 represents an extremely innovative concept, while 1 signifies something predictable or already existing.\"\n", " )\n", " innovation_description: str = Field(\n", " ...,\n", " description=\"Explain the innovation score by describing the novelty of the idea, comparing it to existing solutions, and analyzing its creative aspects.\"\n", " )\n", "\n", " complexity_score: int = Field(\n", " ...,\n", " description=\"Score for complexity (1-10): 10 denotes a highly complex and possibly unfeasible idea, whereas 1 indicates simplicity.\"\n", " )\n", " complexity_description: str = Field(\n", " ...,\n", " description=\"Provide an in-depth analysis of the complexity score, detailing components, interactions, and challenges in implementation.\"\n", " )\n", "\n", " cost_score: int = Field(\n", " ...,\n", " description=\"Score for production cost (1-10): 10 implies extremely high costs, while 1 means the idea would be cheap to produce.\"\n", " )\n", " cost_description: str = Field(\n", " ...,\n", " description=\"Explain the cost score, including estimates for production, materials, labor, and other factors influencing the overall cost.\"\n", " )\n", "\n", " market_potential_score: int = Field(\n", " ...,\n", " description=\"Score for market potential (1-10): 10 signifies a blockbuster idea with broad appeal, while 1 represents minimal or niche interest.\"\n", " )\n", " market_potential_description: str = Field(\n", " ...,\n", " description=\"Analyze the market potential score by examining target demographics, competition, market trends, and potential barriers to entry.\"\n", " )\n", "\n", "\n", "class FailureReasonSummarizer(BaseModel):\n", " \"\"\"Summarizes failure reasons based on detailed summary.\"\"\"\n", "\n", " detailed_summary: str = Field(description=\"Detailed summary of failure reasons\")\n", "\n", " def generate_concise_summary(self, ai_instance):\n", " try:\n", " concise_summary = ai_instance(f\"Given your understanding of the failure reasons, for the next iteration of ideas, what should the AI try to keep in mind. Please keep this to just a few sentences of the most valuable advice gleaned from your evaluation. Advice:: {self.detailed_summary}\")\n", " return concise_summary\n", " except:\n", " return \"Failed to generate a concise failure reason summary.\"\n", "\n", "\n", "\n", "class IterationDecision(BaseModel):\n", " \"\"\"Decision for next iteration step\"\"\"\n", " action: str = Field(description=\"Action to take: 'new_ideas' or 'move_on'\")\n", " reason: str = Field(description=\"Reason for the decision\")\n", "\n", "\n", "\n", "class MarketingPrompt(BaseModel):\n", " \"\"\"Container for marketing prompt details\"\"\"\n", " Tagline: str = Field(description=\"Please simulate an expert product marketer and provide a Catchy tagline for the product that would make potential customers curious and that shows off the unique value prop of the product.\")\n", " Description: str = Field(description=\"Short marketing description highlighting the product's unique features and potential usage\")\n", "\n", "\n", "class PrototypePrompt(BaseModel):\n", " \"\"\"Container for prototype design prompt details\"\"\"\n", " Design_Description: str = Field(\n", " ...,\n", " description=\"Highly detailed and long form description of the prototype design, detailing the product's unique features and potential usage. It should be detailed enough for a factory to understand how to produce the product.\"\n", " )\n", " Features: str = Field(\n", " ...,\n", " description=\"List of key features that will be incorporated into the prototype design. Every single feature should be highly detailed and specifically described.\"\n", " )\n", " Materials: str = Field(\n", " ...,\n", " description=\"List of specific materials that will be used to build the prototype. Include the exact material or materials to be used and the reasoning for using those materials\"\n", " )\n", " Functionality: str = Field(\n", " ...,\n", " description=\"Description of the expected functionality and capabilities of the prototype. This should be highly detailed and cover every single function. It should be clear exactly how the invention accomplishes those functions.\"\n", " )\n", " User_Interactions: str = Field(\n", " ...,\n", " description=\"Highly detailed Explanation of how users will interact with the prototype and its features\"\n", " )\n", " Testing_Plan: str = Field(\n", " ...,\n", " description=\"Outline of the testing plan for evaluating the prototype's performance and usability\"\n", " )\n", "\n", "\n", "\n", "class EvaluateAndImprove(BaseModel):\n", " \"\"\"Container for evaluating and improving selected invention\"\"\"\n", " Improved_Tagline: str = Field(..., description=\"Refined and significantly improve the tagline for marketing that captures the essence of the product\")\n", " Improved_Description: str = Field(..., description=\"Improve, extend and enhance the marketing description highlighting key selling points for the best possible marketing description\")\n", " Improved_Design_Description: str = Field(..., description=\"Make sure that the design description fully explains the product such that it could be given to an engineering firm and be made based on the description alone.\")\n", " Improved_Features: str = Field(..., description=\"Expand on and improve the description of the features. Detail each part individually for a long-form, fleshed out understanding of every single feature and why they matter.\")\n", " Improved_Materials: str = Field(..., description=\"Significantly improve and extend the selection of materials ensuring durability and cost-effectiveness and any other criteria that might improve the product further.\")\n", " Improved_Functionality: str = Field(..., description=\"Improve and significantly extend the detailed explanation of the functionality and performance capabilities. Make sure the functionality is fully described and it is clear exactly how the product accomplishes that functionality.\")\n", " Improved_User_Interactions: str = Field(..., description=\"Improve and extend the Clear instructions on how users will interact with the refined prototype, including user interfaces and controls, etc. This should be a highly detailed description of how the user interacts with the product to get the value.\")\n", " Improved_Testing_Plan: str = Field(..., description=\"Improve and extend the Comprehensive testing plan, outlining methods, metrics, criteria, etc. for evaluating the prototype's effectiveness\")\n", "\n", "\n", "\n", "\n", "def evaluate_invention(ai, invention_name, max_retries):\n", " evaluation = ai(f\"Evaluate the following invention: {invention_name}\", output_schema=Evaluate)\n", " return evaluation\n", "\n", "\n", "def find_unique_invention(\n", " model_name,\n", " api_key,\n", " invention_category,\n", " max_retries,\n", " success_thresholds,\n", " temperature=0.8,\n", " max_tokens = 2000\n", "):\n", " ai = AIChat(\n", " console=False,\n", " save_messages=False,\n", " model=model_name,\n", " params={\"temperature\": temperature, \"max_tokens\": max_tokens},\n", " api_key=api_key\n", " )\n", "\n", " import pandas as pd\n", "\n", " columns = ['Name', 'Description', 'Potential_Usage', 'Unique_Features', 'Materials_Required', 'Feasibility', 'Innovation', 'Complexity', 'Cost', 'Failure_Reasons']\n", " failed_inventions_df = pd.DataFrame(columns=columns)\n", "\n", " retry_count_for_new_ideas = 0\n", "\n", " while True:\n", " successful_idea_found = False\n", " # Combine failure reasons into a prompt\n", " failed_inventions_prompt = \"\\n\".join(\n", " f\"Invention Name: {name}\\nLearnings to apply to next iteration: {reasons}\"\n", " for name, reasons in failed_inventions_df[['Name', 'Failure_Reasons']].values\n", " )\n", "\n", " # Define a maximum prompt length\n", " max_prompt_length = 4096 # Adjust this value as needed\n", "\n", " # Truncate the prompt if it's too long\n", " if len(failed_inventions_prompt) > max_prompt_length:\n", " excess_length = len(failed_inventions_prompt) - max_prompt_length\n", " truncated_failed_inventions_prompt = \"...\" + failed_inventions_prompt[excess_length:]\n", " else:\n", " truncated_failed_inventions_prompt = failed_inventions_prompt\n", "\n", " print(len(failed_inventions_prompt))\n", " prompt = f\"\"\"Please simulate a quirky an eccentric genius inventor that is known for your creativity, uniqueness, and ability to think laterally and counterfactually to come up with the best possible ideas the world has never yet seen.\n", " Your ideas are unique and have not been invented or heard of before. NEVER invent something that already exists. It must be Novel. Try to come up with an invention that is feasible, innovative, not impossibly complex, cost effective to produce, that serves a market need.\n", " A list of 4 innovative inventions in the category of {invention_category} that will be highly useful, interesting, and never seen before. It should be feasible, innovative, not very complex, and have a low cost to produce.\n", " Please think step by step so you come to the best possible invention idea.\n", " Avoid the following failed ideas and learn from what has not worked to inform your new ideas. Think laterally and consider mashups/combinations of failed ideas or parts of failed ideas that could be combined into completely unique and never before seen products.\n", " Never come up with an invention extremely similar to an already failed invention idea. Failed invention ideas:\\n{failed_inventions_prompt}\"\"\"\n", "\n", " while True:\n", " try:\n", " invention_ideas = ai(prompt, output_schema=Invent)\n", " break # If successful, break out of the loop\n", " except:\n", " time.sleep(20)\n", " error_message = \"An error occurred while generating invention ideas. Retrying...\"\n", " display(Markdown(\"---\"))\n", " display(Markdown(f\"**Error:** {error_message}\"))\n", " display(Markdown(\"---\"))\n", " continue\n", "\n", " if retry_count_for_new_ideas == max_retries:\n", " display(Markdown(\"Reached the maximum number of retries for generating new ideas.\"))\n", " continue # Continue to the next iteration of the outer loop\n", "\n", " iteration_count = 1\n", " successful_idea_found = False\n", "\n", " # Loop through each invention idea\n", " for invention_key, invention_data in invention_ideas.items():\n", " name = invention_data['Name']\n", " description = invention_data['Description']\n", " potential_usage = invention_data['Potential_Usage']\n", " unique_features = invention_data['Unique_Features']\n", " materials_required = invention_data['Materials_Required']\n", "\n", " display(Markdown(\"---\"))\n", " display(Markdown(f\"## Evaluating invention - {name}\"))\n", " display(Markdown(f\"### Invention Description - {description}\"))\n", "\n", " # Retry for evaluating invention\n", " retry_count_for_evaluation = 0\n", " while retry_count_for_evaluation < max_retries:\n", " try:\n", " evaluation = evaluate_invention(ai, name, max_retries)\n", " if evaluation is None:\n", " display(Markdown(\"---\")) # Add a horizontal rule\n", " display(Markdown(\"Proceeding to the next invention...\"))\n", " display(Markdown(\"---\")) # Add a horizontal rule\n", " break\n", " feasibility = evaluation[\"feasibility_score\"]\n", " innovation = evaluation[\"innovation_score\"]\n", " complexity = evaluation[\"complexity_score\"]\n", " cost = evaluation[\"cost_score\"]\n", " market_potential = evaluation[\"market_potential_score\"]\n", "\n", " feasibility_description = evaluation[\"feasibility_description\"]\n", " innovation_description = evaluation[\"innovation_description\"]\n", " complexity_description = evaluation[\"complexity_description\"]\n", " cost_description = evaluation[\"cost_description\"]\n", " market_potential_description = evaluation[\"market_potential_description\"]\n", " cost_description = evaluation[\"cost_description\"]\n", "\n", " display(Markdown(f\"### Scores - Feasibility: {feasibility}, Innovation: {innovation}, Complexity: {complexity}, Cost: {cost}, Market Potential: {market_potential}\"))\n", "\n", " if (feasibility > success_thresholds['feasibility'] and\n", " innovation > success_thresholds['innovation'] and\n", " complexity < success_thresholds['complexity'] and\n", " cost < success_thresholds['cost'] and\n", " market_potential > success_thresholds['market_potential']):\n", " decision = IterationDecision(action=\"move_on\", reason=\"Satisfactory criteria met for this invention\")\n", " successful_idea_found = True\n", " display(Markdown(f\"**Decision: Moving on with invention {name}.**\\nReason: {decision.reason}\"))\n", " break\n", " else:\n", " time.sleep(10)\n", " try:\n", " failure_reason_summary = ai(f\"Summarize the reasons for failure of the following invention: {name}\\n\\n{feasibility_description}\\n\\n{innovation_description}\\n\\n{complexity_description}\\n\\n{cost_description}\\n\\n{market_potential_description}\")\n", " except:\n", " failure_reason_summary = \"Failed to generate a failure reason summary.\"\n", "\n", " try:\n", " concise_failure_reasons = ai(f\"Summarize the key failure reasons from the detailed summary: {failure_reason_summary}\")\n", " except:\n", " time.sleep(10)\n", " concise_failure_reasons = \"Failed to generate a concise failure reason summary.\"\n", " display(Markdown(f'**Failure Reasons Summary:** {concise_failure_reasons}'))\n", " display(Markdown(\"---\"))\n", " failed_inventions_df = pd.concat([failed_inventions_df, pd.DataFrame([{\n", " 'Name': name,\n", " 'Description': description,\n", " 'Potential_Usage': potential_usage,\n", " 'Unique_Features': unique_features,\n", " 'Materials_Required': materials_required,\n", " 'Feasibility': feasibility,\n", " 'Innovation': innovation,\n", " 'Complexity': complexity,\n", " 'Cost': cost,\n", " 'Market Potential Score': market_potential,\n", " 'Feasibility_Reason': feasibility_description,\n", " 'Innovation_Reason': innovation_description,\n", " 'Complexity_Reason': complexity_description,\n", " 'Cost_Reason': cost_description,\n", " 'Market Potential Reason': market_potential_description,\n", " 'Failure_Reasons': concise_failure_reasons\n", " }])])\n", "\n", " iteration_count += 1\n", " failed_inventions_df.to_csv('Failed_Inventions_Dataframe.csv')\n", " break # Break the loop for this invention\n", " except Exception as e:\n", " time.sleep(30)\n", " error_message = f\"An error occurred while evaluating invention: {name}. Retrying... (Attempt {retry_count_for_evaluation + 1}/{max_retries})\"\n", " display(Markdown(f\"**Error:** {error_message}\"))\n", " retry_count_for_evaluation += 1\n", " continue\n", "\n", " if retry_count_for_evaluation >= max_retries:\n", " display(Markdown(\"---\"))\n", " display(Markdown(\"### Maximum Retries Reached for Evaluating Inventions\"))\n", " display(Markdown(\"Reached the maximum number of retries for evaluating inventions. Moving to the next invention...\"))\n", " display(Markdown(\"---\"))\n", " continue\n", " failed_inventions_df.to_csv('Failed_Inventions_Dataframe.csv')\n", "\n", "\n", " if successful_idea_found:\n", " successful_idea_md = f\"\"\"\n", " ### Congratulations! A satisfactory invention idea has been found.\n", " - **Name:** {name}\n", " - **Description:** {description}\n", " - **Potential Usage:** {potential_usage}\n", " - **Unique Features:** {unique_features}\n", " - **Materials Required:** {materials_required}\n", " - **Feasibility Score:** {feasibility}\n", " - **Innovation Score:** {innovation}\n", " - **Complexity Score:** {complexity}\n", " - **Cost Score:** {cost}\n", " - **Market Potential Score:** {market_potential}\n", " - **Feasibility Reason:** {feasibility_description}\n", " - **Innovation Reason:** {innovation_description}\n", " - **Complexity Reason:** {complexity_description}\n", " - **Cost Reason:** {cost_description}\n", " - **Market Potential Reason:** {market_potential_description}\n", " \"\"\"\n", " display(Markdown(successful_idea_md))\n", "\n", " successful_idea = {\n", " 'Name': name,\n", " 'Description': description,\n", " 'Potential_Usage': potential_usage,\n", " 'Unique_Features': unique_features,\n", " 'Materials_Required': materials_required,\n", " 'Feasibility_Score': feasibility,\n", " 'Innovation_Score': innovation,\n", " 'Complexity_Score': complexity,\n", " 'Cost_Score': cost,\n", " 'Market_Potential_Score': market_potential,\n", " 'Feasibility_Reason': feasibility_description,\n", " 'Innovation_Reason': innovation_description,\n", " 'Complexity_Reason': complexity_description,\n", " 'Cost_Reason': cost_description,\n", " 'Market_Potential_Reason': market_potential_description\n", " }\n", "\n", " return successful_idea\n", "\n", " if retry_count_for_new_ideas >= max_retries:\n", " display(Markdown(\"---\"))\n", " display(Markdown(\"### Maximum Retries Reached\"))\n", " display(Markdown(\"Reached the maximum number of retries for this set of ideas. Generating new ideas for the next iteration...\"))\n", " display(Markdown(\"---\")) # Add a horizontal rule\n", " retry_count_for_new_ideas = 0\n", " continue\n", " else:\n", " time.sleep(10)\n", " display(Markdown(\"---\"))\n", " display(Markdown(\"### No Satisfactory Inventions Found\"))\n", " display(Markdown(\"The current iteration did not yield any satisfactory invention ideas. Generating new ideas for the next iteration...\"))\n", " display(Markdown(\"---\")) # Add a horizontal rule\n", " continue\n", "\n", "\n", "\n", "def proceed_with_successful_idea(successful_idea, model_name, api_key):\n", " ai = AIChat(\n", " console=False,\n", " save_messages=False,\n", " model=model_name,\n", " params={\"temperature\": 0.6, \"max_tokens\": 4000},\n", " api_key=api_key\n", " )\n", "\n", " display(Markdown(\"## Proceeding with the Successful Idea\"))\n", " display(Markdown(f\"**Name:** {successful_idea['Name']}\"))\n", " display(Markdown(f\"**Description:** {successful_idea['Description']}\"))\n", " display(Markdown(f\"**Potential Usage:** {successful_idea['Potential_Usage']}\"))\n", " display(Markdown(f\"**Unique Features:** {successful_idea['Unique_Features']}\"))\n", " display(Markdown(f\"**Materials Required:** {successful_idea['Materials_Required']}\"))\n", "\n", " marketing_prompt = f\"Introducing the revolutionary {successful_idea['Name']}! Discover a groundbreaking solution that offers {successful_idea['Potential_Usage']} with its unique features: {successful_idea['Unique_Features']}\"\n", " prototype_prompt = f\"Design a prototype for {successful_idea['Name']}, highlighting its unique features and potential applications: {successful_idea['Potential_Usage']}. The prototype should have the following features: Feature 1, Feature 2. It should be constructed using Materials: Material 1, Material 2. The prototype's functionality should include: The prototype will be capable of performing... Users will interact with the prototype by... The testing plan should include...\"\n", "\n", " while True:\n", " try:\n", " marketing_content = ai(marketing_prompt, output_schema=MarketingPrompt)\n", " break # If successful, break out of the loop\n", " except:\n", " time.sleep(10)\n", " print(f\"JSONDecodeError occurred. Retrying marketing content generation for marketing content...\")\n", " continue\n", "\n", " display(Markdown(\"## Generated Marketing Content\"))\n", " display(Markdown(f\"**Tagline:** {marketing_content['Tagline']}\"))\n", " display(Markdown(f\"**Description:** {marketing_content['Description']}\"))\n", "\n", " while True:\n", " try:\n", " prototype_design = ai(prototype_prompt, output_schema=PrototypePrompt)\n", " break # If successful, break out of the loop\n", " except :\n", " time.sleep(10)\n", " print(f\"JSONDecodeError occurred. Retrying prototype design generation...\")\n", " continue\n", "\n", " display(Markdown(\"## Generated Prototype Design\"))\n", " display(Markdown(f\"**Design Description:** {prototype_design['Design_Description']}\"))\n", " display(Markdown(f\"**Features:** {prototype_design['Features']}\"))\n", " display(Markdown(f\"**Materials:** {prototype_design['Materials']}\"))\n", " display(Markdown(f\"**Functionality:** {prototype_design['Functionality']}\"))\n", " display(Markdown(f\"**User Interactions:** {prototype_design['User_Interactions']}\"))\n", " display(Markdown(f\"**Testing Plan:** {prototype_design['Testing_Plan']}\"))\n", "\n", "\n", " # Iterative refinement loop\n", " for iteration in range(5): # 5 iterations as an example; customize as needed\n", " display(Markdown(f\"### Iteration {iteration + 1}\"))\n", " time.sleep(20)\n", "\n", " # Evaluate and improve marketing content\n", " marketing_evaluation_prompt = f\"Evaluate and suggest improvements for the following marketing content: Tagline: {marketing_content['Tagline']}, Description: {marketing_content['Description']}\"\n", " evaluation_and_improvement_marketing = ai(marketing_evaluation_prompt, output_schema=EvaluateAndImprove)\n", " marketing_content['Tagline'] = evaluation_and_improvement_marketing['Improved_Tagline']\n", " marketing_content['Description'] = evaluation_and_improvement_marketing['Improved_Description']\n", "\n", " display(Markdown(\"#### Updated Marketing Content\"))\n", " display(Markdown(f\"**Tagline:** {marketing_content['Tagline']}\"))\n", " display(Markdown(f\"**Description:** {marketing_content['Description']}\"))\n", "\n", " # Evaluate and improve prototype design\n", " prototype_evaluation_prompt = f\"Evaluate and suggest improvements for the following prototype design: Design Description: {prototype_design['Design_Description']}, Features: {prototype_design['Features']}, Materials: {prototype_design['Materials']}, Functionality: {prototype_design['Functionality']}, User Interactions: {prototype_design['User_Interactions']}, Testing Plan: {prototype_design['Testing_Plan']}\"\n", " evaluation_and_improvement_prototype = ai(prototype_evaluation_prompt, output_schema=EvaluateAndImprove)\n", " prototype_design['Design_Description'] = evaluation_and_improvement_prototype['Improved_Design_Description']\n", " prototype_design['Features'] = evaluation_and_improvement_prototype['Improved_Features']\n", " prototype_design['Materials'] = evaluation_and_improvement_prototype['Improved_Materials']\n", " prototype_design['Functionality'] = evaluation_and_improvement_prototype['Improved_Functionality']\n", " prototype_design['User_Interactions'] = evaluation_and_improvement_prototype['Improved_User_Interactions']\n", " prototype_design['Testing_Plan'] = evaluation_and_improvement_prototype['Improved_Testing_Plan']\n", "\n", " display(Markdown(\"#### Updated Prototype Design\"))\n", " display(Markdown(f\"**Design Description:** {prototype_design['Design_Description']}\"))\n", " display(Markdown(f\"**Features:** {prototype_design['Features']}\"))\n", " display(Markdown(f\"**Materials:** {prototype_design['Materials']}\"))\n", " display(Markdown(f\"**Functionality:** {prototype_design['Functionality']}\"))\n", " display(Markdown(f\"**User Interactions:** {prototype_design['User_Interactions']}\"))\n", " display(Markdown(f\"**Testing Plan:** {prototype_design['Testing_Plan']}\"))\n", "\n", "\n", " # Build a new DataFrame to store data for the successful idea fleshing out\n", " successful_idea_dataframe = pd.DataFrame({\n", " 'Name': [successful_idea['Name']],\n", " 'Description': [successful_idea['Description']],\n", " 'Potential_Usage': [successful_idea['Potential_Usage']],\n", " 'Unique_Features': [successful_idea['Unique_Features']],\n", " 'Materials_Required': [successful_idea['Materials_Required']],\n", " 'Marketing_Tagline': [marketing_content['Tagline']],\n", " 'Marketing_Description': [marketing_content['Description']],\n", " 'Prototype_Design_Description': [prototype_design['Design_Description']],\n", " 'Prototype_Features': [prototype_design['Features']],\n", " 'Prototype_Materials': [prototype_design['Materials']],\n", " 'Prototype_Functionality': [prototype_design['Functionality']],\n", " 'Prototype_User_Interactions': [prototype_design['User_Interactions']],\n", " 'Prototype_Testing_Plan': [prototype_design['Testing_Plan']]\n", " })\n", "\n", " return successful_idea_dataframe\n", "\n", "openai.api_key = \"OpenAI API Key\"\n", "api_key_image = \"ClipDrop API Key from Stability.ai\"\n", "\n", "# Set the custom success thresholds\n", "custom_success_thresholds = {\n", " 'feasibility': 5, #Score needs to be MORE than this number to pass\n", " 'innovation': 5, #Score needs to be MORE than this number to pass\n", " 'complexity': 9, #Score needs to be LESS than this number to pass\n", " 'cost': 9, #Score needs to be LESS than this number to pass\n", " 'market_potential': 5 #Score needs to be MORE than this number to pass\n", "}\n", "\n", "# Call the function with desired parameters and custom thresholds\n", "successful_idea = find_unique_invention(\n", " model_name=\"gpt-4\",\n", " api_key=openai.api_key,\n", " invention_category=\"A product that solves the problem of hair getting caught in the shower drain.\",\n", " max_retries=3,\n", " success_thresholds=custom_success_thresholds,\n", " temperature=0.9\n", ")\n", "\n", "\n", "# Call the function to proceed with the successful idea and create a new DataFrame\n", "successful_idea_df = proceed_with_successful_idea(\n", " successful_idea, # Pass the successful idea dataframe here\n", " model_name=\"gpt-3.5-turbo-16k\",\n", " api_key= openai.api_key\n", ")\n", "\n", "# Print or analyze the new DataFrame for the successful idea\n", "display(Markdown(\"## DataFrame for Successful Idea Fleshing Out\"))\n", "display(successful_idea_df)\n", "successful_idea_df.to_csv(\"Finalized_Invention.csv\")\n", "\n", "# Assuming successful_idea_df is a DataFrame containing the final iteration of the invention\n", "final_invention_details = successful_idea_df.iloc[0]\n", "image_prompt = generate_invention_image_prompt(final_invention_details)\n", "\n", "filename = final_invention_details['Name']\n", "\n", "image = generate_image_from_text(image_prompt, api_key_image, filename)\n", "\n", "\n", "\n" ], "metadata": { "id": "qaPM80p9fNro", "colab": { "base_uri": "https://localhost:8080/", "height": 1000 }, "outputId": "df1b9de0-6c9a-4b37-ddbe-1b5e27a10819" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "0\n" ] }, { "output_type": "display_data", "data": { "text/plain": [ "" ], "text/markdown": "---" }, "metadata": {} }, { "output_type": "display_data", "data": { "text/plain": [ "" ], "text/markdown": "## Evaluating invention - Hair Hydro-Phobic Coating Spray" }, "metadata": {} }, { "output_type": "display_data", "data": { "text/plain": [ "" ], "text/markdown": "### Invention Description - A hydro-phobic coating spray that, when applied to the hair, makes them resistant to clinging onto wet surfaces. The sprayed hair would still fall off, but instead of getting stuck, they would float on the water making it easier to collect and dispose." }, "metadata": {} }, { "output_type": "display_data", "data": { "text/plain": [ "" ], "text/markdown": "### Scores - Feasibility: 7, Innovation: 8, Complexity: 6, Cost: 6, Market Potential: 8" }, "metadata": {} }, { "output_type": "display_data", "data": { "text/plain": [ "" ], "text/markdown": "**Decision: Moving on with invention Hair Hydro-Phobic Coating Spray.**\nReason: Satisfactory criteria met for this invention" }, "metadata": {} }, { "output_type": "display_data", "data": { "text/plain": [ "" ], "text/markdown": "---" }, "metadata": {} }, { "output_type": "display_data", "data": { "text/plain": [ "" ], "text/markdown": "## Evaluating invention - D-Trap Hair Strainer" }, "metadata": {} }, { "output_type": "display_data", "data": { "text/plain": [ "" ], "text/markdown": "### Invention Description - A detachable and easy-to-clean hair strainer that fits universally to any shower drain. Installed just beneath the cover, it has a unique twisting mechanism to trap hair and make disposal a breeze." }, "metadata": {} }, { "output_type": "display_data", "data": { "text/plain": [ "" ], "text/markdown": "### Scores - Feasibility: 8, Innovation: 5, Complexity: 2, Cost: 2, Market Potential: 7" }, "metadata": {} }, { "output_type": "display_data", "data": { "text/plain": [ "" ], "text/markdown": "**Failure Reasons Summary:** The failure of the D-Trap Hair Strainer can be attributed to five key reasons: \n\n1. Poor design or material choice may cause the strainer to perform ineffectively or break down easily. \n2. The product might lack innovation, leading to difficulties in capturing significant market share.\n3. Inadequate marketing or differentiation can lead to poor visibility and appeal among consumers.\n4. The product may not be price-competitive, making it a less desirable choice for customers.\n5. User acceptance might be low if the product is viewed as hard to use, clean or ineffective." }, "metadata": {} }, { "output_type": "display_data", "data": { "text/plain": [ "" ], "text/markdown": "---" }, "metadata": {} }, { "output_type": "display_data", "data": { "text/plain": [ "" ], "text/markdown": "---" }, "metadata": {} }, { "output_type": "display_data", "data": { "text/plain": [ "" ], "text/markdown": "## Evaluating invention - Sonic Cleanse Drain System" }, "metadata": {} }, { "output_type": "display_data", "data": { "text/plain": [ "" ], "text/markdown": "### Invention Description - A sonic-based cleaning system installed in the shower drain that uses sonic waves to loosen and dislodge hairs, allowing water to push them down easily and preventing clogs." }, "metadata": {} }, { "output_type": "display_data", "data": { "text/plain": [ "" ], "text/markdown": "### Scores - Feasibility: 7, Innovation: 8, Complexity: 7, Cost: 6, Market Potential: 8" }, "metadata": {} }, { "output_type": "display_data", "data": { "text/plain": [ "" ], "text/markdown": "**Decision: Moving on with invention Sonic Cleanse Drain System.**\nReason: Satisfactory criteria met for this invention" }, "metadata": {} }, { "output_type": "display_data", "data": { "text/plain": [ "" ], "text/markdown": "---" }, "metadata": {} }, { "output_type": "display_data", "data": { "text/plain": [ "" ], "text/markdown": "## Evaluating invention - Bio-Dissolve Hair Cream" }, "metadata": {} }, { "output_type": "display_data", "data": { "text/plain": [ "" ], "text/markdown": "### Invention Description - A special cream that can be applied on the body prior to showering. This cream has the ability to dissolve hairs that fall off during the shower, preventing them from reaching the drain in the first place." }, "metadata": {} }, { "output_type": "error", "ename": "KeyboardInterrupt", "evalue": "ignored", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)", "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 549\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 550\u001b[0m \u001b[0;31m# Call the function with desired parameters and custom thresholds\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 551\u001b[0;31m successful_idea = find_unique_invention(\n\u001b[0m\u001b[1;32m 552\u001b[0m \u001b[0mmodel_name\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m\"gpt-4\"\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 553\u001b[0m \u001b[0mapi_key\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mopenai\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mapi_key\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m\u001b[0m in \u001b[0;36mfind_unique_invention\u001b[0;34m(model_name, api_key, invention_category, max_retries, success_thresholds, temperature, max_tokens)\u001b[0m\n\u001b[1;32m 293\u001b[0m \u001b[0;32mwhile\u001b[0m \u001b[0mretry_count_for_evaluation\u001b[0m \u001b[0;34m<\u001b[0m \u001b[0mmax_retries\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 294\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 295\u001b[0;31m \u001b[0mevaluation\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mevaluate_invention\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mai\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mname\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmax_retries\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 296\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mevaluation\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 297\u001b[0m \u001b[0mdisplay\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mMarkdown\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"---\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;31m# Add a horizontal rule\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m\u001b[0m in \u001b[0;36mevaluate_invention\u001b[0;34m(ai, invention_name, max_retries)\u001b[0m\n\u001b[1;32m 204\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 205\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mevaluate_invention\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mai\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minvention_name\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmax_retries\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 206\u001b[0;31m \u001b[0mevaluation\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mai\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34mf\"Evaluate the following invention: {invention_name}\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moutput_schema\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mEvaluate\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 207\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mevaluation\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 208\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m/usr/local/lib/python3.10/dist-packages/simpleaichat/simpleaichat.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, prompt, id, system, save_messages, params, tools, input_schema, output_schema)\u001b[0m\n\u001b[1;32m 138\u001b[0m )\n\u001b[1;32m 139\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 140\u001b[0;31m return sess.gen(\n\u001b[0m\u001b[1;32m 141\u001b[0m \u001b[0mprompt\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 142\u001b[0m \u001b[0mclient\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mclient\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m/usr/local/lib/python3.10/dist-packages/simpleaichat/chatgpt.py\u001b[0m in \u001b[0;36mgen\u001b[0;34m(self, prompt, client, system, save_messages, params, input_schema, output_schema)\u001b[0m\n\u001b[1;32m 101\u001b[0m )\n\u001b[1;32m 102\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 103\u001b[0;31m r = client.post(\n\u001b[0m\u001b[1;32m 104\u001b[0m \u001b[0mstr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mapi_url\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 105\u001b[0m \u001b[0mjson\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mdata\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m/usr/local/lib/python3.10/dist-packages/httpx/_client.py\u001b[0m in \u001b[0;36mpost\u001b[0;34m(self, url, content, data, files, json, params, headers, cookies, auth, follow_redirects, timeout, extensions)\u001b[0m\n\u001b[1;32m 1130\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mParameters\u001b[0m\u001b[0;34m**\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mSee\u001b[0m\u001b[0;31m \u001b[0m\u001b[0;31m`\u001b[0m\u001b[0mhttpx\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrequest\u001b[0m\u001b[0;31m`\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1131\u001b[0m \"\"\"\n\u001b[0;32m-> 1132\u001b[0;31m return self.request(\n\u001b[0m\u001b[1;32m 1133\u001b[0m \u001b[0;34m\"POST\"\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1134\u001b[0m \u001b[0murl\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m/usr/local/lib/python3.10/dist-packages/httpx/_client.py\u001b[0m in \u001b[0;36mrequest\u001b[0;34m(self, method, url, content, data, files, json, params, headers, cookies, auth, follow_redirects, timeout, extensions)\u001b[0m\n\u001b[1;32m 812\u001b[0m \u001b[0mextensions\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mextensions\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 813\u001b[0m )\n\u001b[0;32m--> 814\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mrequest\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mauth\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mauth\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfollow_redirects\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mfollow_redirects\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 815\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 816\u001b[0m \u001b[0;34m@\u001b[0m\u001b[0mcontextmanager\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m/usr/local/lib/python3.10/dist-packages/httpx/_client.py\u001b[0m in \u001b[0;36msend\u001b[0;34m(self, request, stream, auth, follow_redirects)\u001b[0m\n\u001b[1;32m 899\u001b[0m \u001b[0mauth\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_build_request_auth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mrequest\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mauth\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 900\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 901\u001b[0;31m response = self._send_handling_auth(\n\u001b[0m\u001b[1;32m 902\u001b[0m \u001b[0mrequest\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 903\u001b[0m \u001b[0mauth\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mauth\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m/usr/local/lib/python3.10/dist-packages/httpx/_client.py\u001b[0m in \u001b[0;36m_send_handling_auth\u001b[0;34m(self, request, auth, follow_redirects, history)\u001b[0m\n\u001b[1;32m 927\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 928\u001b[0m \u001b[0;32mwhile\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 929\u001b[0;31m response = self._send_handling_redirects(\n\u001b[0m\u001b[1;32m 930\u001b[0m \u001b[0mrequest\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 931\u001b[0m \u001b[0mfollow_redirects\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mfollow_redirects\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m/usr/local/lib/python3.10/dist-packages/httpx/_client.py\u001b[0m in \u001b[0;36m_send_handling_redirects\u001b[0;34m(self, request, follow_redirects, history)\u001b[0m\n\u001b[1;32m 964\u001b[0m \u001b[0mhook\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mrequest\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 965\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 966\u001b[0;31m \u001b[0mresponse\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_send_single_request\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mrequest\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 967\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 968\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mhook\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_event_hooks\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"response\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m/usr/local/lib/python3.10/dist-packages/httpx/_client.py\u001b[0m in \u001b[0;36m_send_single_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 1000\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1001\u001b[0m \u001b[0;32mwith\u001b[0m \u001b[0mrequest_context\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mrequest\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mrequest\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1002\u001b[0;31m \u001b[0mresponse\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtransport\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mhandle_request\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mrequest\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1003\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1004\u001b[0m \u001b[0;32massert\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mresponse\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstream\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mSyncByteStream\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m/usr/local/lib/python3.10/dist-packages/httpx/_transports/default.py\u001b[0m in \u001b[0;36mhandle_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 216\u001b[0m )\n\u001b[1;32m 217\u001b[0m \u001b[0;32mwith\u001b[0m \u001b[0mmap_httpcore_exceptions\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 218\u001b[0;31m \u001b[0mresp\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_pool\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mhandle_request\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mreq\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 219\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 220\u001b[0m \u001b[0;32massert\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mresp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstream\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtyping\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mIterable\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m/usr/local/lib/python3.10/dist-packages/httpcore/_sync/connection_pool.py\u001b[0m in \u001b[0;36mhandle_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 260\u001b[0m \u001b[0;32mwith\u001b[0m \u001b[0mShieldCancellation\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 261\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mresponse_closed\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstatus\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 262\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mexc\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 263\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 264\u001b[0m \u001b[0;32mbreak\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m/usr/local/lib/python3.10/dist-packages/httpcore/_sync/connection_pool.py\u001b[0m in \u001b[0;36mhandle_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 243\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 244\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 245\u001b[0;31m \u001b[0mresponse\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mconnection\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mhandle_request\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mrequest\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 246\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mConnectionNotAvailable\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 247\u001b[0m \u001b[0;31m# The ConnectionNotAvailable exception is a special case, that\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m/usr/local/lib/python3.10/dist-packages/httpcore/_sync/connection.py\u001b[0m in \u001b[0;36mhandle_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 94\u001b[0m \u001b[0;32mraise\u001b[0m \u001b[0mConnectionNotAvailable\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 95\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 96\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_connection\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mhandle_request\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mrequest\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 97\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 98\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_connect\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mrequest\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mRequest\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m->\u001b[0m \u001b[0mNetworkStream\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m/usr/local/lib/python3.10/dist-packages/httpcore/_sync/http11.py\u001b[0m in \u001b[0;36mhandle_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 119\u001b[0m \u001b[0;32mwith\u001b[0m \u001b[0mTrace\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"response_closed\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlogger\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mrequest\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mtrace\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 120\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_response_closed\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 121\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mexc\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 122\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 123\u001b[0m \u001b[0;31m# Sending the request...\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m/usr/local/lib/python3.10/dist-packages/httpcore/_sync/http11.py\u001b[0m in \u001b[0;36mhandle_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 97\u001b[0m \u001b[0mreason_phrase\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 98\u001b[0m \u001b[0mheaders\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 99\u001b[0;31m ) = self._receive_response_headers(**kwargs)\n\u001b[0m\u001b[1;32m 100\u001b[0m trace.return_value = (\n\u001b[1;32m 101\u001b[0m \u001b[0mhttp_version\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m/usr/local/lib/python3.10/dist-packages/httpcore/_sync/http11.py\u001b[0m in \u001b[0;36m_receive_response_headers\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 162\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 163\u001b[0m \u001b[0;32mwhile\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 164\u001b[0;31m \u001b[0mevent\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_receive_event\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtimeout\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mtimeout\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 165\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mevent\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mh11\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mResponse\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 166\u001b[0m \u001b[0;32mbreak\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m/usr/local/lib/python3.10/dist-packages/httpcore/_sync/http11.py\u001b[0m in \u001b[0;36m_receive_event\u001b[0;34m(self, timeout)\u001b[0m\n\u001b[1;32m 198\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 199\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mevent\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0mh11\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mNEED_DATA\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 200\u001b[0;31m data = self._network_stream.read(\n\u001b[0m\u001b[1;32m 201\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mREAD_NUM_BYTES\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtimeout\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mtimeout\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 202\u001b[0m )\n", "\u001b[0;32m/usr/local/lib/python3.10/dist-packages/httpcore/_backends/sync.py\u001b[0m in \u001b[0;36mread\u001b[0;34m(self, max_bytes, timeout)\u001b[0m\n\u001b[1;32m 26\u001b[0m \u001b[0;32mwith\u001b[0m \u001b[0mmap_exceptions\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mexc_map\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 27\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_sock\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msettimeout\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtimeout\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 28\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_sock\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrecv\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmax_bytes\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 29\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 30\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mwrite\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbuffer\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mbytes\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtimeout\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mtyping\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mOptional\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mfloat\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m->\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m/usr/lib/python3.10/ssl.py\u001b[0m in \u001b[0;36mrecv\u001b[0;34m(self, buflen, flags)\u001b[0m\n\u001b[1;32m 1257\u001b[0m \u001b[0;34m\"non-zero flags not allowed in calls to recv() on %s\"\u001b[0m \u001b[0;34m%\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1258\u001b[0m self.__class__)\n\u001b[0;32m-> 1259\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mread\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbuflen\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1260\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1261\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0msuper\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrecv\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbuflen\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mflags\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m/usr/lib/python3.10/ssl.py\u001b[0m in \u001b[0;36mread\u001b[0;34m(self, len, buffer)\u001b[0m\n\u001b[1;32m 1130\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_sslobj\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mread\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlen\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbuffer\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1131\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1132\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_sslobj\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mread\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlen\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1133\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mSSLError\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1134\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0mSSL_ERROR_EOF\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msuppress_ragged_eofs\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;31mKeyboardInterrupt\u001b[0m: " ] } ] }, { "cell_type": "markdown", "source": [ "\n", "# Individually Check Variable Values (for troubleshooting - not part of main script)\n", "\n", "\n" ], "metadata": { "id": "lzfB9ymuL7jy" } }, { "cell_type": "code", "source": [ "image_prompt" ], "metadata": { "id": "g7Ebt8dcRIBw" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "final_invention_details" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "TBUizP5KSdie", "outputId": "1a0ced1b-ddb5-45a0-aef9-37947101c788" }, "execution_count": null, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "Name Sensory Stimulation Puzzle Box\n", "Description A puzzle box designed with several tactile, vi...\n", "Potential_Usage Enhances cognitive abilities, fine motor skill...\n", "Unique_Features Comes with an adjustable difficulty level and ...\n", "Materials_Required Plastic, electronic components, fabric with di...\n", "Marketing_Tagline Ignite, Engage, Transform: Discover Your Mind'...\n", "Marketing_Description The Sensory Stimulation Puzzle Box isn't just ...\n", "Prototype_Design_Description The Sensory Stimulation Puzzle Box is a multis...\n", "Prototype_Features 1. Multisensory Exploration: The box serves as...\n", "Prototype_Materials 1. Durable, Non-Toxic Plastic: The box's main ...\n", "Prototype_Functionality The Sensory Stimulation Puzzle Box is a compre...\n", "Prototype_User_Interactions The Sensory Stimulation Puzzle Box provides a ...\n", "Prototype_Testing_Plan The testing plan for the Sensory Stimulation P...\n", "Name: 0, dtype: object" ] }, "metadata": {}, "execution_count": 54 } ] }, { "cell_type": "code", "source": [ "successful_idea" ], "metadata": { "id": "eeNWmFFFsSHB" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "successful_idea_df" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 214 }, "id": "_UpzruHRtGuC", "outputId": "e8dea206-e942-48b6-c51c-6aa7465cf2f0" }, "execution_count": null, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ " Name Description \\\n", "0 Sensory Adventure Mat A large interactive mat that combines sensory ... \n", "\n", " Potential_Usage \\\n", "0 The sensory adventure mat can be used at home,... \n", "\n", " Unique_Features \\\n", "0 The mat is designed to be large enough for tee... \n", "\n", " Materials_Required \\\n", "0 Soft fabric, LED lights, speakers, vibrating p... \n", "\n", " Marketing_Tagline \\\n", "0 Sensory Adventure Mat: Unleash the Power of Pe... \n", "\n", " Marketing_Description \\\n", "0 The Sensory Adventure Mat takes the ordinary a... \n", "\n", " Prototype_Design_Description \\\n", "0 The Sensory Adventure Mat is a meticulously de... \n", "\n", " Prototype_Features \\\n", "0 1. Personalized Sensory Experience: The mat of... \n", "\n", " Prototype_Materials \\\n", "0 1. Premium Quality Fabric: The mat is crafted ... \n", "\n", " Prototype_Functionality \\\n", "0 The Sensory Adventure Mat is more than a tool;... \n", "\n", " Prototype_User_Interactions \\\n", "0 Users interact with the Sensory Adventure Mat ... \n", "\n", " Prototype_Testing_Plan \n", "0 The Sensory Adventure Mat will undergo compreh... " ], "text/html": [ "\n", "\n", "
\n", "
\n", "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
NameDescriptionPotential_UsageUnique_FeaturesMaterials_RequiredMarketing_TaglineMarketing_DescriptionPrototype_Design_DescriptionPrototype_FeaturesPrototype_MaterialsPrototype_FunctionalityPrototype_User_InteractionsPrototype_Testing_Plan
0Sensory Adventure MatA large interactive mat that combines sensory ...The sensory adventure mat can be used at home,...The mat is designed to be large enough for tee...Soft fabric, LED lights, speakers, vibrating p...Sensory Adventure Mat: Unleash the Power of Pe...The Sensory Adventure Mat takes the ordinary a...The Sensory Adventure Mat is a meticulously de...1. Personalized Sensory Experience: The mat of...1. Premium Quality Fabric: The mat is crafted ...The Sensory Adventure Mat is more than a tool;...Users interact with the Sensory Adventure Mat ...The Sensory Adventure Mat will undergo compreh...
\n", "
\n", " \n", "\n", "\n", "\n", "
\n", " \n", "
\n", "\n", "\n", "\n", " \n", "\n", " \n", " \n", "\n", " \n", "
\n", "
\n" ] }, "metadata": {}, "execution_count": 23 } ] }, { "cell_type": "code", "source": [ "failed_inventions_prompt" ], "metadata": { "id": "heGPqIf0Fggg" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "failed_inventions_df" ], "metadata": { "id": "P1Pb59vIqJr_" }, "execution_count": null, "outputs": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.9.12" }, "orig_nbformat": 4, "colab": { "provenance": [], "include_colab_link": true } }, "nbformat": 4, "nbformat_minor": 0 }