宣布LlamaCloud正式上线(以及我们的1900万美元A轮融资)!
LlamaIndex

Rujun Gao 2024-02-12

开启住房新未来:推出GenAI驱动的ADU规划

ADU Planner实际应用

在当前严峻的住房短缺背景下,通过附属住宅单元(ADU)这一创新概念,美国人拥有房屋的梦想正在被重新定义。这些紧凑高效的住宅单元,通常建在现有房产的后院,不仅仅是一种趋势——它们是模块化和预制化居住解决方案的一场革命。2022年,ADU市场与模块化和预制房屋相结合,在全球范围内飙升至令人瞩目的1500亿美元,预计到2032年将跃升至3000亿美元(链接)。

然而,建造ADU的过程远非简单。传统上,这涉及大量的土地测量以及与众多供应商进行咨询以筛选各种平面图。认识到需要一条更高效的途径,我们的团队精心打造了一个创新解决方案:一个由GenAI驱动的ADU规划系统。这个尖端工具巧妙地穿梭于复杂的城市建筑规范中,轻松地将用户与本地供应商连接起来,并提供可行的平面图选项——所有这些都在我们用户友好的应用中完成。

我们的使命是简化您的ADU建造流程,使其不再令人生畏且更易于访问。想象一下,当规划的复杂性通过几次点击就能解决时所带来的潜力——这就是触手可及的GenAI的力量。

屡获殊荣的创新:ADU Planner脱颖而出

我们激动地宣布一个里程碑式的成就:我们的“ADU Planner”项目在2024年2月的第一个周末举办的LlamaIndex RAG Hackathon中荣获最高荣誉。这一胜利突显了我们致力于通过我们的开创性技术改造ADU领域的承诺。

通过以下资源了解我们项目的独特之处,并探索我们创新规划器的全部范围

· 深入了解详情:访问我们的Devpost项目页面,获取详细信息。

· 探索我们的代码:对于技术爱好者,我们的代码库可在GitHub上获取。

我们才刚刚开始,这次认可只会进一步推动我们创新和交付有价值解决方案的动力。

观看我们的演示

技术

我们的“ADU Planner”核心是尖端技术与用户友好设计的协同作用。无缝的界面由React精心打造,提供直观的前端体验,而我们强大的Flask后端是功能的核心,由GPT-3.5/4V的最新AI提供动力,并辅以LlamaIndex PDF解析器的精确性和Google Maps的多功能性。

这是我们的工作流程:

1. 简单开始:用户首先在我们的前端输入地址。此操作触发我们基于Google地理编码的后端启动,捕获相关物业的详细卫星图像。

2. 解析细节:接下来,流程分为双重分析模式。一条路径涉及解析本地建筑法规,这项任务由GPT-3.5熟练处理,以挖掘具体的ADU规定,例如最小和最大建筑面积限制。同时,GPT-4V仔细扫描卫星图像,以找出任何潜在障碍物并划定适合ADU开发的区域。

3. 让计划成真:确定可行区域后,我们的系统开始虚拟搜索,浏览本地建筑商的网站,寻找不仅符合法规要求,也适合您物业实际情况的ADU平面图。然后,这些平面图会在识别出的可建区域内生动地呈现。

4. 通往未来的点击:与选择的平面图互动非常简单,只需点击一下,用户就会被引导至建筑商的网站,在那里可以查看沉浸式3D渲染图、定价详情等。最后,我们的工具还会精心准备数据导出,以便于与ADU建筑商进行那些至关重要的初步讨论。

这不仅仅是一个工具——它是将您的后院变成充满可能性的空间的门户。

流程图

流程图

代码示例

查询PDF

在以下示例中,我们将查询加州萨拉托加的本地ADU建筑法规。一旦您设置了LlamaIndex和OpenAI API密钥,就可以按如下方式解析PDF:

from llama_parse import LlamaParse
parser = LlamaParse(result_type='markdown')
docs = sum([
  parser.load_data(file) for file in [
    'Documents/ADU_FAQ.pdf',
    'Documents/ADU_Handbook.pdf',
    'Documents/SCC-ADU-Guidebook-FINAL-9.8.23.pdf']], [])

然后,我们可以将文档索引到一个临时的或内存中的Chroma DB嵌入存储中。

chroma_client = chromadb.EphemeralClient()
chroma_collection = chroma_client.get_or_create_collection('embeddings')
vector_store = ChromaVectorStore(chroma_collection=chroma_collection)
storage_context = StorageContext.from_defaults(vector_store=vector_store)
index = VectorStoreIndex.from_documents(docs, storage_context=storage_context)

