Transcription
In this video, I'm going to be showing you Unstr, which is an AI-powered no-code platform designed to help organizations automate and streamline the processing of large unstructured documents such as PDFs, images, and scanned files.
If you deal with a large volume of documents within your industry, you will likely find Unstr's approach to data extraction and integration particularly useful.
First, I want to touch on the challenge of unstructured data. Many organizations are used to receiving or storing information in an unstructured format. This could be various types of forms, invoices, contracts, or even sometimes handwritten notes. Traditional data processing methods often require manual intervention or complicated rule sets.
In one of my past jobs, this used to actually be a whole segment of the organization where we had data entry specialists. Their whole job was basically going through different documents, effectively taking documents as well as data from one place and entering it within another place. That type of approach, it almost goes without saying, is both time-consuming, expensive, and oftentimes prone to error.
Let's enter the solution and more or less the modern era. What Unstr allows you to do is take all of these different document types, parse those, and get extracted data. For instance, say you have an invoice. This will be an example of what you could get extracted from that invoice. You could send in a request with the path to that file, and ultimately, you can get this nice, clean, structured data that you can store within your database or use in whatever way you see fit.
The first thing that I want to point out is Unstr is an open-source repository. This allows you to use this on your own infrastructure. If you're interested, they do also have hosted solutions if you're looking for an easy turnkey solution. Within here, you'll be able to automate tasks like document classification, data extraction, data validation, and you can even integrate this with other business systems.
The nice thing with this platform is it is a no-code platform, so it's accessible to users who may not have an extensive technical background. This broader accessibility can make document processing automation even easier to adopt within different types of organizations.
The first thing that I'm going to show you is you can go and make an account for free on Unstr. Once you're within the platform, this is what it looks like. There are a number of different examples that you can look at within here. We see there is a credit card example.
The way that this works is you can define the different keys of the items that you want to extract from the document. Within this example, we have issuer name, customer name, customer address, and payment info, as well as the spend line items.
Within each of these items, we see that there's a description of what each of these are. For the description of the key of customer name, we have the description of what we're looking to extract. This is going to be the customer to whom this credit card stat belongs. The customer address is pretty self-explanatory: the full address, city, and zip code.
As for the issuer name, this is going to be the issuer of the bank that has issued this credit card. What you can do here is run the LLM on this particular document, but you can also have a series of documents within this.
The way that this works is if you want to add in a new value, I could say something like the minimum payment. Within here, I can say this is the minimum payment the customer owes for this particular cycle. Once we've defined that, we can determine whether this is text or a number. In this case, I'm going to specify that it is a number.
What I can do here is run this again for the particular document. Now we're going to get all of those values, including the minimum payment that we just specified. Here we see that the value is 20539, and we can see on the credit card balance that it is 20539.
Now, what this will look like if you are going to be leveraging the API is you're going to have this nice data format. Here we see all of those defined keys that we had within our document parser, and this is what we get returned as the payload.
The other thing that I want to point out within the platform is you can look at it from the PDF viewer. You can also see the raw format of it as well, so this is the text representation of the PDF, as you can see here. This is all the text values.
Now, the other thing that you can do is this just has one document, but let's say you have a number of different documents. You can go and upload as many documents as you'd like. If you have a batch of different documents that you want to extract all that different data from, you can go and add them all in here just like that.
The nice thing with how the prompt studio is set up is you're going to be able to have these different projects. You can imagine within here you could have a project for invoices, and it would go through a particular flow of all the different values that you care about within an invoice.
Whereas within a resume, it could go through and parse the different things that you're interested in within a resume. You can start to see the different use cases on how this can be helpful. You have this visual interface, but you can also programmatically make requests and have the same output as well.
The other option that you have within here is you can create these workflows. So I'll just demonstrate this here. I'll create an example workflow, and within here, what you can do is select these different tools.
We have the file classifier, which classifies a file into a bin based on its contents, or we have the text extractor, which is a tool designed to convert a document into its text representation. Let's say we're going to use the text extractor.
What we can do here is determine whether it's going to be based on the file system or the API, and then we can also select the connector. Let's say I have an API for both of these. I can go ahead and run this workflow to test this.
I'm going to go ahead and upload an image of a bank statement. Here we can see that it is working. It's running through the process where we're processing the file, and once that extraction is done, we'll see all of the text within here.
Now, once you've set up a workflow, you'll be able to easily deploy this to an API. What you can do here is just define what the name is for our API, and we can say example API.
Now we see how we can make a request to that endpoint. Within here, we see this is going to be the JavaScript version. We also have the Python requests, or we can look at the curl requests.
What this is going to do is we see that it's going to make a request to the Unstr domain, and within here, we have the route for our API. We have API, and then we have example API. If we just take a look here, we see the header, we see the form, and that's as easy as it is.
That's how we can connect a workflow to our API deployments. Another option that you do have is you can set up these ETL pipelines. What this allows you to do is effectively transform your unstructured data and ultimately have that pipeline into your database or potentially other systems that you have.
It makes it really easy if you just want to streamline the process of having these documents that go within a system and ultimately get inputted into a database or solution that you're already using.
The other thing to note is within here, you can choose from a variety of different LLMs. You can go ahead and select from even Olama if you want. You can use Anthropic, you can use some of the Google models, AWS, AnyScale, OpenAI, Vertex AI, Mistol, or Azure OpenAI as well.
It also shows that they are going to be supporting Replicate soon. If you want to use this locally, AMA could potentially be a really good option, or if you want a hosted solution, there are increasingly a number of great options out there that you can use for data extraction.
Another great thing with the platform is you can set this up natively to work with a number of different vector databases from Postgres, Pinecone, Weaviate, Milvus, and more. Similar to the LLMs, it is very flexible in terms of the vector database that you want to use.
Effectively, you can choose the vector database that you want to use, plug in your API key, and then you can have that within the implementation on how you can store and ultimately retrieve information from your documents as well.
Just to touch on vectors and embeddings for a moment, the way that they work is you're going to send in a document that could be an invoice, for example. When you send in that invoice, what's going to be returned back is a numerical representation of that text.
Once we have that numerical representation, we can store that within our vector database. Where it's helpful is when a user goes and puts in a query or if we're searching for something. When we have that piece of text, we're going to go embed that piece of text, get another numeric representation.
The key piece with this is when it performs that search functionality, it's going to take what we're looking for as well as the numbers that currently exist, and it's going to find the closest or the most similar numbers within that set or that embedding. It's going to retrieve those results.
That's going to give us the relevance on the different queries. Where this can be helpful is if you're dealing with a huge volume of documents. This is a very quick and performant way on how you can scan.
This can be tens of thousands, potentially hundreds of thousands of documents that you can quickly scan by leveraging vector databases as well as embeddings.
Finally, you do have the option for the text extractor within here. You can select from a number of different extractor options. You can use Unstructured IO, Llama, Parse, or they also have LLM Whisperer.
Just to show you what LLM Whisperer looks like, here's an example of a form that an organization might have to deal with. Here we have all of the text. We see that it's scanned, we see that it's crooked, and we even have written text within here.
So what LLM Whisper allows us to do is take this document and convert it into this text version of it. Where this is helpful is the text version can be stored within a database. You can also use this text version within large language models.
As we can see here, the performance of this is spot on. If we look at the name, we see "I'm a cardholder." We see the social security number here. We see within the extraction that it also exists here as well.
We can see even the different fields. If there are checkboxes, we see that represented here, and basically all of the different values throughout here can be seen to match one for one between the different documents.
The other key piece with this is it also preserves the layout. This doesn't just extract in a way where it's just going to be one long string of text. We can see that it's taking the text, but it's also keeping it in a format where it's going to be uniform with the document that was passed in.
Now, I just want to touch on the prompt studio again. Within here, one of the key features of the prompt studio is they have something known as LLM Challenge that works within the prompt studio.
So here we see this receipt. We can see all the different keys that we want to extract. But another really great feature of this is if we go over to the settings and we go to the LLM Challenge setting, what we can do is select to enable LLM Challenge, and I can save this out.
What it will do is it's going to use two separate LLMs to extract and challenge the information. So what this allows you to do is have a dual catch mechanism that will catch and then discard the hallucinations early in the process, which makes this highly reliable.
Lastly, just a couple of other pieces that I want to highlight: they have really great comprehensive documentation. Whether you're using LLM Whisper or if you're using Unstr itself, you can go and check out all of the different steps to see whatever process that you might be interested in setting up.
Everything is very well documented within here. Then, if you're interested in setting this up locally or on your own infrastructure, you can see all of the requirements within the repo here.
To set it up, it is super simple. Effectively, you can pull down the repo, run the command to start it, and then you will see it within the particular port for Unstr. The hosted version comes with a 14-day trial if you're interested in trying it out.
In terms of the providers, as I showed you within the video, there are a ton of LLMs that you can use this with, vector databases and embeddings, text extractors, and in terms of ETL destinations, at the time of recording, they have support for Snowflake, Redshift, BigQuery, Postgres, MySQL, as well as a few others.
Overall, that's pretty much it for this video in highlighting Unstr. For those who manage high volumes of data and need more reliable document parsing, Unstr will very likely be a useful option to explore.
Hopefully, you have found this useful, and you can see how you can potentially leverage their platform and how it might fit into your particular workflows for taking unstructured data, making it structured, and having these pipelines that can work at scale.
Unstr is a very useful option to explore. That's pretty much it for this video. If you found this video useful, please like, comment, share, and subscribe. Otherwise, until the next one.