Loading video...

Video Failed to Load

Go Home

Transforming Invoice Data into JSON: Local LLM with LlamaIndex & Pydantic ๐Ÿš€ Complete video: Code: I explain how to get structured JSON output with LlamaIndex and dynamic Pydantic class. This helps to implement the use case of data extraction from invoice documents. The solution runs on the local machine,...

147,949 views โ€ข 2 years ago โ€ขvia X (Twitter)

13 Comments

Jeeva's profile picture
Jeeva2 years ago

Does this work on financial statements?

Andrej Baranovskij's profile picture
Andrej Baranovskij2 years ago

Starling LLM, the one I'm using here, is generic. It should work on financial statements. It can be replaced easily by switching the LLM name in config.yml with Mixtral or another more powerful LLM to process more complex docs.

Jeeva's profile picture
Jeeva2 years ago

Thank you. ๐Ÿ‘๐Ÿป

Kesavan's profile picture
Kesavan2 years ago

@andrejusb What are you using for OCR? Invoice formats have no standardization and they vary across different vendors/suppliers, do you not need to train the model for accuracy?

ALBIVโšก's profile picture
ALBIVโšก2 years ago

That's a lovely piece of "Fintech"

Zโค๏ธH's profile picture
Zโค๏ธH2 years ago

I built same thing with chatgpt, it works very well

Andrej Baranovskij's profile picture
Andrej Baranovskij2 years ago

The whole point is to built it without chatgpt to run for private data workflows

Zโค๏ธH's profile picture
Zโค๏ธH2 years ago

I'm GPU poor so...

Andrej Baranovskij's profile picture
Andrej Baranovskij2 years ago

With Ollama it runs on CPU or on Apple M1, Nvidia GPU is not needed. Iโ€™m also GPU poor and run LLMs on CPU locally

Andrej Baranovskij's profile picture
Andrej Baranovskij2 years ago

Thanks man, much appreciated ๐Ÿ‘

Johanna Einsiedler's profile picture
Johanna Einsiedler2 years ago

@LinasVastakas

sujit kumar ojha's profile picture
sujit kumar ojha2 years ago

@memdotai Mem it

Polygon.io's profile picture
Polygon.io2 years ago

Learn how to access market data using Polygon's Stock API and the Python programming language.

Related Videos

New Short Course: Getting Structured LLM Output! Learn how to get structured outputs from your LLM applications in this course, built in partnership with .txt, and taught by Will Kurt, a Founding Engineer, and , Developer Relations Engineer. It's challenging for software to automatically parse through an LLM's freeform text outputs. Structured outputsโ€”like JSONโ€”solve this by converting natural language into consistent, clear, data that a machine can read and process. This course teaches you how to generate structured outputs while building several use cases, including a social media analysis agent. Youโ€™ll learn about structured outputs and efficient ways to generate outputs in your defined schema or format. Youโ€™ll begin by using structured output APIs, then use re-prompting libraries like โ€œinstructorโ€ to generate structured output. Finally, youโ€™ll learn how constrained decoding works; this is a very clever technique in which constraints are applied on each subsequent token generated, blocking any tokens that donโ€™t fit your defined schema. In detail, youโ€™ll: - Learn why structured outputs are important, how they allow for scalable software development, and the different approaches to generate them, including vendor-provided APIs, re-prompting libraries, and structured generation. - Build a simple social media agent using OpenAIโ€™s structured output API, learn how to define a model's desired structured output using Pydantic, and perform basic programming with your outputs, such as importing structured data into a data frame using pandas. - Learn how to use the open-source library "instructor," which checks the structured output of the model and re-prompts the model until it validates the desired output, and explore the limitations of this approach. - Understand how structured generation by the โ€œoutlinesโ€ library works by modifying LLM logits, on a per-generated-token basis based on the desired format, to give a particular output structure. - Learn how regular expressions, which outlines works with, are represented as finite-state machines, and how they can be used to develop a range of structured outputs beyond JSON. By the end of this course, youโ€™ll have broadened your knowledge of the approaches you can use to get structured outputs from your LLM applications. Please sign up here:

Andrew Ng

89,720 views โ€ข 1 year ago