Skip to main content

thinking-hats-ai is a Python package that facilitates idea generation by following Edward de Bono's Six Thinking Hats methodology from his Book. It enables you to generate ideas by selecting one of the six hats and lets you choose one of the implemented prompting technique to follow while generating the idea.

Project description

thinking-hats-ai: Python package implementing six thinking hats prompting

Package PyPI Latest Release PyPI - Downloads

What is it?

thinking-hats-ai is a Python package that facilitates idea generation by following Edward de Bono's Six Thinking Hats methodology from his Book. It enables you to generate ideas by selecting one of the six hats and lets you choose one of the implemented prompting technique to follow while generating the idea.

Table of Contents

Use of Package

Example script

This example uses the CHAIN_OF_THOUGHT prompting techniques and the BLACK hat for the personality. It also uses developer mode to log the interaction in a separate file.

### Import package
from thinking_hats_ai import BrainstormingSession, Technique, Hat, BrainstormingInput

### Create session
session = BrainstormingSession('YOUR-OPENAI-API-KEY')
session.dev = True # Activate dev mode

### Define current status
brainstormingInput = BrainstormingInput(
    question = 'How could you make students come to class more often even though there are podcasts provided for each lecture?',
    ideas=[
        "Implement an interactive class participation system with incentives",
        "Extra credits or digital badges, encouraging students to attend and engage actively",
        "Offer exclusive in-class activities or discussions that are not available in the podcasts",
        "Create a social media group for students to share their experiences and insights from attending class",
        "Organize regular contests or challenges related to class content, with prizes for participants",
        "Provide a comfortable and engaging classroom environment with refreshments and seating arrangements",
        "Incorporate gamification elements into the class structure, such as quizzes or team-based activities",
    ],
    response_length='5 bullet points'
)

### Generate output
response = session.generate_idea(
    Technique.CHAIN_OF_THOUGHT,
    Hat.BLACK,
    brainstormingInput
)

### Print output
print(response)

Hats

The different hats act as a predefined persona according to Edward de Bono's book about the six thinking hats in brainstorming. You can select which persona should be used for your instance.

Hat Role
WHITE The White Hat represents neutrality and objectivity, focusing on gathering facts, identifying information gaps, and evaluating existing knowledge to ensure all reasoning is grounded in evidence and logic.
GREEN The Green Hat represents creativity and innovation, focusing on generating new ideas, exploring alternatives, and proposing improvements to existing concepts to encourage original and unconventional thinking.
BLACK The Black Hat represents critical judgment and caution, focusing on identifying potential risks, weaknesses, and negative outcomes of ideas to ensure they are practical and safe.
YELLOW The Yellow Hat represents optimism and positivity, focusing on identifying the benefits, strengths, and potential value of ideas to highlight why they are worth pursuing.
BLUE The Blue Hat represents control, organization, and overview, guiding the thinking process, setting objectives, managing the discussion, and ensuring that the Six Thinking Hats method is followed effectively.
RED The Red Hat represents emotions, intuition, and gut feelings, allowing participants to express their instincts or emotional reactions to ideas without the need for justification or logic.

source: Book

Prompting techniques

The different prompting techniques help to analyse different approaches of idea generation for each hat. While implementing, we analyzed which of the techniques work best for which hat.

Technique Explanation
CHAIN_OF_THOUGHT The Chain of Thought technique guides the model to reason step-by-step, leveraging its advanced reasoning capabilities to improve coherence and depth in idea generation.
CHAIN_OF_VERIFICATION The Chain of Verification technique refines ideas by chaining prompts, generating verification questions, and analyzing responses.
CHAINING The Chaining technique builds a structured process: first understanding the thinking hat, then applying its perspective to the brainstorming context, and finally refining the response to ensure alignment.
CONTRASTIVE_PROMPTING The Contrastive Prompting technique uses examples of good and bad responses to guide the agent towards an optimal output.
EMOTION_PROMPT The EmotionPrompt technique enhances model performance by embedding emotional stimuli in prompts, encouraging more engaged, human-like, and context-aware responses.
FEW_SHOT The Few Shot technique uses example-based prompting by first generating three example responses from the hat's perspective, then applying these patterns to produce a final, guided response.
MULTI_AGENT The Multi-Agent technique involves multiple agents collaborating on a topic before converging on a refined final output.
PERSONA_PATTERN The Persona Pattern technique generates ideas by adopting predefined persona, offering unique perspective and goals.
REACT The ReAct (Reason and Act) technique combines reasoning and action by allowing models to interleave thought processes with tool use, enabling more accurate and interactive problem-solving.
SYSTEM_2_ATTENTION The System 2 Attention technique introduces a two-step prompting process: first filtering and organizing brainstorming input, then using this optimized context to generate higher-quality ideas.
TAKE_A_STEP_BACK The Take-a-Step-Back technique adds a follow-up question prompting the model to reflect on its initial reasoning before giving a final answer.
ZERO_SHOT_COT The Zero-shot Chain-of-Thought technique guides the model to reason step-by-step, breaking down complex problems into intermediate steps for improved accuracy and transparency.

Brainstorming-input

The instance of BrainstormingInput allows you to pass the brainstorming question, ideasand response_length to the generation of an idea.

Variable Name Explanation
question This variable takes a string, the question that was asked in the brainstorming session
ideas This variable takes a list of strings where each string is a idea from the brainstorming session
response_length This variable takes a string which will control the length of the answer. You can say "10 sentences" but also things like "similar to the other ideas". It should fit the sentence: Provide a response with a length of {response_length}.

Developer mode

The developer mode is used to log the in/outputs of the api calls. A log folder and log files will be created when executing a Script with activated developer mode. This was implemented for prompt engineering purposes and help to analyse the history of all API calls made.

It can be activated by setting the dev attribute to True (default False).

instance.dev = True

Installation

This package is available through the Python Package Index (PyPI).

pip install thinking-hats-ai

Dependencies

Background

The implementation of thinking-hats-ai started at UZH as a part of three bachelors theses.

Creators


Go to Top

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

thinking_hats_ai-1.0rc1.tar.gz (142.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

thinking_hats_ai-1.0rc1-py3-none-any.whl (35.7 kB view details)

Uploaded Python 3

File details

Details for the file thinking_hats_ai-1.0rc1.tar.gz.

File metadata

  • Download URL: thinking_hats_ai-1.0rc1.tar.gz
  • Upload date:
  • Size: 142.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for thinking_hats_ai-1.0rc1.tar.gz
Algorithm Hash digest
SHA256 3710b2d8134b91a0f0ecbd7e491c5c74dfdabb230ccd79c2dcd6dff65c706fa1
MD5 1354f5f05e7695c4ee8975c8ed825a3a
BLAKE2b-256 334a4a73c950ae61f4a61fc40580d0303c635b11a75aef9fb71228b960a3b5e8

See more details on using hashes here.

File details

Details for the file thinking_hats_ai-1.0rc1-py3-none-any.whl.

File metadata

File hashes

Hashes for thinking_hats_ai-1.0rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 803ea40a1942e10acc1e91da658d0e082e03b992b1a0af747c8a10703c785cb3
MD5 fd508b367917b54c90d836a0b86c19f5
BLAKE2b-256 41604c3aa4167e6278fb57d50966ddcb8c520d0d6c5058e71465dddc3ee2f52d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page