SlideShare a Scribd company logo
1 of 18
The Document Engineering Company
LangChain Webinar: Lessons from
Deploying LLMs with LangSmith
Jean Paoli @jeanpaoli
Taqi Jaffri @tjaffri
Mike Palmer
Zubin Wadia @zubinwadia
Topics
1. Intros
2. Real-World Challenges using LLMs with Documents
i. Real documents are more than flat Text
ii. Documents are Knowledge Graphs
iii. Building Complex Chains with the LangChain Expression Language
iv. Debugging Complex Chain Failures in Production
3. Summary: End to end LLM Ops
… deploy / run / trace / correct / finetune / repeat
Who we are...
• Generative AI for Business Documents. Founded 2018.
• Leverage open source and our own LLMs trained on millions of business documents to create a full
XML data representation of complex documents in their entirety, delivering immediate value to frontline
business users.
• Document as data can be used to generate insights and reports, create new documents, or drive line-
of-business applications. Free trial at www.docugami.com/trial
• Customers in many sectors, including insurance, real estate, health, professional services.
Jean Paoli
Co-founder, CEO
Pioneer in document engineering;
co-creator of XML, .docx, .xlsx, .pptx;
started four $1B+ businesses at Microsoft
Mike Palmer
Co-founder, Head of Technologies
Senior engineering manager at
Microsoft; co-created Microsoft
InfoPath.
Zubin Wadia
Product Manager
Making documents matter to people and
systems – 100+ products over 20 years. MIT,
ImageWork, CiviGuard.
Taqi Jaffri
Co-founder, Head of Product
Principal Product Manager at
Microsoft; co-created the AI driving
Microsoft presence in physical stores.
Challenge 1: Real documents are more than flat text
Real Documents are Structurally Complex: Headings, Lists, Tables, Headers/Footers, Complex Reading Orders, Figures, etc.
Mitigations:
1. Structurally chunk the
document to find
structural elements.
2. Stitch together reading
order flow with language
models.
3. Sub-chunk for RAG using
document structural
elements rather than
simple tiling or text
splitting.
Challenge 2: Documents are Knowledge Graphs
Document structures and spatial relationships contain semantics that are often lost in simple text-based retrieval
Mitigations:
1. XML hierarchical
Knowledge Graph
representation for
inherent per-
document
semantics added to
vector store for
RAG
2. Schema
normalization
across sets of
similar documents
Example XML hierarchical Knowledge Graph
Represents structural relationships as well as per-chunk semantic labels
Retrieval Augmented Generation (RAG) w/ Semantic Chunk
Metadata from Docugami XML
Vector DB
Knowledge Base e.g.,
business documents
Step 1: Indexing / Ingestion
Embedding Model
converts chunks to
embeddings
Data Loader reads
text from
Knowledge Base
and creates chunks
Vector DB offers
fast lookup of
chunks
semantically
similar to any
given string, e.g.
a question
Question
Step 2: Querying
Similar Chunks in Knowledge
Base (possibly contain
answers)
-- improved with additional
information from Docugami
XML Knowledge Graph
Chat
History
Answer
(sourced in
Knowledge
Base)
Metadata from
Docugami XML
LangSmith
Run
traces
Challenges 1 & 2
CODE WALK-THROUGH
https://rebrand.ly/docugami_semantic_rag
Challenge 3: Building Complex Chains with the LangChain
Expression Language
Real-world chains can get complicated with parallel branches, output parsers, few shot examples, conditional sub-chains, etc.
Question
“What were the
total midmarket
gross sales for
Mexico in
2014?”
Generate
SQL Query
SQL DB
(read-only)
Table
schema and
sample rows
Run SQL
Query
Explainers
(in parallel)
Result
Explainer
Query
Explainer
(for non-
technical
users)
SELECT SUM("Gross
Sales") FROM
financial_data WHERE
Segment = "Midmarket"
AND Country = "Mexico"
AND Year = 2014;
Syntax
Error?
(pysqlite3.dbapi2.O
perationalError) no
such table:
financial_data
Attempt
Fixup
SELECT SUM("Gross
Sales") FROM "Financial
Data" WHERE Segment =
"Midmarket" AND Country
= "Mexico" AND Year =
2014;
"[(451890.0,)]"
The total
midmarket gross
sales for Mexico
in 2014 were
$451,890.
Sum of 'Gross
Sales' for the
'Midmarket' segment
in Mexico for the
year 2014.
Sample code: https://rebrand.ly/docugami_complex_chain
Challenge 3
LANGSMITH WALK-THROUGH
https://smith.langchain.com/public/ab8ef1ec-46d1-4d1f-980a-
6dcc8f1943e0/r
Challenge 4: Debugging Complex Chain Failures in Production
Identifying what went wrong, where…
Common Failures:
1. Invalid SQL that could not
be automatically fixed,
leading to chain failure
2. Token overflow (table
schema too large)
3. LLM rate limit reached
4. LLM call failed with GPU
OOM (for self-hosted
models)
5. Exception in custom python
RunnableLambda
6. Exception in custom output
parser
TIP: If you have a link to a detailed call stack for an exception, you can add it to the failed run as
metadata for later investigation. You can also add other information useful to investigate the
failure later.
TIP: Name all runnable lambdas and pass config to conditionally-invoked runnables to correctly link and
name. Reference: cookbook | example
1. Deploy Model (we self-host a custom LLM)
2. Regularly look at failed and user-disliked runs
3. Add some problematic runs to dataset
a) Failed runs e.g. with syntax errors
b) Runs with negative user feedback
4. Fix runs in dataset
a) Tip: use larger LLM to propose fixes
b) Tip: validate that fixes are syntactically correct e.g. by checking SQL syntax
5. Add some examples to few shot set for in-context learning
6. Fine tune model on updated dataset
7. Redeploy (go back to #1)
Summary: Docugami’s End to end LLM Ops with LangChain
+ LangSmith
Q&A
The Document Engineering Company
Docugami API
1.Docs: https://help.docugami.com/home/docugami-api
2.Things to try:
a) Upload docs (DOCX, DOC, digital or scanned PDF)
b) Download processed XML (with semantic metadata tags)
c) Build reports to identify key chunks
d) Use the LlamaHub Docugami loader to load docs for RAG, with
report metadata
3.Free trials available!
Example: Extracting Custom Data from a Document Set
Improved significantly via structural chunking and key metadata associated with all chunks
Example: Authoring Assistance Based on Your Documents
Improved significantly via structural chunking and key metadata associated with all chunks
Example: Workflows Triggered by Auto-Extracted Data
Improved significantly via structural chunking and key metadata associated with all chunks

