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.2.0.tar.gz (145.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.2.0-py3-none-any.whl (38.6 kB view details)

Uploaded Python 3

File details

Details for the file thinking_hats_ai-1.2.0.tar.gz.

File metadata

  • Download URL: thinking_hats_ai-1.2.0.tar.gz
  • Upload date:
  • Size: 145.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.2.0.tar.gz
Algorithm Hash digest
SHA256 9f02d063727945e57f35e724cb143b747eaea4627611b2c8c7cd29fe50a463c4
MD5 b86cb20d5303933bbd56f7ce6aa4eaec
BLAKE2b-256 43886e912f0e43ca57f0ed3bb0ff3d94d1652cf7aa20681d1f53f5be31322354

See more details on using hashes here.

File details

Details for the file thinking_hats_ai-1.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for thinking_hats_ai-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 98aecdfac1886d36842c5618023ed5b790d3301b0e31b55305e50bb8fb458314
MD5 5a79562ecc74a4a967b5600307b2bddb
BLAKE2b-256 315a121b24429d26ac81bde9074ce4ff354440e1573cec4ac264ee50b5432d8f

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