Inspiration

The construction industry, which contributes about $151 billion annually to Canada's economy is known to face challenges with worker safety and building code compliance. This issue also persists within Vancouver, British Columbia’s construction industry. The industry in Vancouver is complex, with constantly evolving regulations around building codes, fire safety, plumbing, and worker safety. Construction professionals often struggle to navigate these regulations, leading to compliance issues, delays, and safety risks.

What it does

Our app CapstructAI is an AI-powered assistant that simplifies access to critical regulations and ensures safety compliance in Vancouver. By helping construction professionals quickly find accurate, location-specific regulations, our tool saves time and reduces risks, ensuring projects run smoothly. Additionally, the app pulls data directly from a structured, curated set of real-world Vancouver building code & jobsite safety documents, thereby ensuring precision. This differs from other AI like ChatGPT that can give general advice/responses, but lacks the deep domain expertise in construction code compliance.

How we built it

As per the hackathon direction we used Steamlit for the front end development, Cortex for search retrieval and Mistral LLM generation. Also, we performed some additional optimizations which included:

  • Categorizing our documents (e.g. electrical vs safety codes), making cortex search results faster and more relevant by ignoring irrelevant documents.
  • Using the LLM to improve search results by automatically selecting which category of documents to search. Secondly, the LLM was used to decide whether or not to augment the query with the chat history. These optimizations makes the app more user friendly since the user does not have to manually choose options that can optimize their search results.
    • We used Trulens to evaluate and filter our chunks returned by the cortex search service based on their relevance to the user query, thus optimizing the app by ensuring higher quality answers generated with more relevant context.

Challenges we ran into

  • Gathering all the Vancouver construction building code and safety documents took a lot of time and research to ensure relevancy.
  • Streamlit had some limitations that prevented our creation of a more customized UI design.
  • We had to modify the prompt of the mistral LLM to get good responses.
  • Only one Snowpark session can be used to access Snowflake at a time, whereas Streamlit re-runs all the code each time the user interacts with the app, creating multiple sessions and causing the app to crash.
  • Limitations with the available snowflake credits prevented us from doing a more extensive user testing and feedback.
  • When doing the Trulens integration into the app, selecting a relevance score cutoff for the context was a balancing act of ensuring high quality context is used without filtering all the context out.

Accomplishments that we're proud of

  • We were able to meet our goal of creating an app that provides accurate Vancouver-specific construction code and safety regulation answers.
  • Feedback after user testing has been generally positive.
  • We were able to complete and submit this project 2 days ahead of the Hackathon deadline.
  • Getting a fully functioning app working without prior experience with any of the tools and frameworks required (eg. Streamlit, Cortex, Mistral).
  • Going above and beyond by integrating Trulens to measurably improve app performance.

What we learned

  • Kenneth Fiawoyife: As product manager with limited programing experience, I was able to improve my base knowledge on RAG's, LLM, UI design and backend programing. Additionally, coming up with solutions for the challenges we faced and driving project progress improved my management skills.
  • Vincent Ji: As a developer with no LLM experience, this project was invaluable in terms of working directly with LLM tools and frameworks, as well as learning relevant skills such as prompt engineering and more advanced SQL queries.

What's next for CapstructAI: Simplifying Construction Code Compliance with AI

  • Our future vision is to first expand the app to cover all construction regulations across British Columbia. Eventually we intend to extend this further to cover other provinces in Canada. We also will continue to fine-tune our apps search capabilities, prompt responses and UI design. TruLens, Mistral, Cortex & Streamlit will continue to play a pivotal role in these future developments.

Built With

  • cortex
  • mistral
  • python
  • snowflake
  • streamlit
  • trulens
Share this project:

Updates