Creating your first flow
Last updated
Last updated
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.
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.
Now we gonna add two components.
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, which can generate a response based on the database output. OpenAI offers many models, but for our purposes, we will use GPT-3.5 Turbo.
The next step is the configuration of each component. We will start with the "Trigger". In the "Config," you will add two inputs: the first is a question, and the second is a file.
For the example, the question we will 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 download 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 should be set up as follows.
The final step is configuring the output. Itβs quite similar to the input configuration: click on "Add," enter "Response" in the "Title" field, put an "@" in the "Value" field, select opa-0.output
, and then click "OK."
Now all configurations have been done itβs time to execute 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.