Unlocking the power of generative AI to visualize functional requirements
Introduction
One of major time-consuming activity for an IT architect is to convert functional requirements of an IT system in an IT architecture, including the graphic representation. There is a list of deliverable to produce to have a detailed IT architecture “package” that can be resumed as follow:
In all these steps, the added value is, from an architect point of view, define the architectural components and their relationship. Anyway, IT architects spend a lot of time in create charts, slide, diagrams, etc., leveraging different tools, including draw.io, Microsoft PowerPoint, etc.
In this article, I’ll show you an example related to how generate an architectural overview, starting from functional requirements, leveraging generative AI, and, in particular, Large Language Models.
Approach
The approach is described in the image below.
The main steps of the workflow are described below.
Input
The input for this pipeline can be a functional requirements document, or a text note collected during a brief customer conversation.
Extract architectural components
First step is to identify, from input text, all the system components and their relationship. For example, if you are describing an IoT platforms, the components can be:
?
Extract architectural components relationships
Once the architectural components have been identified, it is important to identify their relationship. Considering the IoT platform example I described above, it is important identify relationships between the external devices and the IoT platform, between the IoT platform and the data lake, between the data lake and UI layer for data visualisation.
?
Generate code to print the architecture
Having the architectural components and their relationship, it is possible to print the architectural overview leveraging code generation capabilities of Large Language Models (LLMs). Considering that several programming libraries exist to generate charts and diagrams, it is possible to ask to a LLM to generate a programming code that print a specific diagram giving as input a set of requirements. The only thing you need to add is to run generated code in your favourite IDE to have the result (an image file, for example).
DEMO
Consider you have following IT landscape description, and you need to generate an architectural overview of your IT system:
The solutions represent an IoT platform to collect data from IoT devices. The IoT devices send data to an IoT layer using AWS GreenGrass middleware. The IoT platform, based on AWS IoT Core service, collects data from IoT devices and send data to a data lake based on Amazon S3 service. Data from AWS IoT Core and S3 is decoupled using Amazon Kinesis service. Amazon QuickSight is used to show data to the end user. Data are collected from Amazon S3.
In this example, I started from a requirement that include IT services indication. Note that It is also possible to start a step behind and get in input only a functional description, without IT landscape specifications, for example:
I need an IoT platform to collect data from IoT devices and to implement a predictive maintenance solution.
Below I will show an example of implementation of the logical steps I described in previous section, for the first scenario.
Extract architectural components and relationships
This step can be implemented with the prompt described in below image.
?Below the answer from the model.
Generate code to print the architecture
Now that we have a structured list of architectural components and relationship, we can ask to the LLM to generate a programming code to represent the architectural overview. In particular, I’m asking to the model to write Python code using Diagrams library.
The model generates following Python code:
from diagrams import Cluster, Diagram
from diagrams.aws.compute import Lambda
from diagrams.aws.iot import InternetOfThings, IotGreengrass
from diagrams.aws.storage import S3
from diagrams.aws.analytics import KinesisDataStreams, Quicksight
from diagrams.generic.device import Mobile
with Diagram("IoT Architecture", show=True):
iot_devices = Mobile("IoT Devices")
with Cluster("AWS GreenGrass Middleware"):
greengrass = IotGreengrass("GreenGrass")
with Cluster("AWS IoT Core Service"):
iot_core = InternetOfThings("IoT Core")
with Cluster("Amazon S3 Service"):
s3 = S3("S3 Data Lake")
with Cluster("Amazon Kinesis Service"):
kinesis = KinesisDataStreams("Kinesis")
with Cluster("Amazon QuickSight"):
quicksight = Quicksight("QuickSight")
iot_devices >> greengrass >> iot_core >> s3
iot_core >> kinesis >> s3
s3 >> quicksight
Last step needed is to run this Python code to have the architecture representation. The output is reported below.
It is possible, starting from here, to also generate a mapping of this (simple) IT landscape to other cloud provider. As an example, I asked to LLM to map these architecture to IBM Cloud, see below prompt:
Below the answer from the model:
Before to generate the chart, I just updated “IBM Edge Application Manager” layer with IBM Omnio middleware. Below the chart generation prompt and answer:
Below the generated code:
from diagrams import Cluster, Diagram
from diagrams.ibm.applications import IotApplication
from diagrams.ibm.storage import ObjectStorage
from diagrams.ibm.analytics import StreamingComputing
from diagrams.ibm.infrastructure import Dashboard
from diagrams.ibm.infrastructure import EdgeServices
from diagrams.generic.device import Mobile
with Diagram("IBM IoT Architecture", show=True):
iot_devices = Mobile("IoT Devices")
with Cluster("IBM Edge Application Manager"):
edge_manager = EdgeServices("Omnio Edge")
with Cluster("IBM Watson IoT Platform"):
iot_platform = IotApplication("Watson IoT Platform")
with Cluster("IBM Cloud Object Storage"):
object_storage = ObjectStorage("Cloud Object Storage")
with Cluster("IBM Event Streams"):
event_streams = StreamingComputing("Event Streams")
with Cluster("IBM Cognos Analytics"):
cognos_analytics = Dashboard("Cognos Analytics")
iot_devices >> edge_manager >> iot_platform >> object_storage
iot_platform >> event_streams >> object_storage
object_storage >> cognos_analytics
?
This code generate following diagram:
CONCLUSIONS
In this article I discussed a simple and rapid approach to convert a functional requirements description in an architectural overview diagram. An example based on an AWS solution has been described step-by-step.
Also, I reported an example of architectural mapping from AWS landscape to IBM landscape, leveraging LLMs.
An important message here is that it is true that large language models can “only” generate text; but this text can be also a programming code, and with a programming code you can also generate picture, diagrams, sounds, AI models implementation, etc.
?Another consideration is that auto-generated code can need some review: to use this pipeline in a production system, it is important to embed these functionalities in an enterprise governed system.
?In this example, I started from a technical description of a requirement, that included IT services name to use. It is possible also to generate IT services recommendation with LLM, starting from a “more” functional requirements, and run the described pipeline as-is.
#artificialintelligence #generativeAI #watsonx #archtiecting #architecturaldiagram #aws #architecturalthinking