基于生成式人工智能的敏捷启动和商业分析。

ChatGPT中文站
Image courtesy of Adobe Stock

利用人工智能 (AI) 工具可以大幅加快业务分析过程。通过利用高级 AI 模型,如GPT,分析师可以快速分析问题陈述,定义高水平特征和目标,并生成史诗和用户故事。AI 工具可以简化需求收集过程,节省时间和精力,同时实现结构化和有组织的分析。

作为探索性的练习,我们试图找出如何利用OpenAI的GPT来启动业务分析流程并进行快速需求收集。

您可以阅读有关实验所使用的方法和工具的信息。

每个业务分析过程都始于确定问题陈述,然后列出高层次的业务目标或需求。借助于 Python 中的 OpenAI 聊天完成 API,我们可以参与交互式对话,并快速生成想法和需求,以启动分析过程。

使用“Prompt Engineering”生成史诗和故事。

史诗和故事是将复杂项目分解成可管理单元的关键组成部分。在最初的分析阶段,从高级特性中确定史诗,进一步将其细分为故事。随后,在故事层面编写验收标准,告诉我们何时完成具体细节。

ChatGPT中文站

我们使用GPT来为时间跟踪应用程序确定三个高级业务目标。

问题陈述是作为提示给出的:

Identify the top 3 features of a time tracking app for employees to enter work 
hours against projects so reports can be generated regarding billable hours
and then invoices can be created for the billable hours.

GPT 确定了以下三个高级特征:

1. Time Entry and Tracking: The app should have an easy-to-use interface that
allows employees to enter their work hours quickly and accurately. The app
should also have a timer feature that enables employees to track the time they
spend on each project.

2. Reporting: The app should be able to generate detailed reports on the time
spent on each project and task, including billable and non-billable hours, and
total time spent. These reports should be customisable, allowing for filtering
and sorting based on different criteria.

3. Invoicing: The app should be able to create invoices for the billable hours
worked on each project. The invoices should be customisable and allow for
different billing rates and payment terms.

我们使用这些高级功能生成史诗和故事。

为一致分析定制人工智能

企业分析师在书写史诗或故事时会遵循一定的结构和格式。虽然 GPT 模型知道什么是史诗或用户故事,但我们想提供我们自己的定义和格式,以确保故事生成时保持一致的风格。我们发现有用的一种技巧是建立一个结构,详细说明我们希望史诗、故事和验收标准的书写方式。这可以确保生成的故事与所需的书写风格和格式相一致。

这个结构和格式以JSON格式定义如下:

epic_story_ac_structure = {
"epic": {
"definition": "An epic is a large body of work that can be broken down into a number of smaller user stories.",
"format": {
"structure": "<Epic-Heading> : <Description>",
"example": "Login : Login for new visitors"
},
"example": "The epic for a search functionality in a music app can be written as '''The new search functionality will allow users to narrow down their search and offer suggestions to help them find the music they want to listen to instantly.'''"
},
"story": {
"Definition": "A user story is a small, self-contained unit of development work designed to accomplish a specific goal within a product. It provides an informal, natural language description of a feature of the software or product from the end-user perspective.",
"template": "As a < type of user >, I want < some goal > so that < some reason >.",
"format": {
"structure": "<User-Story-Number> - <User-Story-Heading> : <User-Story>",
"example": "GT-Recruit-101 - Post resume to website\
A user can post her resume to the web site so employers can be informed \
about the work details about the user."
},
"example": "A few real examples of user stories that describe the desired functionality in an early version of the Scrum Alliance website are below: \
1. As a site member, I can fill out an application to become a Certified Scrum Trainer so that I can teach Certified Scrum Master and Certified Scrum Product Owner courses and certify others.\
2. As a trainer, I want my profile to list my upcoming classes and include a link to a detailed page about each so that prospective attendees can find my courses.\
3. As a site visitor, I can access old news that is no longer on the home page, so I can access things I remember from the past or that others mention to me.\
4. As a site visitor, I can see a list of all upcoming “Certification Courses” and can page through them if there are a lot, so I can choose the best course for me."
},
"acceptance-criteria": {
"definition": "A set of statements, each with a clear pass/fail result, that specify both functional and non-functional requirements and are applicable at the feature and story levels. Acceptance criteria constitute our 'Definition of Done'.",
"template": "Given <what all are the given conditions>, when <a particular action taken>, then <the result of that action>.",
"format": {
"structure": "<List of acceptance criterias>",
"example": "Few real examples of acceptance criterias for a user story '''As a user, I want to be able to recover the password to my account so that I can access it in case I forget it. ''' are below:\
1. Given The user is logged out When the user navigates to the login page, they see the "forgot password' option.\
2. Given The user navigates to the login page When the user selects the "forgot password' option and enters a valid email to receive a link for password recovery, the system sends the link to the entered email.\
3. Given The user receives the link via the email When The user navigates through the link received in the email Then The system enables the user to set a new password"
}
}
}