More Related Content

What's hot

Introduction to Natural Language Processing (NLP)
Introduction to Natural Language Processing (NLP)Introduction to Natural Language Processing (NLP)
Introduction to Natural Language Processing (NLP)VenkateshMurugadas
 
Build an LLM-powered application using LangChain.pdf
Build an LLM-powered application using LangChain.pdfBuild an LLM-powered application using LangChain.pdf
Build an LLM-powered application using LangChain.pdfStephenAmell4
 
AI and ML Series - Leveraging Generative AI and LLMs Using the UiPath Platfor...
AI and ML Series - Leveraging Generative AI and LLMs Using the UiPath Platfor...AI and ML Series - Leveraging Generative AI and LLMs Using the UiPath Platfor...
AI and ML Series - Leveraging Generative AI and LLMs Using the UiPath Platfor...DianaGray10
 
Large Language Models Bootcamp
Large Language Models BootcampLarge Language Models Bootcamp
Large Language Models BootcampData Science Dojo
 
Building a Pipeline for State-of-the-Art Natural Language Processing Using Hu...
Building a Pipeline for State-of-the-Art Natural Language Processing Using Hu...Building a Pipeline for State-of-the-Art Natural Language Processing Using Hu...
Building a Pipeline for State-of-the-Art Natural Language Processing Using Hu...Databricks
 
Fine tune and deploy Hugging Face NLP models
Fine tune and deploy Hugging Face NLP modelsFine tune and deploy Hugging Face NLP models
Fine tune and deploy Hugging Face NLP modelsOVHcloud
 
Airbyte - Seed deck
Airbyte - Seed deckAirbyte - Seed deck
Airbyte - Seed deckAirbyte
 
Introduction to natural language processing (NLP)
Introduction to natural language processing (NLP)Introduction to natural language processing (NLP)
Introduction to natural language processing (NLP)Alia Hamwi
 
Nodes 2023 - Knowledge graph based chatbot.pptx
Nodes 2023 - Knowledge graph based chatbot.pptxNodes 2023 - Knowledge graph based chatbot.pptx
Nodes 2023 - Knowledge graph based chatbot.pptxTomazBratanic1
 
