The Document AI feature in Data Cloud is revolutionizing the way businesses handle unstructured data by enabling the extraction of valuable information from documents such as PDFs and images. This capability can be further enhanced by integrating it with Agentforce, allowing for more sophisticated data processing and automation.
In this blog post, we’ll explore how to leverage Document AI with Agentforce to streamline your data management processes.
Introduction to Document AI
Document AI is a powerful tool within Data Cloud that allows users to extract structured data from unstructured documents. Whether you’re dealing with invoices, resumes, or other types of documents, Document AI can help you unlock the information contained within them. The extracted data can then be used in various applications, such as flows, Apex classes, and Agentforce.
Before you can integrate Document AI with Agentforce, you’ll need to create an external client app (a modern replacement for what was previously known as a “connected app”) in Salesforce. This app will enable the necessary authentication and authorization for your integration.
Create a schema configuration
The first step in leveraging Document AI is to create a schema configuration. This involves defining the structure of the data you want to extract from your documents. You can create a schema configuration from a source object using an unstructured data model (UDM) or without a source object and invoke it programmatically.
Here’s a step-by-step guide to creating a schema configuration without a source object:
- Select the document type: Choose the type of document you want to process, such as resumes.
- Choose your LLM Model: Choose one of the two LMMs (more LLMs to be added in future) for processing your data.
- Upload sample documents: Upload a few sample resumes to help Document AI learn the structure of the data
- Extract fields: Use the auto-extraction feature or manually define the fields you want to extract, such as professional summary, skills, and work experience.
- Test the configuration: Test your schema configuration against sample resumes to ensure it’s working as expected.
- Save the configuration: Save your schema configuration with a meaningful label, such as “Resume Template.”
Use Document AI programatically
Once you have your schema configuration set up, Document AI’s capabilities can be further extended by integrating it with Data Cloud’s Connect REST APIs, Apex classes, and flows.
This allows you to create more complex workflows that involve data processing, validation, and integration with external systems.Two ways that you can extend Document AI are as follows.
Data Cloud Connect REST APIs
Use external APIs to integrate Document AI with other systems, such as document management systems or CRM platforms.
Here is the API endpoint:
And request body as follows:
Also, you’ll need to add the authorization details associated with your external client app in the header section.
Here is an example of response from Document AI using the API:
Apex classes
This involves creating an Apex class with a user-invocable method that invokes the schema configuration. You can use this Apex class in the GitHub Repository for reference purposes.
You can also use flows to process extracted data. Create flows that process the data extracted by Document AI to performing tasks, such as data validation, transformation, and storage.
The following screenshot shows a sample flow that processes resume data.
By leveraging these integrations, you can unlock the full potential of Document AI and create more sophisticated data management workflows.
Integrate Document AI with Agentforce
To integrate Document AI with Agentforce, you’ll need to add the Document AI configuration as a topic in your agent and pass in relevant information, such as the candidate’s name.
Watch this video to learn how to set up and integrate Document AI with Agentforce.
By following these steps, you can create powerful agents that leverage Document AI to extract and process data from unstructured documents, enhancing your overall data management capabilities.
Conclusion
Extending Data Cloud’s Document AI with Agentforce opens up new possibilities for automating and streamlining your data processing workflows. By creating intelligent agents that can extract and analyze data from documents, you can gain deeper insights and make more informed decisions.
Resources
- Agentforce Decoded: Integrate Data Cloud’s Document AI with Agentforce
- Document AI documentation
- Document AI GitHub repository
About the author
Akshata Sawant is a Senior Developer Advocate at Salesforce and co-author of a book titled “MuleSoft for Salesforce Developers,” published by Packt Publication. For a more in-depth look at Akshata’s accomplishments, visit her LinkedIn profile.