我们定义了一个提示生成史诗,并利用OpenAI的聊天完成端点生成史诗列表。

提示(变量:`epic_prompt`)的内容如下:

  1. 上述预定义结构(变量:epic_story_ac_structure)
  2. 三个高级功能要求(变量:`产品高级功能要求`)
epic_prompt = f"""

Epic = {epic_story_ac_structure["epic"]["definition"]}

Example for an epic : {epic_story_ac_structure["epic"]["example"]}

Your task is to perform the following actions:
1. Analyse each of the features listed to determine the various high-level epics.
2. List each epic.
3. Describe each epic in a few sentences.

Use the following format:
Feature: <Feature Heading>
Feature Summary: <Feature Description>
Epics: List of Epics in the Format: '''epic_story_ac_structure["epic"]["format"]["structure"]'''>. Format example: '''{epic_story_ac_structure["epic"]["format"]["example"]}'''

Text: <{product_high_level_requirement}>
"""
epics_response = get_completion(epic_prompt)

下面是“get_completion”方法;它与OpenAI的聊天完成端点进行通信。

请注意,我们将“温度”设置为0,这是模型输出随机性的度量。这保证了多次运行时结果的一致性。

def get_completion(prompt, model="gpt-3.5-turbo"):
messages = [{"role": "user", "content": prompt}]
response = openai.ChatCompletion.create(
model=model,
messages=messages,
temperature=0,
)
return response.choices[0].message["content"]

响应包含了每个特征的史诗列表。

例如,“时间输入和跟踪”功能,已识别出两个高层次的史诗,并包含了它们的描述。

Epic List:   
Feature: Time Entry and Tracking
Feature Summary: The app should allow employees to enter their work hours quickly and accurately and track the time spent on each project.
Epics:
Time Entry: The app should have an interface that allows employees to enter their work hours quickly and accurately.
Time Tracking: The app should have a timer feature that enables employees to track the time they spend on each project.

Feature: Reporting.
Feature Summary: The app should be able to generate detailed reports on the time spent on each project and task, including billable and non-billable hours and total time spent.
Epics:
Report Generation: The app should be able to generate detailed reports on the time spent on each project and task, including billable and non-billable hours and total time spent.
Customisation: The reports should be customisable, allowing for filtering and sorting based on different criteria.

Feature: Invoicing.
Feature Summary: The app should be able to create invoices for the billable hours worked on each project, with customisable billing rates and payment terms.
Epics:
Invoice Creation: The app should be able to create invoices for the billable hours worked on each project.
Customisation: The invoices should be customisable, allowing for different billing rates and payment terms.

回复包含史诗列表的内容被进一步传递到故事、UI模型和验收标准生成的提示中。将其中某些提示合并成单个提示并不会产生良好的结果;故事的细节被截断,而预期的细节被省略。需要经过一些试错才能得出这些提示。

在高层次上,这两个提示所涉及的步骤是:

  1. 分析每一个史诗,以确定各种用户故事。
  2. 用以下格式列出每个史诗:
  3. 分析每个史诗中的故事,并使用用户故事格式生成用户故事。
  4. 为每个用户故事分配“用户故事编号”和“用户故事标题”。
  5. 为每个用户故事建议详细的UI模型,同时为每个UI元素提供验证逻辑。
  6. 列出每个用户故事的验收标准。