Using AI chatbots for deep learning and teaching with specific examples to en...
Using AI chatbots for deep learning and teaching with specific examples to en...Using AI chatbots for deep learning and teaching with specific examples to en...
Using AI chatbots for deep learning and teaching with specific examples to en...Nigel Daly
 
LanGCHAIN Framework
LanGCHAIN FrameworkLanGCHAIN Framework
LanGCHAIN FrameworkKeymate.AI
 
Document Summarization
Document SummarizationDocument Summarization
Document SummarizationPratik Kumar
 
Generative AI at the edge.pdf
Generative AI at the edge.pdfGenerative AI at the edge.pdf
Generative AI at the edge.pdfQualcomm Research
 
LangChain Intro by KeyMate.AI
LangChain Intro by KeyMate.AILangChain Intro by KeyMate.AI
LangChain Intro by KeyMate.AIOzgurOscarOzkan
 
LLaMA-Adapter: Efficient Fine-tuning of Language Models with Zero-init Attent...
LLaMA-Adapter: Efficient Fine-tuning of Language Models with Zero-init Attent...LLaMA-Adapter: Efficient Fine-tuning of Language Models with Zero-init Attent...
LLaMA-Adapter: Efficient Fine-tuning of Language Models with Zero-init Attent...Po-Chuan Chen
 
AI and ML Series - Introduction to Generative AI and LLMs - Session 1
AI and ML Series - Introduction to Generative AI and LLMs - Session 1AI and ML Series - Introduction to Generative AI and LLMs - Session 1
AI and ML Series - Introduction to Generative AI and LLMs - Session 1DianaGray10
 
Azure Chat Bot application
Azure Chat Bot application Azure Chat Bot application
Azure Chat Bot application Vivek Singh
 

What's hot (20)

Introduction to Natural Language Processing (NLP)
Introduction to Natural Language Processing (NLP)Introduction to Natural Language Processing (NLP)
Introduction to Natural Language Processing (NLP)
 
Build an LLM-powered application using LangChain.pdf
Build an LLM-powered application using LangChain.pdfBuild an LLM-powered application using LangChain.pdf
Build an LLM-powered application using LangChain.pdf
 
AI and ML Series - Leveraging Generative AI and LLMs Using the UiPath Platfor...
AI and ML Series - Leveraging Generative AI and LLMs Using the UiPath Platfor...AI and ML Series - Leveraging Generative AI and LLMs Using the UiPath Platfor...
AI and ML Series - Leveraging Generative AI and LLMs Using the UiPath Platfor...
 
Text summarization
Text summarizationText summarization
Text summarization
 
Large Language Models Bootcamp
Large Language Models BootcampLarge Language Models Bootcamp
Large Language Models Bootcamp
 
Building a Pipeline for State-of-the-Art Natural Language Processing Using Hu...
Building a Pipeline for State-of-the-Art Natural Language Processing Using Hu...Building a Pipeline for State-of-the-Art Natural Language Processing Using Hu...
Building a Pipeline for State-of-the-Art Natural Language Processing Using Hu...
 
Fine tune and deploy Hugging Face NLP models
Fine tune and deploy Hugging Face NLP modelsFine tune and deploy Hugging Face NLP models
Fine tune and deploy Hugging Face NLP models
 
Airbyte - Seed deck
Airbyte - Seed deckAirbyte - Seed deck
Airbyte - Seed deck
 
Introduction to natural language processing (NLP)
Introduction to natural language processing (NLP)Introduction to natural language processing (NLP)
Introduction to natural language processing (NLP)
 
Nodes 2023 - Knowledge graph based chatbot.pptx
Nodes 2023 - Knowledge graph based chatbot.pptxNodes 2023 - Knowledge graph based chatbot.pptx
Nodes 2023 - Knowledge graph based chatbot.pptx
 
Using AI chatbots for deep learning and teaching with specific examples to en...
Using AI chatbots for deep learning and teaching with specific examples to en...Using AI chatbots for deep learning and teaching with specific examples to en...
Using AI chatbots for deep learning and teaching with specific examples to en...
 
LanGCHAIN Framework
LanGCHAIN FrameworkLanGCHAIN Framework
LanGCHAIN Framework
 
Document Summarization
Document SummarizationDocument Summarization
Document Summarization
 
Generative AI at the edge.pdf
Generative AI at the edge.pdfGenerative AI at the edge.pdf
Generative AI at the edge.pdf
 
