How to Structure Data with n8n Nodes - Oskar
8:30

How to Structure Data with n8n Nodes - Oskar

n8n 25.03.2024 10 483 просмотров 129 лайков

Machine-readable: Markdown · JSON API · Site index

Поделиться Telegram VK Бот
Транскрипт Скачать .md
Анализ с AI
Описание видео
During the n8n Community Hangout of March 2024, community member Oskar explained how he uses LLMs with n8n to parse and generate structured data. His example loads resumes from candidates and uses a predefined data format that Links: - Download this workflow: https://n8n.io/workflows/2170-extract-data-from-resume-and-create-pdf-with-gotenberg/ - Full Community Hangout: https://www.youtube.com/watch?v=eZacuxrhCuo - Sign up for future n8n Community Hangouts: https://lu.ma/u/n8n

Оглавление (2 сегментов)

Segment 1 (00:00 - 05:00)

so uh yeah uh I'm going to tell you a bit about data structuring with u with na10 AI notes so this is something that basically o uh also covered in his uh short demo um but uh yeah let's dive into it and I will actually use the open AI here so uh maybe it will be something uh that you'll find interesting so yeah uh basically I would try to cover it with the um like a use case in this example we are going to parse uh resume documents uh so here I have like the example document from this John do which is who is the software developer and we are going to extract uh some of those data which is education employment history and so on uh to the structured um structured form and then we are going to process it in um in an workflow so what we are going to uh build actually here is like a very small and easy uh chat bot um that will cover in telegram that will be our interface here uh we'll use um open AI for actually parsing structuring the data um we will use of course n10 to connect it everything together and to process this data and at the last point we will actually generate a PDF and for this purpose I'm going to use uh Gutenberg uh if you're not familiar with Gutenberg it's a really cool software I also have on my YouTube channel a small tutorial about this so you're very welcome to um dive into it uh but what we are going to do is actually have this um telegram chatbot uh to upload this uh resume and in the output we also will receive the PDF but um what is the difference between the one that we uploaded and the second one that we actually received the um PDF that we received is uh fully made on this structur data so in this case it doesn't look quite impressive because it's like just a plain HTML converted into PDF but uh we can like select the data that we want to put into this document and um and actually convert it so this is one of the things that we can do we can of course uh add those add this data into some kind of database with our workflow but I Focus only here on um converting it into actually the other PDF which may seem to be a bit useless but uh it's only for the purpose of this presentation so if you receive resumes in very different formats right and it all brings it back to one format yeah so yeah this is that was actually you know the idea because as far as I know there are some H HR like agencies companies that struggle with this EXA so yeah I I find it uh actually that was the inspiration here all right so here we have like this workflow that is behind it h it may seem a bit complex at first but actually it's quite easy the very first part uh on the left which are two conditional if noes um this is actually the authentication uh for the chatbot uh here I just want to uh mention that yeah it's the ch is only available for the users with specific uh chat ID so this is like the very simple version of authentication then we are going to extract the data with Native um node in na10 which is the extract from PDF um it's worth mentioning that this node extracts the data from readable PDF when it comes to the like things like scans REITs and so on uh we need some kind of OCR here to connect but uh for purpose of this presentation I think it's uh totally okay to use it um then we'll have like this heart of this workflow which is the chain um with um open AI uh model and with parsing uh parsing subnodes I will go to this a bit later in the next slide uh finally we have a bunch of code notes which actually only are responsible for formatting the document and making the whole structure and finally the uh generation rating of this PDF so when we uh run this workflow um we will have an pared output here out of this uh chain and finally it should be like generated uh in Gutenberg and delivered to the user so this is what is going behind here and let's focus right now on this um on this chain so first we are extracting the um the text from the rume so as you

Segment 2 (05:00 - 08:00)

can see here we have the full text that we have from our uh our document the thing is that this text is actually quite a mess right now so we need to make a structure of it so uh for this purpose we use uh this open AI chart model and this one has a very specific settings so at first I give it a prompt to uh extract the data and what is quite important here I also mentioned it in bold text uh we want to receive the Unified Json format this is because we as a response mode um in options in this um in this subnode we want to use Json so um this model will do its best to return to Json and as far as I know it's available for now only in gp4 Turbo um preview uh models uh with and of course we set the temperature to zero because we don't want the um model to be too creative at this point um so when we executed this chain we should receive the uh the structure of the document proposed by the model so uh it also doesn't look good right now because this is totally stringified um output and what we need to do right now is simply put it through uh go through the uh schema Json schema this is also something that ol mentioned in uh in his demo so first here's an example we have uh example the name yes of uh of the person of this resume and um we need to create a Json schema for uh for this specific parameter here right so of course I'm not going to do it by uh by myself here so I simply copy the proposed um proposed by the model Json and ask chat GPT to create it for me because this is simply uh easier and faster and I can simply um operate on already on code that is ready and edit it by myself I don't need to write it from scratch so as you can see this is quite um extensive here uh we can limit edit it however we want uh to have the schema that fits our requirements in this for this purpose I'm going to copy it and the last step actually here is to put the um structured uh output parser uh which by default has the schema and I'm going to replace it with my schema so when I execute this workflow right now I should receive in the output not stringified version of this Json but very well pared uh pared data so as you can see right now we have very clear table with the data that we can do whatever we want with it we can um pass it to the database process it uh make a PDF and send back to the user the possibilities are here actually um very broad so um yes this is uh how this small project looks like I will try to uh prepare this template for a public uh view so uh thank you very much and highly invite you to subscribe to my channel on my YouTube uh I will try to upload something new very soon thanks

Другие видео автора — n8n

Ctrl+V

Экстракт Знаний в Telegram

Экстракты и дистилляты из лучших YouTube-каналов — сразу после публикации.

Подписаться

Дайджест Экстрактов

Лучшие методички за неделю — каждый понедельник