Example of a flow

Harnessing the power of Diaflow's cutting-edge AI technology, we'll create a Flow that not only analyzes but also intelligently responds to your document-related queries.

The goal of this example is to create a flow with a PDF file and a question as inputs, and to generate the answer to the question as the output. In our case, we are going to use a document that discusses Covid-19 and ask the AI to answer questions related to the document.

1 - Create the flow

Because this is your first Flow, we will create the Flow using the build from scratch. To create a Flow, click on "build a flow" then "build from scratch". After that you can start to build a flow adding components for what you want to do.

2 - Build the flow

Now we gonna add two components for the example.

The first one is MongoDB Atlas. This component is a database who takes in "Input" a question and in "Data to vectorize" the file we have put in trigger. MongoDBAtlas is used to vectorize large amounts of data suitable for feeding into a model component. In our case he is used to query about the content of the PDF file.

The second component is OpenAI. The component can generate a response from the output of the database. OpenAI has a lot of models but for our case we gonna use GPT 3.5 Turbo

3 - Configuration

The next step is the configuration of each component. We gonna start with the trigger, In the "Config" you gonna add two inputs. The first is a question and the second is a file.

For the example, the question we gonna use is "How much is the estimated loss of revenue from the airlines and airports in 2020 due to the COVID-19 pandemic ?". To insert the text you have to click on "Preview" in "Trigger" and write the question. And the document is a PDF File called "Covid19_SITREP". You can consult the pdf link just below and upload the document in "File".

For the configuration of the MongoDB Atlas you just have to put the right elements in "Input" and "Data to vectorize" like down below.

The configuration for the OpenAI component need to be like this.

The last step is the ouput. It's quite similar to the input because you have to click on add and in "Title" you put Response, in "Value" you put an @ and you select opa-0.ouput and then click on OK.

Now all configurations have been done it’s time to execute the flow.

4 - Run the flow

To execute the flow it's pretty simple. You have to click on "Execute" on the top right of your screen.

Once the "Run" button has been clicked, the "Flow diagnostics" right-aligned Sidebar will be displayed, showing you the current execution status of the Flow. After a short period of time, the Text Output component will be populated with the result of your inquiry about the source document.

Congratulations on your inaugural Diaflow experience! You've just witnessed the seamless creation of a dynamic Flow using our innovative Flow Template, effortlessly tapping into the power of AI technology.

Last updated