LangChain Intro by KeyMate.AI
LangChain Intro by KeyMate.AILangChain Intro by KeyMate.AI
LangChain Intro by KeyMate.AI
 
LLaMA-Adapter: Efficient Fine-tuning of Language Models with Zero-init Attent...
LLaMA-Adapter: Efficient Fine-tuning of Language Models with Zero-init Attent...LLaMA-Adapter: Efficient Fine-tuning of Language Models with Zero-init Attent...
LLaMA-Adapter: Efficient Fine-tuning of Language Models with Zero-init Attent...
 
Text summarization
Text summarization Text summarization
Text summarization
 
AI and ML Series - Introduction to Generative AI and LLMs - Session 1
AI and ML Series - Introduction to Generative AI and LLMs - Session 1AI and ML Series - Introduction to Generative AI and LLMs - Session 1
AI and ML Series - Introduction to Generative AI and LLMs - Session 1
 
Intro to LLMs
Intro to LLMsIntro to LLMs
Intro to LLMs
 
Azure Chat Bot application
Azure Chat Bot application Azure Chat Bot application
Azure Chat Bot application
 

Similar to LangChain + Docugami Webinar

Reengineering PDF-Based Documents Targeting Complex Software Specifications
Reengineering PDF-Based Documents Targeting Complex Software SpecificationsReengineering PDF-Based Documents Targeting Complex Software Specifications
Reengineering PDF-Based Documents Targeting Complex Software SpecificationsMoutasm Tamimi
 
"Running Open-Source LLM models on Kubernetes", Volodymyr Tsap
"Running Open-Source LLM models on Kubernetes",  Volodymyr Tsap"Running Open-Source LLM models on Kubernetes",  Volodymyr Tsap
"Running Open-Source LLM models on Kubernetes", Volodymyr TsapFwdays
 
Company Visitor Management System Report.docx
Company Visitor Management System Report.docxCompany Visitor Management System Report.docx
Company Visitor Management System Report.docxfantabulous2024
 
Introductionto Xm Lmessaging
Introductionto Xm LmessagingIntroductionto Xm Lmessaging
Introductionto Xm LmessagingLiquidHub
 
Tech challenges in a large scale agile project
Tech challenges in a large scale agile projectTech challenges in a large scale agile project
Tech challenges in a large scale agile projectHarald Soevik
 
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...Bill Buchan
 
Use Case Patterns for LLM Applications (1).pdf
Use Case Patterns for LLM Applications (1).pdfUse Case Patterns for LLM Applications (1).pdf
Use Case Patterns for LLM Applications (1).pdfM Waleed Kadous
 
Document Based Data Modeling Technique
Document Based Data Modeling TechniqueDocument Based Data Modeling Technique
Document Based Data Modeling TechniqueCarmen Sanborn
 
Google File System
Google File SystemGoogle File System
Google File Systemvivatechijri
 
A Case Study Of A Reusable Component Collection
A Case Study Of A Reusable Component CollectionA Case Study Of A Reusable Component Collection
A Case Study Of A Reusable Component CollectionJennifer Strong
 
Tech leaders guide to effective building of machine learning products
Tech leaders guide to effective building of machine learning productsTech leaders guide to effective building of machine learning products
Tech leaders guide to effective building of machine learning productsGianmario Spacagna
 
DOC-20210303-WA0017..pptx,coding stuff in c
DOC-20210303-WA0017..pptx,coding stuff in cDOC-20210303-WA0017..pptx,coding stuff in c
DOC-20210303-WA0017..pptx,coding stuff in cfloraaluoch3
 
Assessment item 1 File Systems and Advanced Scripting .docx
Assessment item 1 File Systems and Advanced Scripting .docxAssessment item 1 File Systems and Advanced Scripting .docx
Assessment item 1 File Systems and Advanced Scripting .docxdavezstarr61655
 
Practical machine learning
Practical machine learningPractical machine learning
Practical machine learningFaizan Javed
 
SURE Research Report
SURE Research ReportSURE Research Report
SURE Research ReportAlex Sumner
 

Similar to LangChain + Docugami Webinar (20)

5010
50105010
5010
 
Reengineering PDF-Based Documents Targeting Complex Software Specifications
Reengineering PDF-Based Documents Targeting Complex Software SpecificationsReengineering PDF-Based Documents Targeting Complex Software Specifications
Reengineering PDF-Based Documents Targeting Complex Software Specifications
 