故事起源:

story_prompt = f"""
User-Story = {epic_story_ac_structure["story"]["definition"]}

When writing a user-story, follow the standard format mentioned with text delimited by triple
quotes.
'''{epic_story_ac_structure["story"]["template"]}'''

User-Story-Number = '''{project_abb}-<Project short name for 'Epic-Heading'>-<Story-Number>'''
Example for a user-story : {epic_story_ac_structure["story"]["example"]}

Your task is to perform the following actions:
1. Analyse each epic and break it down further into various user stories.
2. List each epic in the below format:
<Feature>
<Epic-Heading>
3. List out detailed user stories in each of the epics in the below format:
<User-Story-Number> - <5 worded title for the user story> : <User-Story>

Text: <{epics_response}>
"""
story_response = get_completion(story_prompt)

我们编写了一个利用OpenAI生成产品和功能名称缩写的Python方法。然后使用这些缩写为每个故事分配了一个用户故事编号,如TSC-TET-001,提供简明的表示。

提示生成了12个史诗故事。

User Story List:
Feature: Time Entry and Tracking
Epic-Heading: Time Entry
TSC-TET-001: Quick and Accurate Time Entry: As an employee, I want to be able to enter my work hours quickly and accurately so that I can focus on my work.
TSC-TET-002: Project Selection As an employee, I want to be able to select the project I am working on while entering my time so that my time is accurately tracked.


Epic-Heading: Time Tracking
TSC-TT-001: Project Timer As an employee, I want to be able to start and stop a timer for each project I am working on so that I can accurately track my time.
TSC-TT-002: Time Summary: As an employee, I want to be able to view a summary of the time I have spent on each project so that I can manage my time effectively.


Feature: Reporting
Epic-Heading: Report Generation
TSC-RG-001: Detailed Time Report: As a manager, I want to be able to generate a detailed report on the time spent on each project and task so that I can monitor progress and identify areas for improvement.
TSC-RG-002: Billable and Non-Billable Hours: As a manager, I want to be able to generate a report that shows the billable and non-billable hours for each project so that I can accurately bill clients.


Epic-Heading: Customisation
TSC-CU-001: Report Customisation: As a manager, I want to be able to customise the reports based on different criteria, such as project, employee, and date range, so that I can get the information I need.
TSC-CU-002: Invoice Customisation: As an accountant, I want to be able to customise the invoices with different billing rates and payment terms so that they are accurate and professional.


Feature: Invoicing
Epic-Heading: Invoice Creation
TSC-IC-001: Billable Hours Calculation: As an accountant, I want the app to automatically calculate the billable hours for each project so that I can create accurate invoices.
TSC-IC-002: Invoice Preview As an accountant, I want to be able to preview the invoice before sending it to the client so that I can ensure accuracy.


Epic-Heading: Customisation
TSC-CU-003: Payment Terms As an accountant, I want to be able to customise the payment terms for each invoice so that they are appropriate for each client.
TSC-CU-004: Invoice Branding: As a business owner, I want to be able to customise the branding on the invoices so that they reflect my company's image.

如果您分析这些故事,您会意识到基本的时间跟踪应用程序需要更多的故事才能无缝地工作,例如时间表的编辑。可能不需要一些故事,例如TSC-CU-002 — 发票定制,TSC-CU-004 -发票品牌等。

给UI模型提示的故事列表响应,然后将UI模型响应进一步传递到验收标准提示中,以生成所有12个故事的验收标准。

以下是一个关于捕获项目时间的故事,包含验收标准和UI模拟详细信息。

Feature-Heading: Time Entry and Tracking
Epic-Heading: Time Entry
TSC-TET-001: Quick and Accurate Time Entry
User-Story: As an employee, I want to be able to enter my work hours quickly and accurately so
that I can focus on my work.

UI Mockup:
A form with fields for date, project, task, start time, end time, and notes.
A button to submit the time entry.