接下来,我们可以通过为代理创建一个工具来查询文档,从而将文档集成到我们的代理流程中。

tools = [
  QueryEngineTool(
       query_engine=index.as_query_engine(),
       metadata=ToolMetadata(
           name='saratoga_adu_codes',
           description=('Provides information about ADU building codes for the city of Saratoga, CA.'),
       ),
   )
]

总而言之,我们的代理将能够如下回答关于文档的问题:

from llama_index.agent import OpenAIAgent

agent = OpenAIAgent.from_tools(tools, verbose=True)
agent.chat("""\
Answer the following questions regarding Accessory Dwelling Unit (ADU) construction planning in Saratoga, California (CA):
- What are the typical side and rear setbacks for a detached ADU?
""")


>>> 'For detached ADUs in Saratoga, California, the typical side and rear setbacks are a minimum of four feet from the lot lines.'

图像分析

首先,我们将准备一张图像并绘制出来以进行视觉识别。

import os
from pathlib import Path
from PIL import Image
import matplotlib.pyplot as plt

input_image_path = Path("input_images")
if not input_image_path.exists():
    Path.mkdir(input_image_path)

image_extensions = ['.jpg', '.jpeg', '.png', '.gif', '.bmp']

# Filter out non-image files
image_paths = [str(input_image_path / img_path) for img_path in os.listdir(input_image_path) 
               if any(img_path.lower().endswith(ext) for ext in image_extensions)]

def plot_images(image_paths):
    images_shown = 0
    plt.figure(figsize=(16, 9))
    for img_path in image_paths:
        if os.path.isfile(img_path):
            image = Image.open(img_path)

            plt.subplot(2, 3, images_shown + 1)
            plt.imshow(image)
            plt.xticks([])
            plt.yticks([])

            images_shown += 1
            if images_shown >= 6:  # Adjusted to match the subplot dimensions (2,3)
                break

plot_images(image_paths)

其次,我们可以基于GPT-4V进行图像分析并识别物业布局,以下面的提示样本为例。

instruction = '''
You are an intelligent Accessory Dwelling Units (ADU) architect designer and contractor.
Please analyze the image, describle the layout, and then describe the pool, property, and driveways in the format of:
1. property: xxx
2. pool: xxx
...
'''
from llama_index.multi_modal_llms.openai import OpenAIMultiModal
from llama_index import SimpleDirectoryReader

# put your local directore here
image_documents = SimpleDirectoryReader("./input_images").load_data()

openai_mm_llm = OpenAIMultiModal(
    model="gpt-4-vision-preview", api_key=OPENAI_API_TOKEN, max_new_tokens=1500, temperature = 0.0
)

response = openai_mm_llm.complete(
    prompt = instruction,
    image_documents=image_documents,
)

print(response)
Based on the aerial image provided, here is an analysis of the layout:

1. Property: The property appears to be a residential lot with a single-family home. The house has a hipped roof with multiple sections, indicating a complex floor plan with possibly several rooms or wings. There is a landscaped area surrounding the house with various trees and shrubs, and the terrain seems to be sloped, as indicated by the terracing on the land.

2. Pool: There is a kidney-shaped pool located to the northwest of the main house. It is surrounded by a paved area, likely for lounging and poolside activities, and is accessible via a curved pathway that leads from the house to the pool area.

3. Driveways: It is not entirely clear from the image where the driveway is located, as the specific access point to the property is not visible. However, there seems to be a paved path leading from the bottom right of the image towards the house, which could be the driveway or a walkway. If it is the driveway, it would be located on the southeast side of the property, leading up to the house.

Please note that without a broader view or additional context, some details about the property, such as the exact location of the driveway or additional structures, may not be accurately determined.

结论

我们的应用显著简化了房主建造ADU的过程。它熟练地处理土地测量和确定可行平面图等复杂任务。虽然ADU供应商需要验证所选平面图,且城市必须批准施工,但我们的工具通过促进全面的家庭分析来推动这一进程。展望未来,我们准备正式推出此应用,并与信誉良好的ADU供应商建立合作关系,以加强对模块化和预制房屋建造的监督。我们致力于通过根据个人预算限制和特定布局偏好调整建议,进一步个性化我们的服务,确保用户的住房愿景能够精确而细致地实现。