"Running Open-Source LLM models on Kubernetes", Volodymyr Tsap
"Running Open-Source LLM models on Kubernetes",  Volodymyr Tsap"Running Open-Source LLM models on Kubernetes",  Volodymyr Tsap
"Running Open-Source LLM models on Kubernetes", Volodymyr Tsap
 
Company Visitor Management System Report.docx
Company Visitor Management System Report.docxCompany Visitor Management System Report.docx
Company Visitor Management System Report.docx
 
Introductionto Xm Lmessaging
Introductionto Xm LmessagingIntroductionto Xm Lmessaging
Introductionto Xm Lmessaging
 
Tech challenges in a large scale agile project
Tech challenges in a large scale agile projectTech challenges in a large scale agile project
Tech challenges in a large scale agile project
 
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
 
Ad507
Ad507Ad507
Ad507
 
Use Case Patterns for LLM Applications (1).pdf
Use Case Patterns for LLM Applications (1).pdfUse Case Patterns for LLM Applications (1).pdf
Use Case Patterns for LLM Applications (1).pdf
 
Document Based Data Modeling Technique
Document Based Data Modeling TechniqueDocument Based Data Modeling Technique
Document Based Data Modeling Technique
 
Google File System
Google File SystemGoogle File System
Google File System
 
A Case Study Of A Reusable Component Collection
A Case Study Of A Reusable Component CollectionA Case Study Of A Reusable Component Collection
A Case Study Of A Reusable Component Collection
 
Tech leaders guide to effective building of machine learning products
Tech leaders guide to effective building of machine learning productsTech leaders guide to effective building of machine learning products
Tech leaders guide to effective building of machine learning products
 
NamingConvention
NamingConventionNamingConvention
NamingConvention
 
DOC-20210303-WA0017..pptx,coding stuff in c
DOC-20210303-WA0017..pptx,coding stuff in cDOC-20210303-WA0017..pptx,coding stuff in c
DOC-20210303-WA0017..pptx,coding stuff in c
 
BigDataDebugging
BigDataDebuggingBigDataDebugging
BigDataDebugging
 
191
191191
191
 
Assessment item 1 File Systems and Advanced Scripting .docx
Assessment item 1 File Systems and Advanced Scripting .docxAssessment item 1 File Systems and Advanced Scripting .docx
Assessment item 1 File Systems and Advanced Scripting .docx
 
Practical machine learning
Practical machine learningPractical machine learning
Practical machine learning
 
SURE Research Report
SURE Research ReportSURE Research Report
SURE Research Report
 

Recently uploaded

Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝soniya singh
 

Recently uploaded (20)

Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
 