Validations:
The date field should only accept valid dates.
The project field should be a drop-down list of available projects.
The task field should be a drop-down list of available tasks for the selected project.
The start time and end time fields should only accept valid times.
The end time should be greater than the start time.
The notes field should have a character limit.

Acceptance Criteria:
1. Given the user is on the time entry page, when the user fills in all the required fields and
clicks on the submit button, then the time entry should be saved successfully.
2. Given the user is on the time entry page, when the user enters an invalid date, then an error
message should be displayed.
3. Given the user is on the time entry page, when the user selects a project, then the task
dropdown should be populated with the available tasks for the selected project.
4. Given the user is on the time entry page, when the user enters an end time that is less than
the start time, then an error message should be displayed.
5. Given the user is on the time entry page, when the user enters notes that exceed the character
limit, then an error message should be displayed.

虽然不完美,但它提供了一个很好的起点。然而,在这个故事中有一些缺失的细节。它没有指明任务列表或项目列表将从哪里填充或如何配置它们。此外,这个故事没有提到需要包含的强制字段。

此外,文章中给出的理由:“这样我就可以专注于工作”,可能不足以成为员工填写时间表的充分理由。如果改为“这样我就能准确地追踪我在该项目上花费的时间”,会更加有效。

生成的UI模拟设计细节被传递到Figma线框设计师中生成UI线框图。这个插件是一个概念验证,使用GPT模型生成线框图设计。它可以帮助根据提示生成线框图模拟设计。随着模型的改进,有更多的组件和更好的提示,可能性是无限的。在这个领域值得探索的其他工具是:visily.ai和uizard.io的Autodesigner。

以下是用户故事视图,包括故事细节、UI模型、验收标准和验证逻辑:

ChatGPT中文站

这是任何业务分析员开始用户故事并填写空白的好起点。可以通过更深入地阐述问题陈述和特征来进一步提高生成的细节的质量。响应的质量取决于提示的清晰度和输入或问题陈述的特定性。随着语言模型的不断改进,整合更多组件并使用更好的提示可能会导致更准确、全面的结果。

最后,我们能够建立包含所有故事的故事板。

ChatGPT中文站

以上练习利用LLMs提供的知识快速探索了不同的特征。整个过程可以在维护对需求管理的结构化和组织化方法的同时,帮助利益相关者更快地交付并创建价值。

我们耗费了几个小时进行试错,以确保这五个提示的有效性。每个提示需要大约2-3分钟才能生成反应。现在设置已经完成,我们可以将这些提示整合到一个单一的工具中,可以用于多个问题陈述。

用史无前例的速度自动化Kickstart

设想每个组织或业务分析师定义一个定制的史诗和故事结构,以满足他们的特定需求,并利用这样的工具自动化生成带有验收标准的功能和非功能用户故事。这确保需求定义明确且可衡量。如果业务分析师向这样的工具提供定制的结构和高级解决方案的明确定义问题陈述,生成用户故事只需一键即可。通过利用这种方法,业务分析师可以集中精力解决手头的问题,并与他人合作改进和迭代生成的输出。

这个工具具有提示和定制结构,可以被业务分析师在各种项目中利用。

当自定义语言模型成为标准时,这种方法简化了定义清晰可衡量的需求的过程,使组织能够实现更快的交付和为利益相关者创造更大的价值,同时保持对需求管理的结构化和组织化方法,从而最大化软件应用的整体效果。

前方有什么?

利用生成式人工智能和相应工具可以显著加速业务分析阶段,并简化需求收集过程,从而为业务分析师和开发人员节省时间和精力。然而,需要注意的是,虽然生成式人工智能工具十分强大,但它们可能无法全面分析每个方面,因此在分析中可能存在一些漏洞。

重要的是,商业分析师和开发人员需要运用批判性思维和领域专业知识来验证和完善这些工具生成的输出。通过将生成式人工智能的优势与人类专业知识相结合,我们可以实现更高效和生产力的业务分析过程,利用人工智能工具加快初始阶段,同时确保通过人类监督进行全面分析。

2023-10-20 16:42:26 AI中文站翻译自原文