|
from langchain.schema.output_parser import StrOutputParser |
|
from chains.utils import getToolPromptTemplate |
|
from model import llm4 |
|
from langchain.tools import tool |
|
|
|
step2ToolName = "Problem Deconstruction" |
|
step2ToolContext = """\ |
|
For addressing scalable problems, utilizing the [Problem Deconstruction Canvas] can help in delving into various \ |
|
aspects of the issue such as the superficial problem, underlying causes, affected groups, and the resulting impact. \ |
|
Here are some tips: |
|
1. Distinguishing Superficial Problems from Underlying Causes: |
|
- Help participants differentiate between the superficial phenomena and the underlying causes of the problem. \ |
|
Superficial problems are observable direct manifestations leading to some impact, for example, pedestrian pathways being occupied by vehicles, \ |
|
higher resume rejection rates for disabled individuals during job applications, \ |
|
or visually impaired users finding it difficult to use a particular brand's app for online orders. |
|
- Underlying causes focus on the root causes behind superficial problems. \ |
|
Identifying these often requires proposing hypotheses and logical multi-level deduction and research. \ |
|
For instance, the occupation of pedestrian pathways might be linked to lack of public education on traffic regulations, \ |
|
insufficient regulatory enforcement, or poor road design in specific areas. |
|
2. Refining Broad Problems: |
|
- If the problem posed is relatively broad, such as when its solution spans multiple industries or fields \ |
|
and the team lacks the necessary expertise and resources to address it, consider further segmenting the problem. \ |
|
For example, the issue of gender discrimination could be narrowed down to a specific domain like the workplace, \ |
|
transforming it into "gender discrimination in the workplace." |
|
3. Monitoring Changes: |
|
- Pay attention to changes over time in the underlying causes. Have they evolved? Will they continue to change in the future? |
|
|
|
These guiding suggestions aim to facilitate a more structured and insightful exploration of the problem, \ |
|
enabling teams to delve deeper into understanding the issues at hand and how they might be addressed in a scalable and impactful manner.\ |
|
""" |
|
step2ToolSuggestion = """\ |
|
1. This step unfolds around the [Problem Deconstruction Canvas], with each participant selecting a problem from the first step to refine and structure. |
|
2. It's suggested to spend 5 minutes before starting to clarify with everyone the definition of each dimension on the canvas. |
|
3. Each participant should choose a specific color of sticky note, and use the four \ |
|
dimensions divided on the canvas to provide a structured description of the selected problem within 10 minutes.\ |
|
""" |
|
prompt = getToolPromptTemplate(step2ToolName, step2ToolContext, step2ToolSuggestion) |
|
|
|
step2Chain = prompt | llm4 | StrOutputParser() |
|
|
|
|
|
@tool("Problem Deconstruction") |
|
def step2Tool(context: str) -> str: |
|
"""Useful for find some detail advise or examples when you process on "Problem Deconstruction" step. Need to input current problem context about Problem Deconstruction.""" |
|
|
|
return step2Chain.invoke({"current_situation": context}) |
|
|