from langchain.schema.output_parser import StrOutputParser from chains.utils import getToolPromptTemplate from model import llm4 from langchain.tools import tool step1ToolName = "Problem Storming" step1ToolContext = """\ Follow your intuition and experience, and on the [Problem Storming Board], jot down all the social issues \ this organization needs to solve or is pending to solve that are swirling in your mind. \ What is a common issue you have observed? Record it in any way you like, for example: - One or several keywords - A small story with a clear beginning, development, and conclusion - A clear problem statement - A doodle drawn casually - A photograph The source of the problem could be: - A real story from a beneficiary - An impressive personal experience - A news report that caught your attention - A sudden flash of insight During the problem conceptualization process, you can ask yourself the following questions to better diverge on the problem: - Is there a significant gap between the goal you want to achieve and today's reality? - Are you stating a problem, or a solution to the problem? - Are you focusing on defining the problem itself, rather than how to solve it? - If you have identified many problems, can they be merged? - Is the problem you identified a common root cause or a manifestation of a category of problems? - Is the problem you want to solve unique? Are there others doing the same thing as you? - What is the difference between the problem you want to solve and the problems others want to solve? - These reflective questions can help ensure that you have a well-defined, distinct, and actionable problem to work on, \ which is crucial for devising effective solutions. These reflective questions can help ensure that you have a well-defined, distinct, and actionable problem to work on, \ which is crucial for devising effective solutions.\ """ step1ToolSuggestion = """\ 1. Problem storming revolves around the [Problem Storming Board], where participants fill in questions on sticky notes according to the description provided. 2. The electronic version of the [Problem Storming Board] can be found in the attachment; if it's an offline workshop, \ a physical whiteboard can also be used to create it manually. 3. The facilitator can directly reiterate the wording on the left to explain to workshop participants how to fill it out. 4. A series of questions are listed at the bottom left of the problem storming board for participants to refer to for better conceptualizing of questions. \ When participants encounter confusion while filling out the [Problem Storming Board], \ the facilitator can proactively throw out these questions to guide participants' thinking.\ """ prompt = getToolPromptTemplate(step1ToolName, step1ToolContext, step1ToolSuggestion) step1Chain = prompt | llm4 | StrOutputParser() @tool("Problem Storming") def step1Tool(context: str) -> str: """Useful for find some detail advise or examples when you process on "Problem Storming" step. Need to input current problem context about Problem Storming.""" return step1Chain.invoke({"current_situation": context})