डॉक्युमेंट लोडर इंटीग्रेट करना

LangChain के साथ LLM एप्लिकेशन विकसित करना

Jonathan Bennion

AI Engineer & LangChain Contributor

Retrieval Augmented Generation (RAG)

  • prompt में जोड़ने के लिए प्रासंगिक जानकारी retrieve करने हेतु embeddings का उपयोग करें

एक सामान्य RAG वर्कफ़्लो.

LangChain के साथ LLM एप्लिकेशन विकसित करना

RAG डेवलपमेंट स्टेप्स

सामान्य RAG वर्कफ़्लो: एक डॉक्युमेंट लोडर, डॉक्युमेंट स्प्लिटर, और स्टोरेज व रिट्रीवल प्रक्रिया.

LangChain के साथ LLM एप्लिकेशन विकसित करना

LangChain डॉक्युमेंट लोडर

  • डॉक्युमेंट्स को load और configure करने के लिए बनी क्लासेस, ताकि सिस्टम में इंटीग्रेट हों
  • कॉमन फ़ाइल टाइप्स के लिए डॉक्युमेंट लोडर: .pdf, .csv
  • थर्ड-पार्टी लोडर: S3, .ipynb, .wav

document-loader.jpg

1 https://python.langchain.com/docs/integrations/document_loaders
LangChain के साथ LLM एप्लिकेशन विकसित करना

PDF डॉक्युमेंट लोडर

  • pypdf पैकेज इंस्टॉल होना जरूरी: pip install pypdf
from langchain_community.document_loaders import PyPDFLoader

loader = PyPDFLoader("path/to/file/attention_is_all_you_need.pdf")
data = loader.load()
print(data[0])
Document(page_content='Provided proper attribution is provided, Google hereby grants 
permission to\nreproduce the tables and figures in this paper solely for use in [...]
LangChain के साथ LLM एप्लिकेशन विकसित करना

CSV डॉक्युमेंट लोडर

from langchain_community.document_loaders.csv_loader import CSVLoader


loader = CSVLoader('fifa_countries_audience.csv')
data = loader.load()
print(data[0])
Document(page_content='country: United States\nconfederation: CONCACAF\npopulation_share: [...]
LangChain के साथ LLM एप्लिकेशन विकसित करना

HTML डॉक्युमेंट लोडर

  • unstructured पैकेज इंस्टॉल होना जरूरी: pip install unstructured
from langchain_community.document_loaders import UnstructuredHTMLLoader


loader = UnstructuredHTMLLoader("white_house_executive_order_nov_2023.html") data = loader.load()
print(data[0])
print(data[0].metadata)
page_content="To search this site, enter a search term\n\nSearch\n\nExecutive Order on the Safe, Secure,
and Trustworthy Development and Use of Artificial Intelligence\n\nHome\n\nBriefing Room\n\nPresidential
Actions\n\nBy the authority vested in me as President by the Constitution and the laws of the United
States of America, it is hereby ordered as follows: ..."

{'source': 'white_house_executive_order_nov_2023.html'}
LangChain के साथ LLM एप्लिकेशन विकसित करना

अभ्यास करते हैं!

LangChain के साथ LLM एप्लिकेशन विकसित करना

Preparing Video For Download...