LangChain + Docugami Webinar

  • 1. The Document Engineering Company LangChain Webinar: Lessons from Deploying LLMs with LangSmith Jean Paoli @jeanpaoli Taqi Jaffri @tjaffri Mike Palmer Zubin Wadia @zubinwadia
  • 2. Topics 1. Intros 2. Real-World Challenges using LLMs with Documents i. Real documents are more than flat Text ii. Documents are Knowledge Graphs iii. Building Complex Chains with the LangChain Expression Language iv. Debugging Complex Chain Failures in Production 3. Summary: End to end LLM Ops … deploy / run / trace / correct / finetune / repeat
  • 3. Who we are... • Generative AI for Business Documents. Founded 2018. • Leverage open source and our own LLMs trained on millions of business documents to create a full XML data representation of complex documents in their entirety, delivering immediate value to frontline business users. • Document as data can be used to generate insights and reports, create new documents, or drive line- of-business applications. Free trial at www.docugami.com/trial • Customers in many sectors, including insurance, real estate, health, professional services. Jean Paoli Co-founder, CEO Pioneer in document engineering; co-creator of XML, .docx, .xlsx, .pptx; started four $1B+ businesses at Microsoft Mike Palmer Co-founder, Head of Technologies Senior engineering manager at Microsoft; co-created Microsoft InfoPath. Zubin Wadia Product Manager Making documents matter to people and systems – 100+ products over 20 years. MIT, ImageWork, CiviGuard. Taqi Jaffri Co-founder, Head of Product Principal Product Manager at Microsoft; co-created the AI driving Microsoft presence in physical stores.
  • 4. Challenge 1: Real documents are more than flat text Real Documents are Structurally Complex: Headings, Lists, Tables, Headers/Footers, Complex Reading Orders, Figures, etc. Mitigations: 1. Structurally chunk the document to find structural elements. 2. Stitch together reading order flow with language models. 3. Sub-chunk for RAG using document structural elements rather than simple tiling or text splitting.
  • 5. Challenge 2: Documents are Knowledge Graphs Document structures and spatial relationships contain semantics that are often lost in simple text-based retrieval Mitigations: 1. XML hierarchical Knowledge Graph representation for inherent per- document semantics added to vector store for RAG 2. Schema normalization across sets of similar documents
  • 6. Example XML hierarchical Knowledge Graph Represents structural relationships as well as per-chunk semantic labels
  • 7. Retrieval Augmented Generation (RAG) w/ Semantic Chunk Metadata from Docugami XML Vector DB Knowledge Base e.g., business documents Step 1: Indexing / Ingestion Embedding Model converts chunks to embeddings Data Loader reads text from Knowledge Base and creates chunks Vector DB offers fast lookup of chunks semantically similar to any given string, e.g. a question Question Step 2: Querying Similar Chunks in Knowledge Base (possibly contain answers) -- improved with additional information from Docugami XML Knowledge Graph Chat History Answer (sourced in Knowledge Base) Metadata from Docugami XML LangSmith Run traces
  • 8. Challenges 1 & 2 CODE WALK-THROUGH https://rebrand.ly/docugami_semantic_rag
  • 9. Challenge 3: Building Complex Chains with the LangChain Expression Language Real-world chains can get complicated with parallel branches, output parsers, few shot examples, conditional sub-chains, etc. Question “What were the total midmarket gross sales for Mexico in 2014?” Generate SQL Query SQL DB (read-only) Table schema and sample rows Run SQL Query Explainers (in parallel) Result Explainer Query Explainer (for non- technical users) SELECT SUM("Gross Sales") FROM financial_data WHERE Segment = "Midmarket" AND Country = "Mexico" AND Year = 2014; Syntax Error? (pysqlite3.dbapi2.O perationalError) no such table: financial_data Attempt Fixup SELECT SUM("Gross Sales") FROM "Financial Data" WHERE Segment = "Midmarket" AND Country = "Mexico" AND Year = 2014; "[(451890.0,)]" The total midmarket gross sales for Mexico in 2014 were $451,890. Sum of 'Gross Sales' for the 'Midmarket' segment in Mexico for the year 2014. Sample code: https://rebrand.ly/docugami_complex_chain
  • 11. Challenge 4: Debugging Complex Chain Failures in Production Identifying what went wrong, where… Common Failures: 1. Invalid SQL that could not be automatically fixed, leading to chain failure 2. Token overflow (table schema too large) 3. LLM rate limit reached 4. LLM call failed with GPU OOM (for self-hosted models) 5. Exception in custom python RunnableLambda 6. Exception in custom output parser TIP: If you have a link to a detailed call stack for an exception, you can add it to the failed run as metadata for later investigation. You can also add other information useful to investigate the failure later. TIP: Name all runnable lambdas and pass config to conditionally-invoked runnables to correctly link and name. Reference: cookbook | example
  • 12. 1. Deploy Model (we self-host a custom LLM) 2. Regularly look at failed and user-disliked runs 3. Add some problematic runs to dataset a) Failed runs e.g. with syntax errors b) Runs with negative user feedback 4. Fix runs in dataset a) Tip: use larger LLM to propose fixes b) Tip: validate that fixes are syntactically correct e.g. by checking SQL syntax 5. Add some examples to few shot set for in-context learning 6. Fine tune model on updated dataset 7. Redeploy (go back to #1) Summary: Docugami’s End to end LLM Ops with LangChain + LangSmith
  • 13. Q&A
  • 15. Docugami API 1.Docs: https://help.docugami.com/home/docugami-api 2.Things to try: a) Upload docs (DOCX, DOC, digital or scanned PDF) b) Download processed XML (with semantic metadata tags) c) Build reports to identify key chunks d) Use the LlamaHub Docugami loader to load docs for RAG, with report metadata 3.Free trials available!
  • 16. Example: Extracting Custom Data from a Document Set Improved significantly via structural chunking and key metadata associated with all chunks
  • 17. Example: Authoring Assistance Based on Your Documents Improved significantly via structural chunking and key metadata associated with all chunks
  • 18. Example: Workflows Triggered by Auto-Extracted Data Improved significantly via structural chunking and key metadata associated with all chunks