langchain 0.2.19 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -9
- package/dist/agents/chat/index.cjs +1 -1
- package/dist/agents/chat/index.d.ts +1 -1
- package/dist/agents/chat/index.js +1 -1
- package/dist/agents/chat_convo/index.cjs +1 -1
- package/dist/agents/chat_convo/index.d.ts +1 -1
- package/dist/agents/chat_convo/index.js +1 -1
- package/dist/agents/mrkl/index.cjs +1 -1
- package/dist/agents/mrkl/index.d.ts +1 -1
- package/dist/agents/mrkl/index.js +1 -1
- package/dist/agents/openai_functions/index.cjs +3 -3
- package/dist/agents/openai_functions/index.d.ts +1 -1
- package/dist/agents/openai_functions/index.js +3 -3
- package/dist/agents/structured_chat/index.cjs +1 -1
- package/dist/agents/structured_chat/index.d.ts +1 -1
- package/dist/agents/structured_chat/index.js +1 -1
- package/dist/agents/xml/index.cjs +1 -1
- package/dist/agents/xml/index.d.ts +1 -1
- package/dist/agents/xml/index.js +1 -1
- package/dist/chains/combine_documents/stuff.cjs +2 -2
- package/dist/chains/combine_documents/stuff.js +2 -2
- package/dist/chains/load.cjs +1 -1
- package/dist/chains/load.d.ts +1 -1
- package/dist/chains/load.js +1 -1
- package/dist/chains/openai_functions/structured_output.cjs +2 -2
- package/dist/chains/openai_functions/structured_output.d.ts +2 -2
- package/dist/chains/openai_functions/structured_output.js +2 -2
- package/dist/chains/serde.d.ts +12 -12
- package/dist/experimental/plan_and_execute/agent_executor.cjs +1 -1
- package/dist/experimental/plan_and_execute/agent_executor.js +1 -1
- package/dist/load/import_constants.cjs +2 -39
- package/dist/load/import_constants.js +2 -39
- package/dist/load/import_map.cjs +2 -3
- package/dist/load/import_map.d.ts +0 -1
- package/dist/load/import_map.js +0 -1
- package/dist/output_parsers/openai_tools.cjs +2 -4
- package/dist/output_parsers/openai_tools.d.ts +8 -3
- package/dist/output_parsers/openai_tools.js +2 -4
- package/dist/retrievers/multi_query.d.ts +1 -0
- package/dist/smith/config.d.ts +1 -5
- package/package.json +31 -854
- package/dist/document_loaders/fs/chatgpt.cjs +0 -90
- package/dist/document_loaders/fs/chatgpt.d.ts +0 -8
- package/dist/document_loaders/fs/chatgpt.js +0 -86
- package/dist/document_loaders/fs/csv.cjs +0 -73
- package/dist/document_loaders/fs/csv.d.ts +0 -65
- package/dist/document_loaders/fs/csv.js +0 -69
- package/dist/document_loaders/fs/docx.cjs +0 -58
- package/dist/document_loaders/fs/docx.d.ts +0 -25
- package/dist/document_loaders/fs/docx.js +0 -54
- package/dist/document_loaders/fs/epub.cjs +0 -103
- package/dist/document_loaders/fs/epub.d.ts +0 -33
- package/dist/document_loaders/fs/epub.js +0 -99
- package/dist/document_loaders/fs/notion.cjs +0 -26
- package/dist/document_loaders/fs/notion.d.ts +0 -12
- package/dist/document_loaders/fs/notion.js +0 -22
- package/dist/document_loaders/fs/obsidian.cjs +0 -247
- package/dist/document_loaders/fs/obsidian.d.ts +0 -28
- package/dist/document_loaders/fs/obsidian.js +0 -240
- package/dist/document_loaders/fs/openai_whisper_audio.cjs +0 -49
- package/dist/document_loaders/fs/openai_whisper_audio.d.ts +0 -23
- package/dist/document_loaders/fs/openai_whisper_audio.js +0 -45
- package/dist/document_loaders/fs/pdf.cjs +0 -148
- package/dist/document_loaders/fs/pdf.d.ts +0 -49
- package/dist/document_loaders/fs/pdf.js +0 -144
- package/dist/document_loaders/fs/pptx.cjs +0 -46
- package/dist/document_loaders/fs/pptx.d.ts +0 -25
- package/dist/document_loaders/fs/pptx.js +0 -42
- package/dist/document_loaders/fs/srt.cjs +0 -57
- package/dist/document_loaders/fs/srt.d.ts +0 -32
- package/dist/document_loaders/fs/srt.js +0 -50
- package/dist/document_loaders/fs/unstructured.cjs +0 -338
- package/dist/document_loaders/fs/unstructured.d.ts +0 -125
- package/dist/document_loaders/fs/unstructured.js +0 -333
- package/dist/document_loaders/web/apify_dataset.cjs +0 -130
- package/dist/document_loaders/web/apify_dataset.d.ts +0 -85
- package/dist/document_loaders/web/apify_dataset.js +0 -126
- package/dist/document_loaders/web/assemblyai.cjs +0 -200
- package/dist/document_loaders/web/assemblyai.d.ts +0 -95
- package/dist/document_loaders/web/assemblyai.js +0 -193
- package/dist/document_loaders/web/azure_blob_storage_container.cjs +0 -73
- package/dist/document_loaders/web/azure_blob_storage_container.d.ts +0 -46
- package/dist/document_loaders/web/azure_blob_storage_container.js +0 -69
- package/dist/document_loaders/web/azure_blob_storage_file.cjs +0 -124
- package/dist/document_loaders/web/azure_blob_storage_file.d.ts +0 -53
- package/dist/document_loaders/web/azure_blob_storage_file.js +0 -97
- package/dist/document_loaders/web/browserbase.cjs +0 -93
- package/dist/document_loaders/web/browserbase.d.ts +0 -48
- package/dist/document_loaders/web/browserbase.js +0 -86
- package/dist/document_loaders/web/cheerio.cjs +0 -118
- package/dist/document_loaders/web/cheerio.d.ts +0 -77
- package/dist/document_loaders/web/cheerio.js +0 -114
- package/dist/document_loaders/web/college_confidential.cjs +0 -41
- package/dist/document_loaders/web/college_confidential.d.ts +0 -25
- package/dist/document_loaders/web/college_confidential.js +0 -37
- package/dist/document_loaders/web/confluence.cjs +0 -190
- package/dist/document_loaders/web/confluence.d.ts +0 -114
- package/dist/document_loaders/web/confluence.js +0 -186
- package/dist/document_loaders/web/couchbase.cjs +0 -95
- package/dist/document_loaders/web/couchbase.d.ts +0 -32
- package/dist/document_loaders/web/couchbase.js +0 -91
- package/dist/document_loaders/web/figma.cjs +0 -102
- package/dist/document_loaders/web/figma.d.ts +0 -82
- package/dist/document_loaders/web/figma.js +0 -98
- package/dist/document_loaders/web/firecrawl.cjs +0 -95
- package/dist/document_loaders/web/firecrawl.d.ts +0 -50
- package/dist/document_loaders/web/firecrawl.js +0 -88
- package/dist/document_loaders/web/gitbook.cjs +0 -110
- package/dist/document_loaders/web/gitbook.d.ts +0 -55
- package/dist/document_loaders/web/gitbook.js +0 -106
- package/dist/document_loaders/web/github.cjs +0 -615
- package/dist/document_loaders/web/github.d.ts +0 -203
- package/dist/document_loaders/web/github.js +0 -608
- package/dist/document_loaders/web/hn.cjs +0 -90
- package/dist/document_loaders/web/hn.d.ts +0 -42
- package/dist/document_loaders/web/hn.js +0 -86
- package/dist/document_loaders/web/imsdb.cjs +0 -44
- package/dist/document_loaders/web/imsdb.d.ts +0 -23
- package/dist/document_loaders/web/imsdb.js +0 -40
- package/dist/document_loaders/web/notionapi.cjs +0 -404
- package/dist/document_loaders/web/notionapi.d.ts +0 -133
- package/dist/document_loaders/web/notionapi.js +0 -392
- package/dist/document_loaders/web/notiondb.cjs +0 -199
- package/dist/document_loaders/web/notiondb.d.ts +0 -56
- package/dist/document_loaders/web/notiondb.js +0 -195
- package/dist/document_loaders/web/pdf.cjs +0 -140
- package/dist/document_loaders/web/pdf.d.ts +0 -35
- package/dist/document_loaders/web/pdf.js +0 -136
- package/dist/document_loaders/web/playwright.cjs +0 -89
- package/dist/document_loaders/web/playwright.d.ts +0 -58
- package/dist/document_loaders/web/playwright.js +0 -85
- package/dist/document_loaders/web/puppeteer.cjs +0 -139
- package/dist/document_loaders/web/puppeteer.d.ts +0 -82
- package/dist/document_loaders/web/puppeteer.js +0 -135
- package/dist/document_loaders/web/recursive_url.cjs +0 -198
- package/dist/document_loaders/web/recursive_url.d.ts +0 -33
- package/dist/document_loaders/web/recursive_url.js +0 -194
- package/dist/document_loaders/web/s3.cjs +0 -164
- package/dist/document_loaders/web/s3.d.ts +0 -78
- package/dist/document_loaders/web/s3.js +0 -137
- package/dist/document_loaders/web/searchapi.cjs +0 -150
- package/dist/document_loaders/web/searchapi.d.ts +0 -76
- package/dist/document_loaders/web/searchapi.js +0 -146
- package/dist/document_loaders/web/serpapi.cjs +0 -127
- package/dist/document_loaders/web/serpapi.d.ts +0 -62
- package/dist/document_loaders/web/serpapi.js +0 -123
- package/dist/document_loaders/web/sitemap.cjs +0 -118
- package/dist/document_loaders/web/sitemap.d.ts +0 -41
- package/dist/document_loaders/web/sitemap.js +0 -114
- package/dist/document_loaders/web/sonix_audio.cjs +0 -68
- package/dist/document_loaders/web/sonix_audio.d.ts +0 -36
- package/dist/document_loaders/web/sonix_audio.js +0 -64
- package/dist/document_loaders/web/sort_xyz_blockchain.cjs +0 -157
- package/dist/document_loaders/web/sort_xyz_blockchain.d.ts +0 -78
- package/dist/document_loaders/web/sort_xyz_blockchain.js +0 -153
- package/dist/document_loaders/web/youtube.cjs +0 -116
- package/dist/document_loaders/web/youtube.d.ts +0 -55
- package/dist/document_loaders/web/youtube.js +0 -112
- package/dist/experimental/tools/pyinterpreter.cjs +0 -248
- package/dist/experimental/tools/pyinterpreter.d.ts +0 -18
- package/dist/experimental/tools/pyinterpreter.js +0 -244
- package/dist/retrievers/self_query/chroma.cjs +0 -48
- package/dist/retrievers/self_query/chroma.d.ts +0 -26
- package/dist/retrievers/self_query/chroma.js +0 -44
- package/dist/retrievers/self_query/pinecone.cjs +0 -47
- package/dist/retrievers/self_query/pinecone.d.ts +0 -26
- package/dist/retrievers/self_query/pinecone.js +0 -43
- package/dist/retrievers/self_query/supabase.cjs +0 -278
- package/dist/retrievers/self_query/supabase.d.ts +0 -109
- package/dist/retrievers/self_query/supabase.js +0 -274
- package/dist/retrievers/self_query/supabase_utils.cjs +0 -264
- package/dist/retrievers/self_query/supabase_utils.d.ts +0 -101
- package/dist/retrievers/self_query/supabase_utils.js +0 -259
- package/dist/retrievers/self_query/vectara.cjs +0 -143
- package/dist/retrievers/self_query/vectara.d.ts +0 -42
- package/dist/retrievers/self_query/vectara.js +0 -139
- package/dist/retrievers/self_query/weaviate.cjs +0 -201
- package/dist/retrievers/self_query/weaviate.d.ts +0 -99
- package/dist/retrievers/self_query/weaviate.js +0 -197
- package/dist/types/assemblyai-types.cjs +0 -2
- package/dist/types/assemblyai-types.d.ts +0 -4
- package/dist/types/assemblyai-types.js +0 -1
- package/document_loaders/fs/chatgpt.cjs +0 -1
- package/document_loaders/fs/chatgpt.d.cts +0 -1
- package/document_loaders/fs/chatgpt.d.ts +0 -1
- package/document_loaders/fs/chatgpt.js +0 -1
- package/document_loaders/fs/csv.cjs +0 -1
- package/document_loaders/fs/csv.d.cts +0 -1
- package/document_loaders/fs/csv.d.ts +0 -1
- package/document_loaders/fs/csv.js +0 -1
- package/document_loaders/fs/docx.cjs +0 -1
- package/document_loaders/fs/docx.d.cts +0 -1
- package/document_loaders/fs/docx.d.ts +0 -1
- package/document_loaders/fs/docx.js +0 -1
- package/document_loaders/fs/epub.cjs +0 -1
- package/document_loaders/fs/epub.d.cts +0 -1
- package/document_loaders/fs/epub.d.ts +0 -1
- package/document_loaders/fs/epub.js +0 -1
- package/document_loaders/fs/notion.cjs +0 -1
- package/document_loaders/fs/notion.d.cts +0 -1
- package/document_loaders/fs/notion.d.ts +0 -1
- package/document_loaders/fs/notion.js +0 -1
- package/document_loaders/fs/obsidian.cjs +0 -1
- package/document_loaders/fs/obsidian.d.cts +0 -1
- package/document_loaders/fs/obsidian.d.ts +0 -1
- package/document_loaders/fs/obsidian.js +0 -1
- package/document_loaders/fs/openai_whisper_audio.cjs +0 -1
- package/document_loaders/fs/openai_whisper_audio.d.cts +0 -1
- package/document_loaders/fs/openai_whisper_audio.d.ts +0 -1
- package/document_loaders/fs/openai_whisper_audio.js +0 -1
- package/document_loaders/fs/pdf.cjs +0 -1
- package/document_loaders/fs/pdf.d.cts +0 -1
- package/document_loaders/fs/pdf.d.ts +0 -1
- package/document_loaders/fs/pdf.js +0 -1
- package/document_loaders/fs/pptx.cjs +0 -1
- package/document_loaders/fs/pptx.d.cts +0 -1
- package/document_loaders/fs/pptx.d.ts +0 -1
- package/document_loaders/fs/pptx.js +0 -1
- package/document_loaders/fs/srt.cjs +0 -1
- package/document_loaders/fs/srt.d.cts +0 -1
- package/document_loaders/fs/srt.d.ts +0 -1
- package/document_loaders/fs/srt.js +0 -1
- package/document_loaders/fs/unstructured.cjs +0 -1
- package/document_loaders/fs/unstructured.d.cts +0 -1
- package/document_loaders/fs/unstructured.d.ts +0 -1
- package/document_loaders/fs/unstructured.js +0 -1
- package/document_loaders/web/apify_dataset.cjs +0 -1
- package/document_loaders/web/apify_dataset.d.cts +0 -1
- package/document_loaders/web/apify_dataset.d.ts +0 -1
- package/document_loaders/web/apify_dataset.js +0 -1
- package/document_loaders/web/assemblyai.cjs +0 -1
- package/document_loaders/web/assemblyai.d.cts +0 -1
- package/document_loaders/web/assemblyai.d.ts +0 -1
- package/document_loaders/web/assemblyai.js +0 -1
- package/document_loaders/web/azure_blob_storage_container.cjs +0 -1
- package/document_loaders/web/azure_blob_storage_container.d.cts +0 -1
- package/document_loaders/web/azure_blob_storage_container.d.ts +0 -1
- package/document_loaders/web/azure_blob_storage_container.js +0 -1
- package/document_loaders/web/azure_blob_storage_file.cjs +0 -1
- package/document_loaders/web/azure_blob_storage_file.d.cts +0 -1
- package/document_loaders/web/azure_blob_storage_file.d.ts +0 -1
- package/document_loaders/web/azure_blob_storage_file.js +0 -1
- package/document_loaders/web/browserbase.cjs +0 -1
- package/document_loaders/web/browserbase.d.cts +0 -1
- package/document_loaders/web/browserbase.d.ts +0 -1
- package/document_loaders/web/browserbase.js +0 -1
- package/document_loaders/web/cheerio.cjs +0 -1
- package/document_loaders/web/cheerio.d.cts +0 -1
- package/document_loaders/web/cheerio.d.ts +0 -1
- package/document_loaders/web/cheerio.js +0 -1
- package/document_loaders/web/college_confidential.cjs +0 -1
- package/document_loaders/web/college_confidential.d.cts +0 -1
- package/document_loaders/web/college_confidential.d.ts +0 -1
- package/document_loaders/web/college_confidential.js +0 -1
- package/document_loaders/web/confluence.cjs +0 -1
- package/document_loaders/web/confluence.d.cts +0 -1
- package/document_loaders/web/confluence.d.ts +0 -1
- package/document_loaders/web/confluence.js +0 -1
- package/document_loaders/web/couchbase.cjs +0 -1
- package/document_loaders/web/couchbase.d.cts +0 -1
- package/document_loaders/web/couchbase.d.ts +0 -1
- package/document_loaders/web/couchbase.js +0 -1
- package/document_loaders/web/figma.cjs +0 -1
- package/document_loaders/web/figma.d.cts +0 -1
- package/document_loaders/web/figma.d.ts +0 -1
- package/document_loaders/web/figma.js +0 -1
- package/document_loaders/web/firecrawl.cjs +0 -1
- package/document_loaders/web/firecrawl.d.cts +0 -1
- package/document_loaders/web/firecrawl.d.ts +0 -1
- package/document_loaders/web/firecrawl.js +0 -1
- package/document_loaders/web/gitbook.cjs +0 -1
- package/document_loaders/web/gitbook.d.cts +0 -1
- package/document_loaders/web/gitbook.d.ts +0 -1
- package/document_loaders/web/gitbook.js +0 -1
- package/document_loaders/web/github.cjs +0 -1
- package/document_loaders/web/github.d.cts +0 -1
- package/document_loaders/web/github.d.ts +0 -1
- package/document_loaders/web/github.js +0 -1
- package/document_loaders/web/hn.cjs +0 -1
- package/document_loaders/web/hn.d.cts +0 -1
- package/document_loaders/web/hn.d.ts +0 -1
- package/document_loaders/web/hn.js +0 -1
- package/document_loaders/web/imsdb.cjs +0 -1
- package/document_loaders/web/imsdb.d.cts +0 -1
- package/document_loaders/web/imsdb.d.ts +0 -1
- package/document_loaders/web/imsdb.js +0 -1
- package/document_loaders/web/notionapi.cjs +0 -1
- package/document_loaders/web/notionapi.d.cts +0 -1
- package/document_loaders/web/notionapi.d.ts +0 -1
- package/document_loaders/web/notionapi.js +0 -1
- package/document_loaders/web/notiondb.cjs +0 -1
- package/document_loaders/web/notiondb.d.cts +0 -1
- package/document_loaders/web/notiondb.d.ts +0 -1
- package/document_loaders/web/notiondb.js +0 -1
- package/document_loaders/web/pdf.cjs +0 -1
- package/document_loaders/web/pdf.d.cts +0 -1
- package/document_loaders/web/pdf.d.ts +0 -1
- package/document_loaders/web/pdf.js +0 -1
- package/document_loaders/web/playwright.cjs +0 -1
- package/document_loaders/web/playwright.d.cts +0 -1
- package/document_loaders/web/playwright.d.ts +0 -1
- package/document_loaders/web/playwright.js +0 -1
- package/document_loaders/web/puppeteer.cjs +0 -1
- package/document_loaders/web/puppeteer.d.cts +0 -1
- package/document_loaders/web/puppeteer.d.ts +0 -1
- package/document_loaders/web/puppeteer.js +0 -1
- package/document_loaders/web/recursive_url.cjs +0 -1
- package/document_loaders/web/recursive_url.d.cts +0 -1
- package/document_loaders/web/recursive_url.d.ts +0 -1
- package/document_loaders/web/recursive_url.js +0 -1
- package/document_loaders/web/s3.cjs +0 -1
- package/document_loaders/web/s3.d.cts +0 -1
- package/document_loaders/web/s3.d.ts +0 -1
- package/document_loaders/web/s3.js +0 -1
- package/document_loaders/web/searchapi.cjs +0 -1
- package/document_loaders/web/searchapi.d.cts +0 -1
- package/document_loaders/web/searchapi.d.ts +0 -1
- package/document_loaders/web/searchapi.js +0 -1
- package/document_loaders/web/serpapi.cjs +0 -1
- package/document_loaders/web/serpapi.d.cts +0 -1
- package/document_loaders/web/serpapi.d.ts +0 -1
- package/document_loaders/web/serpapi.js +0 -1
- package/document_loaders/web/sitemap.cjs +0 -1
- package/document_loaders/web/sitemap.d.cts +0 -1
- package/document_loaders/web/sitemap.d.ts +0 -1
- package/document_loaders/web/sitemap.js +0 -1
- package/document_loaders/web/sonix_audio.cjs +0 -1
- package/document_loaders/web/sonix_audio.d.cts +0 -1
- package/document_loaders/web/sonix_audio.d.ts +0 -1
- package/document_loaders/web/sonix_audio.js +0 -1
- package/document_loaders/web/sort_xyz_blockchain.cjs +0 -1
- package/document_loaders/web/sort_xyz_blockchain.d.cts +0 -1
- package/document_loaders/web/sort_xyz_blockchain.d.ts +0 -1
- package/document_loaders/web/sort_xyz_blockchain.js +0 -1
- package/document_loaders/web/youtube.cjs +0 -1
- package/document_loaders/web/youtube.d.cts +0 -1
- package/document_loaders/web/youtube.d.ts +0 -1
- package/document_loaders/web/youtube.js +0 -1
- package/experimental/tools/pyinterpreter.cjs +0 -1
- package/experimental/tools/pyinterpreter.d.cts +0 -1
- package/experimental/tools/pyinterpreter.d.ts +0 -1
- package/experimental/tools/pyinterpreter.js +0 -1
- package/memory/index.cjs +0 -1
- package/memory/index.d.cts +0 -1
- package/memory/index.d.ts +0 -1
- package/memory/index.js +0 -1
- package/retrievers/self_query/chroma.cjs +0 -1
- package/retrievers/self_query/chroma.d.cts +0 -1
- package/retrievers/self_query/chroma.d.ts +0 -1
- package/retrievers/self_query/chroma.js +0 -1
- package/retrievers/self_query/pinecone.cjs +0 -1
- package/retrievers/self_query/pinecone.d.cts +0 -1
- package/retrievers/self_query/pinecone.d.ts +0 -1
- package/retrievers/self_query/pinecone.js +0 -1
- package/retrievers/self_query/supabase.cjs +0 -1
- package/retrievers/self_query/supabase.d.cts +0 -1
- package/retrievers/self_query/supabase.d.ts +0 -1
- package/retrievers/self_query/supabase.js +0 -1
- package/retrievers/self_query/vectara.cjs +0 -1
- package/retrievers/self_query/vectara.d.cts +0 -1
- package/retrievers/self_query/vectara.d.ts +0 -1
- package/retrievers/self_query/vectara.js +0 -1
- package/retrievers/self_query/weaviate.cjs +0 -1
- package/retrievers/self_query/weaviate.d.cts +0 -1
- package/retrievers/self_query/weaviate.d.ts +0 -1
- package/retrievers/self_query/weaviate.js +0 -1
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import srtParser2 from "srt-parser-2";
|
|
2
|
-
import { TextLoader } from "./text.js";
|
|
3
|
-
import { logVersion020MigrationWarning } from "../../util/entrypoint_deprecation.js";
|
|
4
|
-
/* #__PURE__ */ logVersion020MigrationWarning({
|
|
5
|
-
oldEntrypointName: "document_loaders/fs/srt",
|
|
6
|
-
newPackageName: "@langchain/community",
|
|
7
|
-
});
|
|
8
|
-
/**
|
|
9
|
-
* @deprecated - Import from "@langchain/community/document_loaders/fs/srt" instead. This entrypoint will be removed in 0.3.0.
|
|
10
|
-
*
|
|
11
|
-
* A class that extends the `TextLoader` class. It represents a document
|
|
12
|
-
* loader that loads documents from SRT (SubRip) subtitle files. It has a
|
|
13
|
-
* constructor that takes a `filePathOrBlob` parameter representing the
|
|
14
|
-
* path to the SRT file or a `Blob` object. The `parse()` method is
|
|
15
|
-
* implemented to parse the SRT file and extract the text content of each
|
|
16
|
-
* subtitle.
|
|
17
|
-
* @example
|
|
18
|
-
* ```typescript
|
|
19
|
-
* const loader = new SRTLoader("path/to/file.srt");
|
|
20
|
-
* const docs = await loader.load();
|
|
21
|
-
* console.log({ docs });
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
export class SRTLoader extends TextLoader {
|
|
25
|
-
constructor(filePathOrBlob) {
|
|
26
|
-
super(filePathOrBlob);
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* A protected method that takes a `raw` string as a parameter and returns
|
|
30
|
-
* a promise that resolves to an array of strings. It parses the raw SRT
|
|
31
|
-
* string using the `SRTParser2` class from the `srt-parser-2` module. It
|
|
32
|
-
* retrieves the subtitle objects from the parsed SRT data and extracts
|
|
33
|
-
* the text content from each subtitle object. It filters out any empty
|
|
34
|
-
* text content and joins the non-empty text content with a space
|
|
35
|
-
* separator.
|
|
36
|
-
* @param raw The raw SRT string to be parsed.
|
|
37
|
-
* @returns A promise that resolves to an array of strings representing the text content of each subtitle.
|
|
38
|
-
*/
|
|
39
|
-
async parse(raw) {
|
|
40
|
-
// eslint-disable-next-line new-cap
|
|
41
|
-
const parser = new srtParser2();
|
|
42
|
-
const srts = parser.fromSrt(raw);
|
|
43
|
-
return [
|
|
44
|
-
srts
|
|
45
|
-
.map((srt) => srt.text)
|
|
46
|
-
.filter(Boolean)
|
|
47
|
-
.join(" "),
|
|
48
|
-
];
|
|
49
|
-
}
|
|
50
|
-
}
|
|
@@ -1,338 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UnknownHandling = exports.UnstructuredDirectoryLoader = exports.UnstructuredLoader = void 0;
|
|
4
|
-
const documents_1 = require("@langchain/core/documents");
|
|
5
|
-
const env_1 = require("@langchain/core/utils/env");
|
|
6
|
-
const directory_js_1 = require("./directory.cjs");
|
|
7
|
-
Object.defineProperty(exports, "UnknownHandling", { enumerable: true, get: function () { return directory_js_1.UnknownHandling; } });
|
|
8
|
-
const base_js_1 = require("../base.cjs");
|
|
9
|
-
const entrypoint_deprecation_js_1 = require("../../util/entrypoint_deprecation.cjs");
|
|
10
|
-
/* #__PURE__ */ (0, entrypoint_deprecation_js_1.logVersion020MigrationWarning)({
|
|
11
|
-
oldEntrypointName: "document_loaders/fs/unstructured",
|
|
12
|
-
newPackageName: "@langchain/community",
|
|
13
|
-
});
|
|
14
|
-
const UNSTRUCTURED_API_FILETYPES = [
|
|
15
|
-
".txt",
|
|
16
|
-
".text",
|
|
17
|
-
".pdf",
|
|
18
|
-
".docx",
|
|
19
|
-
".doc",
|
|
20
|
-
".jpg",
|
|
21
|
-
".jpeg",
|
|
22
|
-
".eml",
|
|
23
|
-
".html",
|
|
24
|
-
".htm",
|
|
25
|
-
".md",
|
|
26
|
-
".pptx",
|
|
27
|
-
".ppt",
|
|
28
|
-
".msg",
|
|
29
|
-
".rtf",
|
|
30
|
-
".xlsx",
|
|
31
|
-
".xls",
|
|
32
|
-
".odt",
|
|
33
|
-
".epub",
|
|
34
|
-
];
|
|
35
|
-
/**
|
|
36
|
-
* @deprecated - Import from "@langchain/community/document_loaders/fs/unstructured" instead. This entrypoint will be removed in 0.3.0.
|
|
37
|
-
*
|
|
38
|
-
* A document loader that uses the Unstructured API to load unstructured
|
|
39
|
-
* documents. It supports both the new syntax with options object and the
|
|
40
|
-
* legacy syntax for backward compatibility. The load() method sends a
|
|
41
|
-
* partitioning request to the Unstructured API and retrieves the
|
|
42
|
-
* partitioned elements. It creates a Document instance for each element
|
|
43
|
-
* and returns an array of Document instances.
|
|
44
|
-
*/
|
|
45
|
-
class UnstructuredLoader extends base_js_1.BaseDocumentLoader {
|
|
46
|
-
constructor(filePathOrLegacyApiUrlOrMemoryBuffer, optionsOrLegacyFilePath = {}) {
|
|
47
|
-
super();
|
|
48
|
-
Object.defineProperty(this, "filePath", {
|
|
49
|
-
enumerable: true,
|
|
50
|
-
configurable: true,
|
|
51
|
-
writable: true,
|
|
52
|
-
value: void 0
|
|
53
|
-
});
|
|
54
|
-
Object.defineProperty(this, "buffer", {
|
|
55
|
-
enumerable: true,
|
|
56
|
-
configurable: true,
|
|
57
|
-
writable: true,
|
|
58
|
-
value: void 0
|
|
59
|
-
});
|
|
60
|
-
Object.defineProperty(this, "fileName", {
|
|
61
|
-
enumerable: true,
|
|
62
|
-
configurable: true,
|
|
63
|
-
writable: true,
|
|
64
|
-
value: void 0
|
|
65
|
-
});
|
|
66
|
-
Object.defineProperty(this, "apiUrl", {
|
|
67
|
-
enumerable: true,
|
|
68
|
-
configurable: true,
|
|
69
|
-
writable: true,
|
|
70
|
-
value: "https://api.unstructured.io/general/v0/general"
|
|
71
|
-
});
|
|
72
|
-
Object.defineProperty(this, "apiKey", {
|
|
73
|
-
enumerable: true,
|
|
74
|
-
configurable: true,
|
|
75
|
-
writable: true,
|
|
76
|
-
value: void 0
|
|
77
|
-
});
|
|
78
|
-
Object.defineProperty(this, "strategy", {
|
|
79
|
-
enumerable: true,
|
|
80
|
-
configurable: true,
|
|
81
|
-
writable: true,
|
|
82
|
-
value: "hi_res"
|
|
83
|
-
});
|
|
84
|
-
Object.defineProperty(this, "encoding", {
|
|
85
|
-
enumerable: true,
|
|
86
|
-
configurable: true,
|
|
87
|
-
writable: true,
|
|
88
|
-
value: void 0
|
|
89
|
-
});
|
|
90
|
-
Object.defineProperty(this, "ocrLanguages", {
|
|
91
|
-
enumerable: true,
|
|
92
|
-
configurable: true,
|
|
93
|
-
writable: true,
|
|
94
|
-
value: []
|
|
95
|
-
});
|
|
96
|
-
Object.defineProperty(this, "coordinates", {
|
|
97
|
-
enumerable: true,
|
|
98
|
-
configurable: true,
|
|
99
|
-
writable: true,
|
|
100
|
-
value: void 0
|
|
101
|
-
});
|
|
102
|
-
Object.defineProperty(this, "pdfInferTableStructure", {
|
|
103
|
-
enumerable: true,
|
|
104
|
-
configurable: true,
|
|
105
|
-
writable: true,
|
|
106
|
-
value: void 0
|
|
107
|
-
});
|
|
108
|
-
Object.defineProperty(this, "xmlKeepTags", {
|
|
109
|
-
enumerable: true,
|
|
110
|
-
configurable: true,
|
|
111
|
-
writable: true,
|
|
112
|
-
value: void 0
|
|
113
|
-
});
|
|
114
|
-
Object.defineProperty(this, "skipInferTableTypes", {
|
|
115
|
-
enumerable: true,
|
|
116
|
-
configurable: true,
|
|
117
|
-
writable: true,
|
|
118
|
-
value: void 0
|
|
119
|
-
});
|
|
120
|
-
Object.defineProperty(this, "hiResModelName", {
|
|
121
|
-
enumerable: true,
|
|
122
|
-
configurable: true,
|
|
123
|
-
writable: true,
|
|
124
|
-
value: void 0
|
|
125
|
-
});
|
|
126
|
-
Object.defineProperty(this, "includePageBreaks", {
|
|
127
|
-
enumerable: true,
|
|
128
|
-
configurable: true,
|
|
129
|
-
writable: true,
|
|
130
|
-
value: void 0
|
|
131
|
-
});
|
|
132
|
-
Object.defineProperty(this, "chunkingStrategy", {
|
|
133
|
-
enumerable: true,
|
|
134
|
-
configurable: true,
|
|
135
|
-
writable: true,
|
|
136
|
-
value: void 0
|
|
137
|
-
});
|
|
138
|
-
Object.defineProperty(this, "multiPageSections", {
|
|
139
|
-
enumerable: true,
|
|
140
|
-
configurable: true,
|
|
141
|
-
writable: true,
|
|
142
|
-
value: void 0
|
|
143
|
-
});
|
|
144
|
-
Object.defineProperty(this, "combineUnderNChars", {
|
|
145
|
-
enumerable: true,
|
|
146
|
-
configurable: true,
|
|
147
|
-
writable: true,
|
|
148
|
-
value: void 0
|
|
149
|
-
});
|
|
150
|
-
Object.defineProperty(this, "newAfterNChars", {
|
|
151
|
-
enumerable: true,
|
|
152
|
-
configurable: true,
|
|
153
|
-
writable: true,
|
|
154
|
-
value: void 0
|
|
155
|
-
});
|
|
156
|
-
Object.defineProperty(this, "maxCharacters", {
|
|
157
|
-
enumerable: true,
|
|
158
|
-
configurable: true,
|
|
159
|
-
writable: true,
|
|
160
|
-
value: void 0
|
|
161
|
-
});
|
|
162
|
-
// Temporary shim to avoid breaking existing users
|
|
163
|
-
// Remove when API keys are enforced by Unstructured and existing code will break anyway
|
|
164
|
-
const isLegacySyntax = typeof optionsOrLegacyFilePath === "string";
|
|
165
|
-
const isMemorySyntax = typeof filePathOrLegacyApiUrlOrMemoryBuffer === "object";
|
|
166
|
-
if (isMemorySyntax) {
|
|
167
|
-
this.buffer = filePathOrLegacyApiUrlOrMemoryBuffer.buffer;
|
|
168
|
-
this.fileName = filePathOrLegacyApiUrlOrMemoryBuffer.fileName;
|
|
169
|
-
}
|
|
170
|
-
else if (isLegacySyntax) {
|
|
171
|
-
this.filePath = optionsOrLegacyFilePath;
|
|
172
|
-
this.apiUrl = filePathOrLegacyApiUrlOrMemoryBuffer;
|
|
173
|
-
}
|
|
174
|
-
else {
|
|
175
|
-
this.filePath = filePathOrLegacyApiUrlOrMemoryBuffer;
|
|
176
|
-
}
|
|
177
|
-
if (!isLegacySyntax) {
|
|
178
|
-
const options = optionsOrLegacyFilePath;
|
|
179
|
-
this.apiKey = options.apiKey;
|
|
180
|
-
this.apiUrl = options.apiUrl ?? this.apiUrl;
|
|
181
|
-
this.strategy = options.strategy ?? this.strategy;
|
|
182
|
-
this.encoding = options.encoding;
|
|
183
|
-
this.ocrLanguages = options.ocrLanguages ?? this.ocrLanguages;
|
|
184
|
-
this.coordinates = options.coordinates;
|
|
185
|
-
this.pdfInferTableStructure = options.pdfInferTableStructure;
|
|
186
|
-
this.xmlKeepTags = options.xmlKeepTags;
|
|
187
|
-
this.skipInferTableTypes = options.skipInferTableTypes;
|
|
188
|
-
this.hiResModelName = options.hiResModelName;
|
|
189
|
-
this.includePageBreaks = options.includePageBreaks;
|
|
190
|
-
this.chunkingStrategy = options.chunkingStrategy;
|
|
191
|
-
this.multiPageSections = options.multiPageSections;
|
|
192
|
-
this.combineUnderNChars = options.combineUnderNChars;
|
|
193
|
-
this.newAfterNChars = options.newAfterNChars;
|
|
194
|
-
this.maxCharacters = options.maxCharacters;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
async _partition() {
|
|
198
|
-
let { buffer } = this;
|
|
199
|
-
let { fileName } = this;
|
|
200
|
-
if (!buffer) {
|
|
201
|
-
const { readFile, basename } = await this.imports();
|
|
202
|
-
buffer = await readFile(this.filePath);
|
|
203
|
-
fileName = basename(this.filePath);
|
|
204
|
-
// I'm aware this reads the file into memory first, but we have lots of work
|
|
205
|
-
// to do on then consuming Documents in a streaming fashion anyway, so not
|
|
206
|
-
// worried about this for now.
|
|
207
|
-
}
|
|
208
|
-
const formData = new FormData();
|
|
209
|
-
formData.append("files", new Blob([buffer]), fileName);
|
|
210
|
-
formData.append("strategy", this.strategy);
|
|
211
|
-
this.ocrLanguages.forEach((language) => {
|
|
212
|
-
formData.append("ocr_languages", language);
|
|
213
|
-
});
|
|
214
|
-
if (this.encoding) {
|
|
215
|
-
formData.append("encoding", this.encoding);
|
|
216
|
-
}
|
|
217
|
-
if (this.coordinates === true) {
|
|
218
|
-
formData.append("coordinates", "true");
|
|
219
|
-
}
|
|
220
|
-
if (this.pdfInferTableStructure === true) {
|
|
221
|
-
formData.append("pdf_infer_table_structure", "true");
|
|
222
|
-
}
|
|
223
|
-
if (this.xmlKeepTags === true) {
|
|
224
|
-
formData.append("xml_keep_tags", "true");
|
|
225
|
-
}
|
|
226
|
-
if (this.skipInferTableTypes) {
|
|
227
|
-
formData.append("skip_infer_table_types", JSON.stringify(this.skipInferTableTypes));
|
|
228
|
-
}
|
|
229
|
-
if (this.hiResModelName) {
|
|
230
|
-
formData.append("hi_res_model_name", this.hiResModelName);
|
|
231
|
-
}
|
|
232
|
-
if (this.includePageBreaks) {
|
|
233
|
-
formData.append("include_page_breaks", "true");
|
|
234
|
-
}
|
|
235
|
-
if (this.chunkingStrategy) {
|
|
236
|
-
formData.append("chunking_strategy", this.chunkingStrategy);
|
|
237
|
-
}
|
|
238
|
-
if (this.multiPageSections !== undefined) {
|
|
239
|
-
formData.append("multipage_sections", this.multiPageSections ? "true" : "false");
|
|
240
|
-
}
|
|
241
|
-
if (this.combineUnderNChars !== undefined) {
|
|
242
|
-
formData.append("combine_under_n_chars", String(this.combineUnderNChars));
|
|
243
|
-
}
|
|
244
|
-
if (this.newAfterNChars !== undefined) {
|
|
245
|
-
formData.append("new_after_n_chars", String(this.newAfterNChars));
|
|
246
|
-
}
|
|
247
|
-
if (this.maxCharacters !== undefined) {
|
|
248
|
-
formData.append("max_characters", String(this.maxCharacters));
|
|
249
|
-
}
|
|
250
|
-
const headers = {
|
|
251
|
-
"UNSTRUCTURED-API-KEY": this.apiKey ?? "",
|
|
252
|
-
};
|
|
253
|
-
const response = await fetch(this.apiUrl, {
|
|
254
|
-
method: "POST",
|
|
255
|
-
body: formData,
|
|
256
|
-
headers,
|
|
257
|
-
});
|
|
258
|
-
if (!response.ok) {
|
|
259
|
-
throw new Error(`Failed to partition file ${this.filePath} with error ${response.status} and message ${await response.text()}`);
|
|
260
|
-
}
|
|
261
|
-
const elements = await response.json();
|
|
262
|
-
if (!Array.isArray(elements)) {
|
|
263
|
-
throw new Error(`Expected partitioning request to return an array, but got ${elements}`);
|
|
264
|
-
}
|
|
265
|
-
return elements.filter((el) => typeof el.text === "string");
|
|
266
|
-
}
|
|
267
|
-
async load() {
|
|
268
|
-
const elements = await this._partition();
|
|
269
|
-
const documents = [];
|
|
270
|
-
for (const element of elements) {
|
|
271
|
-
const { metadata, text } = element;
|
|
272
|
-
if (typeof text === "string" && text !== "") {
|
|
273
|
-
documents.push(new documents_1.Document({
|
|
274
|
-
pageContent: text,
|
|
275
|
-
metadata: {
|
|
276
|
-
...metadata,
|
|
277
|
-
category: element.type,
|
|
278
|
-
},
|
|
279
|
-
}));
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
return documents;
|
|
283
|
-
}
|
|
284
|
-
async imports() {
|
|
285
|
-
try {
|
|
286
|
-
const { readFile } = await import("node:fs/promises");
|
|
287
|
-
const { basename } = await import("node:path");
|
|
288
|
-
return { readFile, basename };
|
|
289
|
-
}
|
|
290
|
-
catch (e) {
|
|
291
|
-
console.error(e);
|
|
292
|
-
throw new Error(`Failed to load fs/promises. TextLoader available only on environment 'node'. It appears you are running environment '${(0, env_1.getEnv)()}'. See https://<link to docs> for alternatives.`);
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
exports.UnstructuredLoader = UnstructuredLoader;
|
|
297
|
-
/**
|
|
298
|
-
* A document loader that loads unstructured documents from a directory
|
|
299
|
-
* using the UnstructuredLoader. It creates a UnstructuredLoader instance
|
|
300
|
-
* for each supported file type and passes it to the DirectoryLoader
|
|
301
|
-
* constructor.
|
|
302
|
-
* @example
|
|
303
|
-
* ```typescript
|
|
304
|
-
* const loader = new UnstructuredDirectoryLoader("path/to/directory", {
|
|
305
|
-
* apiKey: "MY_API_KEY",
|
|
306
|
-
* });
|
|
307
|
-
* const docs = await loader.load();
|
|
308
|
-
* ```
|
|
309
|
-
*/
|
|
310
|
-
class UnstructuredDirectoryLoader extends directory_js_1.DirectoryLoader {
|
|
311
|
-
constructor(directoryPathOrLegacyApiUrl, optionsOrLegacyDirectoryPath, legacyOptionRecursive = true, legacyOptionUnknown = directory_js_1.UnknownHandling.Warn) {
|
|
312
|
-
let directoryPath;
|
|
313
|
-
let options;
|
|
314
|
-
// Temporary shim to avoid breaking existing users
|
|
315
|
-
// Remove when API keys are enforced by Unstructured and existing code will break anyway
|
|
316
|
-
const isLegacySyntax = typeof optionsOrLegacyDirectoryPath === "string";
|
|
317
|
-
if (isLegacySyntax) {
|
|
318
|
-
directoryPath = optionsOrLegacyDirectoryPath;
|
|
319
|
-
options = {
|
|
320
|
-
apiUrl: directoryPathOrLegacyApiUrl,
|
|
321
|
-
recursive: legacyOptionRecursive,
|
|
322
|
-
unknown: legacyOptionUnknown,
|
|
323
|
-
};
|
|
324
|
-
}
|
|
325
|
-
else {
|
|
326
|
-
directoryPath = directoryPathOrLegacyApiUrl;
|
|
327
|
-
options = optionsOrLegacyDirectoryPath;
|
|
328
|
-
}
|
|
329
|
-
const loader = (p) => new UnstructuredLoader(p, options);
|
|
330
|
-
const loaders = UNSTRUCTURED_API_FILETYPES.reduce((loadersObject, filetype) => {
|
|
331
|
-
// eslint-disable-next-line no-param-reassign
|
|
332
|
-
loadersObject[filetype] = loader;
|
|
333
|
-
return loadersObject;
|
|
334
|
-
}, {});
|
|
335
|
-
super(directoryPath, loaders, options.recursive, options.unknown);
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
exports.UnstructuredDirectoryLoader = UnstructuredDirectoryLoader;
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
4
|
-
import type { basename as BasenameT } from "node:path";
|
|
5
|
-
import type { readFile as ReadFileT } from "node:fs/promises";
|
|
6
|
-
import { Document } from "@langchain/core/documents";
|
|
7
|
-
import { StringWithAutocomplete } from "@langchain/core/utils/types";
|
|
8
|
-
import { DirectoryLoader, UnknownHandling } from "./directory.js";
|
|
9
|
-
import { BaseDocumentLoader } from "../base.js";
|
|
10
|
-
/**
|
|
11
|
-
* Represents an element returned by the Unstructured API. It has
|
|
12
|
-
* properties for the element type, text content, and metadata.
|
|
13
|
-
*/
|
|
14
|
-
type Element = {
|
|
15
|
-
type: string;
|
|
16
|
-
text: string;
|
|
17
|
-
metadata: {
|
|
18
|
-
[key: string]: unknown;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Represents the available strategies for the UnstructuredLoader. It can
|
|
23
|
-
* be one of "hi_res", "fast", "ocr_only", or "auto".
|
|
24
|
-
*/
|
|
25
|
-
export type UnstructuredLoaderStrategy = "hi_res" | "fast" | "ocr_only" | "auto";
|
|
26
|
-
/**
|
|
27
|
-
* Represents the available hi-res models for the UnstructuredLoader. It can
|
|
28
|
-
* be one of "chipper".
|
|
29
|
-
*/
|
|
30
|
-
export type HiResModelName = "chipper";
|
|
31
|
-
/**
|
|
32
|
-
* To enable or disable table extraction for file types other than PDF, set
|
|
33
|
-
* the skipInferTableTypes property in the UnstructuredLoaderOptions object.
|
|
34
|
-
* The skipInferTableTypes property is an array of file types for which table
|
|
35
|
-
* extraction is disabled. For example, to disable table extraction for .docx
|
|
36
|
-
* and .doc files, set the skipInferTableTypes property to ["docx", "doc"].
|
|
37
|
-
* You can also disable table extraction for all file types other than PDF by
|
|
38
|
-
* setting the skipInferTableTypes property to [].
|
|
39
|
-
*/
|
|
40
|
-
export type SkipInferTableTypes = "txt" | "text" | "pdf" | "docx" | "doc" | "jpg" | "jpeg" | "eml" | "html" | "htm" | "md" | "pptx" | "ppt" | "msg" | "rtf" | "xlsx" | "xls" | "odt" | "epub";
|
|
41
|
-
/**
|
|
42
|
-
* Set the chunking_strategy to chunk text into larger or smaller elements. Defaults to None with optional arg of by_title
|
|
43
|
-
*/
|
|
44
|
-
type ChunkingStrategy = "None" | "by_title";
|
|
45
|
-
export type UnstructuredLoaderOptions = {
|
|
46
|
-
apiKey?: string;
|
|
47
|
-
apiUrl?: string;
|
|
48
|
-
strategy?: StringWithAutocomplete<UnstructuredLoaderStrategy>;
|
|
49
|
-
encoding?: string;
|
|
50
|
-
ocrLanguages?: Array<string>;
|
|
51
|
-
coordinates?: boolean;
|
|
52
|
-
pdfInferTableStructure?: boolean;
|
|
53
|
-
xmlKeepTags?: boolean;
|
|
54
|
-
skipInferTableTypes?: Array<StringWithAutocomplete<SkipInferTableTypes>>;
|
|
55
|
-
hiResModelName?: StringWithAutocomplete<HiResModelName>;
|
|
56
|
-
includePageBreaks?: boolean;
|
|
57
|
-
chunkingStrategy?: StringWithAutocomplete<ChunkingStrategy>;
|
|
58
|
-
multiPageSections?: boolean;
|
|
59
|
-
combineUnderNChars?: number;
|
|
60
|
-
newAfterNChars?: number;
|
|
61
|
-
maxCharacters?: number;
|
|
62
|
-
};
|
|
63
|
-
type UnstructuredDirectoryLoaderOptions = UnstructuredLoaderOptions & {
|
|
64
|
-
recursive?: boolean;
|
|
65
|
-
unknown?: UnknownHandling;
|
|
66
|
-
};
|
|
67
|
-
type UnstructuredMemoryLoaderOptions = {
|
|
68
|
-
buffer: Buffer;
|
|
69
|
-
fileName: string;
|
|
70
|
-
};
|
|
71
|
-
/**
|
|
72
|
-
* @deprecated - Import from "@langchain/community/document_loaders/fs/unstructured" instead. This entrypoint will be removed in 0.3.0.
|
|
73
|
-
*
|
|
74
|
-
* A document loader that uses the Unstructured API to load unstructured
|
|
75
|
-
* documents. It supports both the new syntax with options object and the
|
|
76
|
-
* legacy syntax for backward compatibility. The load() method sends a
|
|
77
|
-
* partitioning request to the Unstructured API and retrieves the
|
|
78
|
-
* partitioned elements. It creates a Document instance for each element
|
|
79
|
-
* and returns an array of Document instances.
|
|
80
|
-
*/
|
|
81
|
-
export declare class UnstructuredLoader extends BaseDocumentLoader {
|
|
82
|
-
filePath: string;
|
|
83
|
-
private buffer?;
|
|
84
|
-
private fileName?;
|
|
85
|
-
private apiUrl;
|
|
86
|
-
private apiKey?;
|
|
87
|
-
private strategy;
|
|
88
|
-
private encoding?;
|
|
89
|
-
private ocrLanguages;
|
|
90
|
-
private coordinates?;
|
|
91
|
-
private pdfInferTableStructure?;
|
|
92
|
-
private xmlKeepTags?;
|
|
93
|
-
private skipInferTableTypes?;
|
|
94
|
-
private hiResModelName?;
|
|
95
|
-
private includePageBreaks?;
|
|
96
|
-
private chunkingStrategy?;
|
|
97
|
-
private multiPageSections?;
|
|
98
|
-
private combineUnderNChars?;
|
|
99
|
-
private newAfterNChars?;
|
|
100
|
-
private maxCharacters?;
|
|
101
|
-
constructor(filePathOrLegacyApiUrlOrMemoryBuffer: string | UnstructuredMemoryLoaderOptions, optionsOrLegacyFilePath?: UnstructuredLoaderOptions | string);
|
|
102
|
-
_partition(): Promise<Element[]>;
|
|
103
|
-
load(): Promise<Document[]>;
|
|
104
|
-
imports(): Promise<{
|
|
105
|
-
readFile: typeof ReadFileT;
|
|
106
|
-
basename: typeof BasenameT;
|
|
107
|
-
}>;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* A document loader that loads unstructured documents from a directory
|
|
111
|
-
* using the UnstructuredLoader. It creates a UnstructuredLoader instance
|
|
112
|
-
* for each supported file type and passes it to the DirectoryLoader
|
|
113
|
-
* constructor.
|
|
114
|
-
* @example
|
|
115
|
-
* ```typescript
|
|
116
|
-
* const loader = new UnstructuredDirectoryLoader("path/to/directory", {
|
|
117
|
-
* apiKey: "MY_API_KEY",
|
|
118
|
-
* });
|
|
119
|
-
* const docs = await loader.load();
|
|
120
|
-
* ```
|
|
121
|
-
*/
|
|
122
|
-
export declare class UnstructuredDirectoryLoader extends DirectoryLoader {
|
|
123
|
-
constructor(directoryPathOrLegacyApiUrl: string, optionsOrLegacyDirectoryPath: UnstructuredDirectoryLoaderOptions | string, legacyOptionRecursive?: boolean, legacyOptionUnknown?: UnknownHandling);
|
|
124
|
-
}
|
|
125
|
-
export { UnknownHandling };
|