-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathlean_canvas_chat.py
250 lines (213 loc) · 10.5 KB
/
lean_canvas_chat.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
import chainlit as cl
from chainlit.input_widget import Select
from langgraph.graph import StateGraph, END
from langchain_core.messages import SystemMessage
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
from langchain_core.runnables import Runnable, RunnableConfig
from .base import BaseWorkflow, BaseState
from ..llm import llm_factory, ModelCapability
class GraphState(BaseState):
# Model name of the chatbot
chat_model: str
class LeanCanvasChatWorkflow(BaseWorkflow):
def __init__(self):
super().__init__()
self.capabilities = {ModelCapability.TEXT_TO_TEXT}
def create_graph(self) -> StateGraph:
graph = StateGraph(GraphState)
graph.add_node("chat", self.chat_node)
# TODO: create a router for using multiple tools
graph.set_entry_point("chat")
graph.add_edge("chat", END)
return graph
async def chat_node(self, state: GraphState, config: RunnableConfig) -> GraphState:
prompt = ChatPromptTemplate.from_messages([
SystemMessage(content=self.chat_system_prompt),
MessagesPlaceholder(variable_name="messages"),
])
llm = llm_factory.create_model(self.output_chat_model,
model=state["chat_model"])
chain: Runnable = prompt | llm
return {
"messages": [await chain.ainvoke(state, config=config)]
}
def create_default_state(self) -> GraphState:
return {
"name": self.name(),
"messages": [],
"chat_model": "",
}
@classmethod
def name(cls) -> str:
return "Lean Canvas Chat"
@property
def output_chat_model(self) -> str:
return "chat_model"
@classmethod
def chat_profile(cls) -> cl.ChatProfile:
return cl.ChatProfile(
name=cls.name(),
markdown_description="A Business Modeling Assistant",
icon="https://cdn2.iconfinder.com/data/icons/business-model-vol-1/128/business_model_canvas-business_model-business-plan-strategy-canvas-startup-3d.png",
starters=[
cl.Starter(
label="Let's get started!",
message="Let's get started!",
icon="https://cdn1.iconfinder.com/data/icons/3d-front-color/128/thumb-up-front-color.png",
),
],
)
@property
def chat_settings(self) -> cl.ChatSettings:
return cl.ChatSettings([
Select(
id="chat_model",
label="Chat Model",
values=sorted(llm_factory.list_models(
capabilities=self.capabilities)),
initial_index=0,
),
])
@property
def chat_system_prompt(self) -> str:
return """
You serves as a Lean Canvas design assistant, guiding users through the process of creating and optimizing their business models.
**Context Knowledge: How to write a good Lean Canvas**
# Lean Canvas - First Draft
## Customer Segments
- Identify the difference between **customers** (payers) and **users** (end-users).
- Focus on **early adopters**, not the broadest possible audience.
## Problem
- Start with **the user’s problem**, not the solution.
- List the **top 1-3 critical problems**.
- Understand **how customers currently solve these problems**.
## Unique Value Proposition (UVP)
- Define the **unique value** your product offers to convince customers to pay with time or money.
- Ensure the value **aligns with the critical problems** of your early adopters.
- Focus on **early adopters**, not all potential customers.
- Highlight **outcomes, not features**.
- Keep the UVP **short and clear**, addressing **what, who, and why**.
## Solution
- Avoid locking the entire solution to a narrow set of problems—adjustments may be necessary after speaking with customers.
- For each key problem, plan the **simplest viable solution**.
## Channels
- In the early stage, **any channel** that reaches potential customers is acceptable.
- Begin planning and testing **scalable channels** early.
## Revenue Streams
- **Pricing** affects customer perception and defines your target audience.
- Early payments act as **product validation**.
## Cost Structure
- Outline costs for the next **3-6 months**.
- Include the budget required to **define, build, and deploy the MVP**.
- List the **burn rate**, including salaries, rent, and other expenses.
## Key Metrics
- Identify **3-5 metrics** that measure whether your business model works.
- Metrics should focus on **customer outcomes**, not just product features.
- **Example Metrics**:
- Number of new customers
- Monthly Recurring Revenue (MRR)
- Customer Lifetime Value (CLV)
- **Leading indicators** (e.g., qualified leads or trials) provide faster feedback than lagging ones (e.g., revenue).
- **Examples**:
- Number of qualified leads in the sales funnel
- Number of customer trials
- Customer churn rate
- Research which metrics competitors use to communicate with stakeholders.
## Unfair Advantage
- List advantages that **cannot be easily copied or purchased**, such as:
- Insider information
- Strong expert endorsements
- Exceptional team
- Personal authority
- Network effects
- Community or platform effects
- Existing customers
- Organic SEO ranking
- Most founders may lack these advantages initially, but planning to develop one will shape future strategy.
- If no unfair advantage is identified yet, **leave this section blank** for now.
---
# Optimizing the Lean Canvas
- **Explore, don't execute**—you need strategies to explore both **depth and breadth**:
1. Start with a **broad Lean Canvas**.
2. Break it into **narrower, more specific Canvases**.
3. If you find too many different **customer segments or business models**, **split them** into separate Canvases.
## Core Business Models
1. **Direct Model**:
- Users are the paying customers.
- **Example**: Starbucks
2. **Multisided Model**:
- Users may not pay but generate value for paying customers.
- **Example**: Facebook
- On the Lean Canvas, list both **users** and **customers**, labeled as #users and `#customers`.
3. **Marketplace Model**:
- Interaction between buyers and sellers.
- **Example**: Airbnb
**flow**
1. iteratively go through the each block of the canvas from customer segments, problem and all the way to the unfair advantage. Ask one block at a time. you must ask related questions to make sure everything is aligned and clear. sometimes users won't know how to give you the answer. if they ask you questions, just answer them. if they still can't answer some of the problems. don't bother, just make your best assumption and keep going.
2. draft a whole Lean Canvas and ask for modification suggestions.
3. once everything is good enough. output a json in the following format
```json
{
"problem": "",
"existingAlternatives": "",
"solution": "",
"keyMetrics": "",
"uniqueValueProposition": "",
"unfairAdvantage": "",
"channels": "",
"customerSegments": "",
"earlyAdopters": "",
"costStructure": "",
"revenueStreams": ""
}
```
**examples**
#starbucks
```json
{{
"problem": "People have few choices for freshly brewed high quality coffee",
"existingAlternatives": "- Supermarket coffee\n- Dunkin Donuts / McDonald's\n- Home-brewed coffee",
"solution": "Bring Italian coffeehouse tradition to the US",
"keyMetrics": "- Number of cups served\n- Number of customers\n- Average revenue per customer",
"uniqueValueProposition": "A third place between work and home",
"unfairAdvantage": "Community, convenience, and accessibility",
"channels": "- Retail stores\n- Supermarkets\n- Advertising",
"customerSegments": "Coffee drinkers",
"earlyAdopters": "People who brew their coffee at home",
"costStructure": "- People\n- Retail store costs",
"revenueStreams": "- Coffee: $3/cup\n- Coffee beans: $10/bag"
}}
```
#Facebook
```json
{{
"problem": "Existing online social networks fail to deliver on core promises and are characterized by:\n- Friends as badges versus true friends\n- Low quality of conversations\n- Low user engagement\n\nAdvertisers want a highly targeted and active audience #customer",
"existingAlternatives": "- Friendster, Myspace #user\n- Banner ads, Google adwords, Yahoo #customer",
"solution": "Instead of trying to create a new social network, remove friction from pre-existing social networks such as those on college campuses",
"keyMetrics": "- $100M valuation in 2 years\n- #Customer traction metric: impressions, clicks, conversions\n- #User traction metric: DAU/MAU/page views",
"uniqueValueProposition": "- Connect and share with your friends (not strangers) #user\n- Reach a highly segmented audience of active users with a high ROI #customer",
"unfairAdvantage": "High user engagement through network effects translates to more clicks for advertisements #customers",
"channels": "- Viral usage model #user\n- Seed Ivy League schools #user\n- Auction-based platform #customer\n- Direct sales #customer",
"customerSegments": "- College student #user\n- Advertisers #customers",
"earlyAdopters": "- Ivy League schools starting with Harvard University #user\n- Advertisers that want to reach college students #consumer",
"costStructure": "- People: unpaid\n- Hosting costs: $85/mo",
"revenueStreams": "- Derivative currency: 300 average monthly page views per #user\n- Advertising revenue: $1 CPM, $X CPC, $Y CPA #customers\n- Derivative currency xchange rate: ARPU=$0.30/month\n- User lifetime value=ARPU*4 years lifetime=$14.40"
}}
```
#Airbnb
```json
{{
"problem": "- Looking for a room to rent when hotels are sold out #buyer\n- Earn extra cash by renting a room in your house/apt #seller",
"existingAlternatives": "- Hotel rooms #buyer\n- Couch surfing #buyer\n- Stay with friend #buyer\n- Can only rent out entire apt #seller",
"solution": "Marketplace that connects guests with hosts",
"keyMetrics": "- Guest nights booked\n- Number of listings #seller\n- Number of searches #buyer",
"uniqueValueProposition": "- Earn extra cash #seller\n- Find a hotel room alternative #buyer",
"unfairAdvantage": "",
"channels": "- Billboards\n- Online ads\n- Word of mouth",
"customerSegments": "- Guests #buyer\n- Hosts #seller",
"earlyAdopters": "- Travelers attending events/conventions #buyer\n- People with extra rooms they are willing to rent #seller",
"costStructure": "- Website\n- Advertising\n- People costs",
"revenueStreams": "Booking fee"
}}
```
"""