[Step-by-Step Guide] Integrating UiPath with Open AI
Table of Contents:
- Introduction
- Building the Demo of the Document Reader
- Understanding the GPT Activities
- Installing the GPT Activities Package
- Reading Different File Types
- Asking Questions and Extracting Information
- Implementing the Loop for Multiple Questions
- Publishing the Code to Orchestrator
- Creating a Shortcut in UiPath Assistant
- Testing the Document Reader Demo
Introduction
In this article, we will discuss how to build a document reader using UiPath and the GPT (Generative Pre-trained Transformer) activities. The document reader will extract information from unstructured documents and respond to user queries Based on the content of the document. We will explore the steps involved in building the demo, installing the necessary packages, reading different file types, asking questions, implementing a loop for multiple questions, and publishing the code to Orchestrator. Finally, we will Create a shortcut in UiPath Assistant and test the document reader demo.
Building the Demo of the Document Reader
To begin, we will build the demo of the document reader. The demo allows users to pass a document and ask questions related to its content. For example, users can pass an appointment letter and ask who the letter is for. The document reader will extract the required information and respond with the answer.
Understanding the GPT Activities
The GPT activities, developed by Internal Apps, enable the extraction of data from unstructured free documents. These activities have the capability to extract data from different types of documents such as agreements, contracts, insurance policies, financial reports, scientific papers, and emails. The GPT activity package does not require an API key and is intended for non-production scenarios like demos, proof of concepts, and pilot projects.
Installing the GPT Activities Package
To use the GPT activities in our project, we need to install the GPT activities package from the UiPath Marketplace. The UiPath Marketplace is a collection of components developed by UiPath developers, architects, and companies. To install the package, we can go to the Manage Packages section in UiPath Studio, search for "GPT activities by Internal Apps", and install it. Once installed, the GPT activities will be available in the Activities panel under the Internal Labs section.
Reading Different File Types
The document reader should be able to handle different file types such as PDF, Word, and Excel. We can use the Read PDF Text activity from the GPT activities package to extract text from PDF files. Similarly, we can use the Word Application Scope activity and Read Text activity to extract text from Word files. For Excel files, we can use the Read Range activity. Based on the file extension, we can select the appropriate activity to read the file.
Asking Questions and Extracting Information
After reading the document, the document reader should allow users to ask questions related to the document's content. We can use the Input Dialog activity to ask the user to input their question. The question will be stored in a variable. We can then pass the document and the question to the Ask GPT activity from the GPT activities package. The Ask GPT activity will extract the answer from the document based on the question and store it in a variable.
Implementing the Loop for Multiple Questions
To enable the document reader to handle multiple questions, we can use a Do-While loop. The loop will Continue until the user indicates that they have no more questions. We can use the Prompt Dialog activity to ask the user if they have a new question. If the user selects "Yes", the loop will continue and ask for another question. If the user selects "No", the loop will exit and the program will terminate.
Publishing the Code to Orchestrator
To make the document reader accessible from anywhere, we can publish the code to UiPath Orchestrator. UiPath Orchestrator is a web-based application that allows us to manage and deploy our automation projects. We can publish the code as a package in the Orchestrator's Tenant Feed. Once published, the document reader will be available in UiPath Assistant for execution.
Creating a Shortcut in UiPath Assistant
To easily execute the document reader, we can create a shortcut in UiPath Assistant. This will allow us to run the automation directly from the desktop or the Assistant interface. By clicking on the shortcut, the document reader will open in UiPath Assistant and prompt the user to upload a document and ask questions.
Testing the Document Reader Demo
Finally, we can test the document reader demo by running the automation. We can provide a document, ask questions, and verify that the document reader extracts the correct information and responds accordingly. We can test the demo with different file types, such as PDF and Word, to ensure the document reader handles them correctly. Additionally, we can test the loop functionality by asking multiple questions and verifying that the document reader continues to prompt for new questions until we indicate that we have no more.
In conclusion, the document reader demo built using UiPath and the GPT activities provides an efficient way to extract information from unstructured documents and respond to user queries. By following the step-by-step process outlined in this article, users can create their own document readers and customize them to suit their specific requirements.
Pros:
- Efficient extraction of information from unstructured documents
- Ability to handle multiple file types
- Simple and intuitive user interface
- Seamless integration with UiPath Orchestrator
- Customizable to specific use cases
Cons:
- Limited support for production scenarios
- Some limitations in the GPT activities package
- Requires basic knowledge of UiPath Studio and Orchestrator
Highlights:
- Building a document reader demo using UiPath and GPT activities
- Installing the necessary packages and reading different file types
- Implementing a loop for multiple questions
- Publishing the code to UiPath Orchestrator
- Creating a shortcut in UiPath Assistant for easy execution
- Testing the document reader demo with various file types and questions
FAQ:
Q: Can the document reader handle other file types besides PDF and Word?
A: Yes, the document reader can handle various file types such as Excel, CSV, and more. The appropriate activities should be used based on the file extension.
Q: Is the document reader able to read scanned documents or images?
A: No, the document reader is designed to extract text from electronic documents such as PDF and Word files. It does not have OCR capabilities to read scanned documents or images.
Q: How accurate is the document reader in extracting information from documents?
A: The accuracy of the document reader depends on the quality and structure of the documents. It performs best on well-structured documents with consistent formatting. Some adjustments may be needed for documents with complex layouts or non-standard formatting.
Q: Can the document reader be used in a production environment?
A: The GPT activities package used in the document reader is intended for non-production scenarios like demos, proof of concepts, and pilot projects. Further testing and validation are recommended before deploying the document reader in a production environment.
Q: Can the document reader be integrated with other automation tools?
A: Yes, the document reader can be integrated with other automation tools and APIs using UiPath's extensive library of activities and connectors. Customizations and integrations can be done to suit specific business requirements.
Q: Is the document reader able to handle multiple languages?
A: Yes, the document reader can handle multiple languages as long as the text content is in a readable format. However, language-specific processing and NLP capabilities may vary depending on the underlying technologies used.
Q: Does the document reader require internet connectivity?
A: No, the document reader does not require internet connectivity once the necessary packages and dependencies are installed. It can work offline as long as the input documents and the GPT model are accessible locally.
Q: Can the document reader handle documents with sensitive or confidential information?
A: Yes, the document reader can handle sensitive or confidential information. However, appropriate security measures should be implemented to protect the data, such as encryption, access controls, and data anonymization techniques.
Q: How can I extend the functionalities of the document reader?
A: The document reader can be extended by adding additional activities, implementing custom logic, integrating with external systems, or using other AI models and technologies. UiPath provides a comprehensive ecosystem and support for building advanced automation solutions.
Q: Is there any limit to the file size or the number of questions that the document reader can handle?
A: The file size and the number of questions that the document reader can handle may depend on the resources available in the system and the configurations of the GPT model. It is recommended to test with different scenarios to ensure optimal performance.