id
stringlengths
14
15
text
stringlengths
27
2.12k
source
stringlengths
49
118
ae2226ba3bde-19
<span style="color: #7f7f7f; text-decoration-color: #7f7f7f">81 </span><span style="color: #7f7f7f; text-decoration-color: #7f7f7f">│ │ │ │ │ │ </span><span style="color: #0000ff; text-decoration-color: #0000ff">if</span> <span style="color: #00ffff; text-decoration-color: #00ffff">self</span>.s...
https://python.langchain.com/docs/modules/data_connection/document_loaders/file_directory
ae2226ba3bde-20
#800000; text-decoration-color: #800000">│</span><span style="color: #800000; text-decoration-color: #800000">│</span> <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">83 </span><span style="color: #7f7f7f; text-decoration-color: #7f7f7f">│ │ │ │ │ │ </span><span style="color: ...
https://python.langchain.com/docs/modules/data_connection/document_loaders/file_directory
ae2226ba3bde-21
<span style="color: #800000; text-decoration-color: #800000">│</span><span style="color: #800000; text-decoration-color: #800000">│</span> <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">85 </span><span style="color: #7f7f7f; text-decoration-color: #7f7f7f">│ │ │ │ │ </span><span ...
https://python.langchain.com/docs/modules/data_connection/document_loaders/file_directory
ae2226ba3bde-22
│ │ │ │ │ </span><span style="color: #0000ff; text-decoration-color: #0000ff">if</span> pbar: <span style="color: #800000; text-decoration-color: #800000">│</span><span style="color: #800000; text-decoration-color: #800000">│</span> <s...
https://python.langchain.com/docs/modules/data_connection/document_loaders/file_directory
ae2226ba3bde-23
<span style="color: #800000; text-decoration-color: #800000">│</span><span style="color: #800000; text-decoration-color: #800000">│</span> <span style="color: #bfbf7f; text-decoration-color: #bfbf7f">/data/source/langchain/langchain/document_loaders/</span><span style="color: #808000; text-decoration-color: #808000...
https://python.langchain.com/docs/modules/data_connection/document_loaders/file_directory
ae2226ba3bde-24
<span style="color: #800000; text-decoration-color: #800000">│</span><span style="color: #800000; text-decoration-color: #800000">│</span> <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">75 </span><span style="color: #7f7f7f; text-decoration-color: #7f7f7f">│ │ │ </span><span style="color...
https://python.langchain.com/docs/modules/data_connection/document_loaders/file_directory
ae2226ba3bde-25
</span><span style="color: #0000ff; text-decoration-color: #0000ff">if</span> _is_visible(i.relative_to(p)) <span style="color: #ff00ff; text-decoration-color: #ff00ff">or</span> <span style="color: #00ffff; text-decoration-color: #00ffff">self</span>.load_hidden: <span style="color: #800000; text...
https://python.langchain.com/docs/modules/data_connection/document_loaders/file_directory
ae2226ba3bde-26
style="color: #800000; text-decoration-color: #800000">� </span>78 <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">│ │ │ │ │ │ </span>sub_docs = <span style="color: #00ffff; text-decoration-color: #00ffff">self</span>.loader_cls(<span style="color: #00ffff; text-decoration-color: ...
https://python.langchain.com/docs/modules/data_connection/document_loaders/file_directory
ae2226ba3bde-27
#800000; text-decoration-color: #800000">│</span> <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">80 </span><span style="color: #7f7f7f; text-decoration-color: #7f7f7f">│ │ │ │ │ </span><span style="color: #0000ff; text-decoration-color: #0000ff">except</span> <span style="color: #0...
https://python.langchain.com/docs/modules/data_connection/document_loaders/file_directory
ae2226ba3bde-28
<span style="color: #00ffff; text-decoration-color: #00ffff">self</span>.silent_errors: <span style="color: #800000; text-decoration-color: #800000">│</span><span style="color: #800000; text-decoration-color: #800000">│</span> ...
https://python.langchain.com/docs/modules/data_connection/document_loaders/file_directory
ae2226ba3bde-29
<span style="color: #800000; text-decoration-color: #800000">│</span><span style="color: #800000; text-decoration-color: #800000">│</span> <span style="color: #800000; text-decoration-color: #800000">│</span><span sty...
https://python.langchain.com/docs/modules/data_connection/document_loaders/file_directory
ae2226ba3bde-30
<span style="color: #800000; text-decoration-color: #800000">│</span><span style="color: #800000; text-decoration-color: #800000">│</span> <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">42 </span><span style="color: #7f7f7f; text-decoration-color: #7f7f7f">│ │ │ │ │ │ │ <...
https://python.langchain.com/docs/modules/data_connection/document_loaders/file_directory
ae2226ba3bde-31
<span style="color: #800000; text-decoration-color: #800000">│</span><span style="color: #800000; text-decoration-color: #800000">│</span> <span style="color: #800000; text-decoration-color: #800000">� </span>44 <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">│ │ │ │ │ </span><spa...
https://python.langchain.com/docs/modules/data_connection/document_loaders/file_directory
ae2226ba3bde-32
#800000; text-decoration-color: #800000">│</span><span style="color: #800000; text-decoration-color: #800000">│</span> <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">45 </span><span style="color: #7f7f7f; text-decoration-color: #7f7f7f">│ │ │ </span><span style="color: #0000ff; text-deco...
https://python.langchain.com/docs/modules/data_connection/document_loaders/file_directory
ae2226ba3bde-33
text-decoration-color: #0000ff">raise</span> <span style="color: #00ffff; text-decoration-color: #00ffff">RuntimeError</span>(<span style="color: #808000; text-decoration-color: #808000">f"Error loading {</span><span style="color: #00ffff; text-decoration-color: #00ffff">self</span>.file_path<span style="color: #808000...
https://python.langchain.com/docs/modules/data_connection/document_loaders/file_directory
ae2226ba3bde-34
style="color: #800000; text-decoration-color: #800000">╰───────────────────────────────────────────────────────────────────────────────────────â...
https://python.langchain.com/docs/modules/data_connection/document_loaders/file_directory
ae2226ba3bde-35
style="color: #ff00ff; text-decoration-color: #ff00ff">example-non-utf8.txt</span></pre>The file example-non-utf8.txt uses a different encoding the load() function fails with a helpful message indicating which file failed decoding. With the default behavior of TextLoader any failure to load any of the documents will fa...
https://python.langchain.com/docs/modules/data_connection/document_loaders/file_directory
e11d3849689b-0
PDF | 🦜�🔗 Langchain
https://python.langchain.com/docs/modules/data_connection/document_loaders/pdf
e11d3849689b-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionDocument loadersCSVFile DirectoryHTMLJSONMarkdownPDFDocument transformersText embedding modelsVector storesRetrieversChainsMemoryAgentsCallbacksModu...
https://python.langchain.com/docs/modules/data_connection/document_loaders/pdf
e11d3849689b-2
application of neural networks. Ideally, research\noutcomes could be easily deployed in production and extended for further\ninvestigation. However, various factors like loosely organized codebases\nand sophisticated model con\x0cgurations complicate the easy reuse of im-\nportant innovations by a wide audience. Though...
https://python.langchain.com/docs/modules/data_connection/document_loaders/pdf
e11d3849689b-3
Jun 2021', metadata={'source': 'example_data/layout-parser-paper.pdf', 'page': 0})An advantage of this approach is that documents can be retrieved with page numbers.We want to use OpenAIEmbeddings so we have to get the OpenAI API Key.import osimport getpassos.environ['OPENAI_API_KEY'] = getpass.getpass('OpenAI API Key:...
https://python.langchain.com/docs/modules/data_connection/document_loaders/pdf
e11d3849689b-4
or age & VisualizationLa y ouUsing MathPix​Inspired by Daniel Gross's https://gist.github.com/danielgross/3ab4104e14faccc12b49200843adab21from langchain.document_loaders import MathpixPDFLoaderloader = MathpixPDFLoader("example_data/layout-parser-paper.pdf")data = loader.load()Using Unstructured​from langchain.docu...
https://python.langchain.com/docs/modules/data_connection/document_loaders/pdf
e11d3849689b-5
complicate the easy reuse of im-\nportant innovations by a wide audience. Though there have been on-going\nefforts to improve reusability and simplify deep learning (DL) model\ndevelopment in disciplines like natural language processing and computer\nvision, none of them are optimized for challenges in the domain of D...
https://python.langchain.com/docs/modules/data_connection/document_loaders/pdf
e11d3849689b-6
'title': '', 'author': '', 'subject': '', 'keywords': '', 'creator': 'LaTeX with hyperref', 'producer': 'pdfTeX-1.40.21', 'creationDate': 'D:20210622012710Z', 'modDate': 'D:20210622012710Z', 'trapped': '', 'encryption': None}, lookup_index=0)Fetching remote PDFs using Unstructured​This covers how to load online pdfs ...
https://python.langchain.com/docs/modules/data_connection/document_loaders/pdf
e11d3849689b-7
duality is a rational linear combination of fundamental classes of algebraic subvarieties of X . The proof of the above-mentioned result relies, for p ≠ d + 1 − s , on a Lefschetz\n\nKeywords: (1,1)- Lefschetz theorem, Hodge conjecture, toric varieties, complete intersection Email: wmontoya@ime.unicamp.br\n\ntheore...
https://python.langchain.com/docs/modules/data_connection/document_loaders/pdf
e11d3849689b-8
k e k } . • The generators e i are integral if for every i and any nonnegative rational number µ the product µe i is in N only if µ is an integer. • Given two rational simplicial cones σ , σ ′ one says that σ ′ is a face of σ ( σ ′ < σ ) if the set of integral generators of σ ′ is a subset of the ...
https://python.langchain.com/docs/modules/data_connection/document_loaders/pdf
e11d3849689b-9
the torus action on P d Σ . We denote by Σ ( i ) the i -dimensional cones\n\nFor a cone σ ∈ Σ, ˆ σ is the set of 1-dimensional cone in Σ that are not contained in σ\n\nand x ˆ σ ∶ = � � ∈ ˆ σ x � is the associated monomial in S .\n\nDe�nition 2.2. The irrelevant ideal of P d Σ is the monomial i...
https://python.langchain.com/docs/modules/data_connection/document_loaders/pdf
e11d3849689b-10
C d / G , for �nite sub- groups G ⊂ Gl ( d, C ) .\n\nDe�nition 2.5. A differential form on a complex orbifold Z is de�ned locally at z ∈ Z as a G -invariant differential form on C d where G ⊂ Gl ( d, C ) and Z is locally isomorphic to d\n\nRoughly speaking the local geometry of orbifolds reduces to local ...
https://python.langchain.com/docs/modules/data_connection/document_loaders/pdf
e11d3849689b-11
subvarieties are suborbifolds of P d Σ in the sense of Satake in [8]. Intuitively speaking they are subvarieties whose only singularities come from the ambient\n\nProof. From the exponential short exact sequence\n\nwe have a long exact sequence in cohomology\n\nH 1 (O ∗ X ) → H 2 ( X, Z ) → H 2 (O X ) ≃ H 0 , ...
https://python.langchain.com/docs/modules/data_connection/document_loaders/pdf
e11d3849689b-12
morphism and since it is a morphism of Hodge structures, we have:\n\nH 1 , 1 ( X, Q ) ≃ H dim X − 1 , dim X − 1 ( X, Q )\n\nCorollary 3.6. If the dimension of X is 1 , 2 or 3 . The Hodge conjecture holds on X\n\nProof. If the dim C X = 1 the result is clear by the Hard Lefschetz theorem for projective orbifolds. ...
https://python.langchain.com/docs/modules/data_connection/document_loaders/pdf
e11d3849689b-13
i ] we relate the hypersurface Y cut off by F = y 1 f 1 + ⋅ ⋅ ⋅ + y s f s which turns out to be quasi-smooth. For more details see Section 2 in [7].\n\nWe will denote P ( E ) as P d + s − 1 Σ ,X to keep track of its relation with X and P d Σ .\n\nThe following is a key remark.\n\nRemark 4.1 . There is a morp...
https://python.langchain.com/docs/modules/data_connection/document_loaders/pdf
e11d3849689b-14
cohomology of H d − s prim ( X ) is the quotient H d − s ( X, C )/ i ∗ ( H d − s ( P d Σ , C )) and H d − s prim ( X, Q ) with rational coefficients.\n\nH d − s ( P d Σ , C ) and H d − s ( X, C ) have pure Hodge structures, and the morphism i ∗ is com- patible with them, so that H d − s prim ( X ) g...
https://python.langchain.com/docs/modules/data_connection/document_loaders/pdf
e11d3849689b-15
⊂ P 2 k + 1 Σ ,X be the quasi-smooth hypersurface associated to the quasi-smooth intersection surface X = X f 1 ∩ ⋅ ⋅ ⋅ ∩ X f k ⊂ P k + 2 Σ . Then on Y the Hodge conjecture holds.\n\nthe Hodge conjecture holds.\n\nProof. If H k,k prim ( X, Q ) = 0 we are done. So let us assume H k,k prim ( X, Q ) ≠ 0....
https://python.langchain.com/docs/modules/data_connection/document_loaders/pdf
e11d3849689b-16
Cl ( P 2 k + 1 Σ ,X ) . So the polynomials de�ning C i ⊂ P k + 2 Σ can be interpreted in P 2 k + 1 X, Σ but with different degree. Moreover, by Remark 4.1 each C i is contained in Y = { F = y 1 f 1 + ⋯ + y k f k = 0 } and\n\nfurthermore it has codimension k .\n\nClaim: { C i } ni = 1 is a basis of prim ( ) . ...
https://python.langchain.com/docs/modules/data_connection/document_loaders/pdf
e11d3849689b-17
2 Σ where π ∶ ( x, y ) ↦ x . Hence [ π ( V ) ∩ X ] = [ C j ] which is equivalent to say that λ C j comes from P k + 2 Σ which contradicts the choice of [ C j ] .\n\nRemark 5.2 . Into the proof of the previous theorem, the key fact was that on X the Hodge conjecture holds and we translate it to Y by contradic...
https://python.langchain.com/docs/modules/data_connection/document_loaders/pdf
e11d3849689b-18
D. A. On the Hodge structure of projective hypersur- faces in toric varieties. Duke Mathematical Journal\n\n,\n\n(Aug\n\n). [\n\n] Bruzzo, U., and Montoya, W. On the Hodge conjecture for quasi-smooth in- tersections in toric varieties. SËœao Paulo J. Math. Sci. Special Section: Geometry in Algebra and Algebra in Geomet...
https://python.langchain.com/docs/modules/data_connection/document_loaders/pdf
e11d3849689b-19
Advanced Mathematics . Cambridge University Press,\n\n[\n\n] Wang, Z. Z., and Zaffran, D. A remark on the Hard Lefschetz theorem for K¨ahler orbifolds. Proceedings of the American Mathematical Society\n\n,\n\n(Aug\n\n).\n\n[2] Batyrev, V. V., and Cox, D. A. On the Hodge structure of projective hypersur- faces in toric...
https://python.langchain.com/docs/modules/data_connection/document_loaders/pdf
e11d3849689b-20
= loader.load()Using PDFMiner to generate HTML text​This can be helpful for chunking texts semantically into sections as the output html content can be parsed via BeautifulSoup to get more structured and rich information about font size, page numbers, pdf headers/footers, etc.from langchain.document_loaders import PD...
https://python.langchain.com/docs/modules/data_connection/document_loaders/pdf
e11d3849689b-21
a PDF appear on multiple pages so if we find duplicatess safe to assume that it is redundant info)from langchain.docstore.document import Documentcur_idx = -1semantic_snippets = []# Assumption: headings have higher font size than their respective contentfor s in snippets: # if current snippet's font size > previous ...
https://python.langchain.com/docs/modules/data_connection/document_loaders/pdf
e11d3849689b-22
title of a pdf will have the highest font size but we don't want it to subsume all sections) metadata={'heading':s[0], 'content_font': 0, 'heading_font': s[1]} metadata.update(data.metadata) semantic_snippets.append(Document(page_content='',metadata=metadata)) cur_idx += 1semantic_snippets[4] Document(pa...
https://python.langchain.com/docs/modules/data_connection/document_loaders/pdf
e11d3849689b-23
are individual deep learning models trained on\nlayout analysis datasets without support for the full DIA pipeline. The Document\nAnalysis and Exploitation (DAE) platform [15] and the DeepDIVA project [2]\naim to improve the reproducibility of DIA methods (or DL models), yet they\nare not actively maintained. OCR engin...
https://python.langchain.com/docs/modules/data_connection/document_loaders/pdf
e11d3849689b-24
collection of detailed documentation, tutorials and exemplar projects make\nLayoutParser easy to learn and use.\nAllenNLP [8] and transformers [34] have provided the community with complete\nDL-based support for developing and deploying models for general computer\nvision and natural language processing problems. Layou...
https://python.langchain.com/docs/modules/data_connection/document_loaders/pdf
e11d3849689b-25
for Deep\nLearning Based Document Image Analysis\nZejiang Shen1 (�), Ruochen Zhang2, Melissa Dell3, Benjamin Charles Germain\nLee4, Jacob Carlson3, and Weining Li5\n1 Allen Institute for AI\nshannons@allenai.org\n2 Brown University\nruochen zhang@brown.edu\n3 Harvard University\n{melissadell,jacob carlson}@fas.harvar...
https://python.langchain.com/docs/modules/data_connection/document_loaders/pdf
e11d3849689b-26
digiti-\nzation pipelines. We demonstrate that LayoutParser is helpful for both\nlightweight and large-scale digitization pipelines in real-word use cases.\nThe library is publicly available at https://layout-parser.github.io.\nKeywords: Document Image Analysis · Deep Learning · Layout Analysis\n· Character Recognit...
https://python.langchain.com/docs/modules/data_connection/document_loaders/pdf
e11d3849689b-27
PDFPlumberLoaderloader = PDFPlumberLoader("example_data/layout-parser-paper.pdf")data = loader.load()data[0] Document(page_content='LayoutParser: A Unified Toolkit for Deep\nLearning Based Document Image Analysis\nZejiang Shen1 ((cid:0)), Ruochen Zhang2, Melissa Dell3, Benjamin Charles Germain\nLee4, Jacob Carlson3,...
https://python.langchain.com/docs/modules/data_connection/document_loaders/pdf
e11d3849689b-28
research and applica-\ntions. The core LayoutParser library comes with a set of simple and\nintuitiveinterfacesforapplyingandcustomizingDLmodelsforlayoutde-\ntection,characterrecognition,andmanyotherdocumentprocessingtasks.\nTo promote extensibility, LayoutParser also incorporates a community\nplatform for sharing both...
https://python.langchain.com/docs/modules/data_connection/document_loaders/pdf
37a12389d702-0
CSV | 🦜�🔗 Langchain
https://python.langchain.com/docs/modules/data_connection/document_loaders/csv
37a12389d702-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionDocument loadersCSVFile DirectoryHTMLJSONMarkdownPDFDocument transformersText embedding modelsVector storesRetrieversChainsMemoryAgentsCallbacksModu...
https://python.langchain.com/docs/modules/data_connection/document_loaders/csv
37a12389d702-2
'./example_data/mlb_teams_2012.csv', 'row': 3}, lookup_index=0), Document(page_content='Team: Braves\n"Payroll (millions)": 83.31\n"Wins": 94', lookup_str='', metadata={'source': './example_data/mlb_teams_2012.csv', 'row': 4}, lookup_index=0), Document(page_content='Team: Athletics\n"Payroll (millions)": 55.37\n"Wins":...
https://python.langchain.com/docs/modules/data_connection/document_loaders/csv
37a12389d702-3
metadata={'source': './example_data/mlb_teams_2012.csv', 'row': 10}, lookup_index=0), Document(page_content='Team: Cardinals\n"Payroll (millions)": 110.30\n"Wins": 88', lookup_str='', metadata={'source': './example_data/mlb_teams_2012.csv', 'row': 11}, lookup_index=0), Document(page_content='Team: Dodgers\n"Payroll (mi...
https://python.langchain.com/docs/modules/data_connection/document_loaders/csv
37a12389d702-4
63.43\n"Wins": 79', lookup_str='', metadata={'source': './example_data/mlb_teams_2012.csv', 'row': 17}, lookup_index=0), Document(page_content='Team: Padres\n"Payroll (millions)": 55.24\n"Wins": 76', lookup_str='', metadata={'source': './example_data/mlb_teams_2012.csv', 'row': 18}, lookup_index=0), Document(page_conte...
https://python.langchain.com/docs/modules/data_connection/document_loaders/csv
37a12389d702-5
Sox\n"Payroll (millions)": 173.18\n"Wins": 69', lookup_str='', metadata={'source': './example_data/mlb_teams_2012.csv', 'row': 24}, lookup_index=0), Document(page_content='Team: Indians\n"Payroll (millions)": 78.43\n"Wins": 68', lookup_str='', metadata={'source': './example_data/mlb_teams_2012.csv', 'row': 25}, lookup_...
https://python.langchain.com/docs/modules/data_connection/document_loaders/csv
37a12389d702-6
'"', 'fieldnames': ['MLB Team', 'Payroll in millions', 'Wins']})data = loader.load()print(data) [Document(page_content='MLB Team: Team\nPayroll in millions: "Payroll (millions)"\nWins: "Wins"', lookup_str='', metadata={'source': './example_data/mlb_teams_2012.csv', 'row': 0}, lookup_index=0), Document(page_conten...
https://python.langchain.com/docs/modules/data_connection/document_loaders/csv
37a12389d702-7
in millions: 55.37\nWins: 94', lookup_str='', metadata={'source': './example_data/mlb_teams_2012.csv', 'row': 6}, lookup_index=0), Document(page_content='MLB Team: Rangers\nPayroll in millions: 120.51\nWins: 93', lookup_str='', metadata={'source': './example_data/mlb_teams_2012.csv', 'row': 7}, lookup_index=0), Documen...
https://python.langchain.com/docs/modules/data_connection/document_loaders/csv
37a12389d702-8
in millions: 95.14\nWins: 86', lookup_str='', metadata={'source': './example_data/mlb_teams_2012.csv', 'row': 13}, lookup_index=0), Document(page_content='MLB Team: White Sox\nPayroll in millions: 96.92\nWins: 85', lookup_str='', metadata={'source': './example_data/mlb_teams_2012.csv', 'row': 14}, lookup_index=0), Docu...
https://python.langchain.com/docs/modules/data_connection/document_loaders/csv
37a12389d702-9
in millions: 81.97\nWins: 75', lookup_str='', metadata={'source': './example_data/mlb_teams_2012.csv', 'row': 20}, lookup_index=0), Document(page_content='MLB Team: Mets\nPayroll in millions: 93.35\nWins: 74', lookup_str='', metadata={'source': './example_data/mlb_teams_2012.csv', 'row': 21}, lookup_index=0), Document(...
https://python.langchain.com/docs/modules/data_connection/document_loaders/csv
37a12389d702-10
in millions: 94.08\nWins: 66', lookup_str='', metadata={'source': './example_data/mlb_teams_2012.csv', 'row': 27}, lookup_index=0), Document(page_content='MLB Team: Rockies\nPayroll in millions: 78.06\nWins: 64', lookup_str='', metadata={'source': './example_data/mlb_teams_2012.csv', 'row': 28}, lookup_index=0), Docume...
https://python.langchain.com/docs/modules/data_connection/document_loaders/csv
37a12389d702-11
metadata={'source': 'Reds', 'row': 1}, lookup_index=0), Document(page_content='Team: Yankees\n"Payroll (millions)": 197.96\n"Wins": 95', lookup_str='', metadata={'source': 'Yankees', 'row': 2}, lookup_index=0), Document(page_content='Team: Giants\n"Payroll (millions)": 117.62\n"Wins": 94', lookup_str='', metadata={'sou...
https://python.langchain.com/docs/modules/data_connection/document_loaders/csv
37a12389d702-12
89', lookup_str='', metadata={'source': 'Angels', 'row': 9}, lookup_index=0), Document(page_content='Team: Tigers\n"Payroll (millions)": 132.30\n"Wins": 88', lookup_str='', metadata={'source': 'Tigers', 'row': 10}, lookup_index=0), Document(page_content='Team: Cardinals\n"Payroll (millions)": 110.30\n"Wins": 88', looku...
https://python.langchain.com/docs/modules/data_connection/document_loaders/csv
37a12389d702-13
63.43\n"Wins": 79', lookup_str='', metadata={'source': 'Pirates', 'row': 17}, lookup_index=0), Document(page_content='Team: Padres\n"Payroll (millions)": 55.24\n"Wins": 76', lookup_str='', metadata={'source': 'Padres', 'row': 18}, lookup_index=0), Document(page_content='Team: Mariners\n"Payroll (millions)": 81.97\n"Win...
https://python.langchain.com/docs/modules/data_connection/document_loaders/csv
37a12389d702-14
Indians\n"Payroll (millions)": 78.43\n"Wins": 68', lookup_str='', metadata={'source': 'Indians', 'row': 25}, lookup_index=0), Document(page_content='Team: Twins\n"Payroll (millions)": 94.08\n"Wins": 66', lookup_str='', metadata={'source': 'Twins', 'row': 26}, lookup_index=0), Document(page_content='Team: Rockies\n"Payr...
https://python.langchain.com/docs/modules/data_connection/document_loaders/csv
d85de510acb1-0
Vector stores | 🦜�🔗 Langchain
https://python.langchain.com/docs/modules/data_connection/vectorstores/
d85de510acb1-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionDocument loadersDocument transformersText embedding modelsVector storesRetrieversChainsMemoryAgentsCallbacksModulesGuidesEcosystemAdditional resourc...
https://python.langchain.com/docs/modules/data_connection/vectorstores/
d85de510acb1-2
for you.Get started​This walkthrough showcases basic functionality related to VectorStores. A key part of working with vector stores is creating the vector to put in them, which is usually created via embeddings. Therefore, it is recommended that you familiarize yourself with the text embedding model interfaces befor...
https://python.langchain.com/docs/modules/data_connection/vectorstores/
d85de510acb1-3
langchain.text_splitter import CharacterTextSplitterfrom langchain.vectorstores import FAISS# Load the document, split it into chunks, embed each chunk and load it into the vector store.raw_documents = TextLoader('../../../state_of_the_union.txt').load()text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overl...
https://python.langchain.com/docs/modules/data_connection/vectorstores/
d85de510acb1-4
= LanceDB.from_documents(documents, OpenAIEmbeddings(), connection=table)Similarity search​query = "What did the president say about Ketanji Brown Jackson"docs = db.similarity_search(query)print(docs[0].page_content) Tonight. I call on the Senate to: Pass the Freedom to Vote Act. Pass the John Lewis Voting Rights ...
https://python.langchain.com/docs/modules/data_connection/vectorstores/
d85de510acb1-5
elections. Tonight, I’d like to honor someone who has dedicated his life to serve this country: Justice Stephen Breyer—an Army veteran, Constitutional scholar, and retiring Justice of the United States Supreme Court. Justice Breyer, thank you for your service. One of the most serious constitutional responsibi...
https://python.langchain.com/docs/modules/data_connection/vectorstores/
d85de510acb1-6
Americans can know who is funding our elections. Tonight, I’d like to honor someone who has dedicated his life to serve this country: Justice Stephen Breyer—an Army veteran, Constitutional scholar, and retiring Justice of the United States Supreme Court. Justice Breyer, thank you for your service. One of the ...
https://python.langchain.com/docs/modules/data_connection/vectorstores/
d85de510acb1-7
thank you for your service.One of the most serious constitutional responsibilities a President has is nominating someone to serve on the United States Supreme Court.And I did that 4 days ago, when I nominated Circuit Court of Appeals Judge Ketanji Brown Jackson. One of our nation’s top legal minds, who will continue ...
https://python.langchain.com/docs/modules/data_connection/vectorstores/
d9367a085945-0
Retrievers | 🦜�🔗 Langchain
https://python.langchain.com/docs/modules/data_connection/retrievers/
d9367a085945-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionDocument loadersDocument transformersText embedding modelsVector storesRetrieversMultiQueryRetrieverContextual compressionEnsemble RetrieverSelf-que...
https://python.langchain.com/docs/modules/data_connection/retrievers/
d9367a085945-2
as the backbone of a retriever, but there are other types of retrievers as well.Get started​The public API of the BaseRetriever class in LangChain is as follows:from abc import ABC, abstractmethodfrom typing import Any, Listfrom langchain.schema import Documentfrom langchain.callbacks.manager import Callbacksclass Ba...
https://python.langchain.com/docs/modules/data_connection/retrievers/
d9367a085945-3
We have chosen this as the example for getting started because it nicely combines a lot of different elements (Text splitters, embeddings, vectorstores) and then also shows how to use them in a chain.Question answering over documents consists of four steps:Create an indexCreate a Retriever from that indexCreate a quest...
https://python.langchain.com/docs/modules/data_connection/retrievers/
d9367a085945-4
He also said that she is a consensus builder and has received a broad range of support from the Fraternal Order of Police to former judges appointed by Democrats and Republicans."query = "What did the president say about Ketanji Brown Jackson"index.query_with_sources(query) {'question': 'What did the president say a...
https://python.langchain.com/docs/modules/data_connection/retrievers/
d9367a085945-5
split the documents into chunks.from langchain.text_splitter import CharacterTextSplittertext_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)texts = text_splitter.split_documents(documents)We will then select which embeddings we want to use.from langchain.embeddings import OpenAIEmbeddingsembeddings ...
https://python.langchain.com/docs/modules/data_connection/retrievers/
d9367a085945-6
chunk_overlap=0))Hopefully this highlights what is going on under the hood of VectorstoreIndexCreator. While we think it's important to have a simple way to create indexes, we also think it's important to understand what's going on under the hood.PreviousVector storesNextMultiQueryRetrieverGet startedCommunityDiscordTw...
https://python.langchain.com/docs/modules/data_connection/retrievers/
4d3d1a28a4d7-0
Contextual compression | 🦜�🔗 Langchain
https://python.langchain.com/docs/modules/data_connection/retrievers/contextual_compression/
4d3d1a28a4d7-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionDocument loadersDocument transformersText embedding modelsVector storesRetrieversMultiQueryRetrieverContextual compressionEnsemble RetrieverSelf-que...
https://python.langchain.com/docs/modules/data_connection/retrievers/contextual_compression/
4d3d1a28a4d7-2
+ d.page_content for i, d in enumerate(docs)]))Using a vanilla vector store retriever​Let's start by initializing a simple vector store retriever and storing the 2023 State of the Union speech (in chunks). We can see that given an example question our retriever returns one or two relevant docs and a few irrelevant do...
https://python.langchain.com/docs/modules/data_connection/retrievers/contextual_compression/
4d3d1a28a4d7-3
I did that 4 days ago, when I nominated Circuit Court of Appeals Judge Ketanji Brown Jackson. One of our nation’s top legal minds, who will continue Justice Breyer’s legacy of excellence. ---------------------------------------------------------------------------------------------------- Document 2: A ...
https://python.langchain.com/docs/modules/data_connection/retrievers/contextual_compression/
4d3d1a28a4d7-4
yourself and reach your God-given potential. While it often appears that we never agree, that isn’t true. I signed 80 bipartisan bills into law last year. From preventing government shutdowns to protecting Asian-Americans from still-too-common hate crimes to reforming military justice. And soon, we’...
https://python.langchain.com/docs/modules/data_connection/retrievers/contextual_compression/
4d3d1a28a4d7-5
Let’s increase Pell Grants and increase our historic support of HBCUs, and invest in what Jill—our First Lady who teaches full-time—calls America’s best-kept secret: community colleges.Adding contextual compression with an LLMChainExtractor​Now let's wrap our base retriever with a ContextualCompressionRetriev...
https://python.langchain.com/docs/modules/data_connection/retrievers/contextual_compression/
4d3d1a28a4d7-6
been nominated, she’s received a broad range of support—from the Fraternal Order of Police to former judges appointed by Democrats and Republicans."More built-in compressors: filters​LLMChainFilter​The LLMChainFilter is slightly simpler but more robust compressor that uses an LLM chain to decide which of the in...
https://python.langchain.com/docs/modules/data_connection/retrievers/contextual_compression/
4d3d1a28a4d7-7
legacy of excellence.EmbeddingsFilter​Making an extra LLM call over each retrieved document is expensive and slow. The EmbeddingsFilter provides a cheaper and faster option by embedding the documents and query and only returning those documents which have sufficiently similar embeddings to the query.from langchain.em...
https://python.langchain.com/docs/modules/data_connection/retrievers/contextual_compression/
4d3d1a28a4d7-8
Document 2: A former top litigator in private practice. A former federal public defender. And from a family of public school educators and police officers. A consensus builder. Since she’s been nominated, she’s received a broad range of support—from the Fraternal Order of Police to former judges appointed ...
https://python.langchain.com/docs/modules/data_connection/retrievers/contextual_compression/
4d3d1a28a4d7-9
from still-too-common hate crimes to reforming military justice. And soon, we’ll strengthen the Violence Against Women Act that I first wrote three decades ago. It is important for us to show the nation that we can come together and do big things. So tonight I’m offering a Unity Agenda for the Natio...
https://python.langchain.com/docs/modules/data_connection/retrievers/contextual_compression/
4d3d1a28a4d7-10
= compression_retriever.get_relevant_documents("What did the president say about Ketanji Jackson Brown")pretty_print_docs(compressed_docs) Document 1: One of the most serious constitutional responsibilities a President has is nominating someone to serve on the United States Supreme Court. And I did th...
https://python.langchain.com/docs/modules/data_connection/retrievers/contextual_compression/
176cd345fd3a-0
MultiQueryRetriever | 🦜�🔗 Langchain
https://python.langchain.com/docs/modules/data_connection/retrievers/MultiQueryRetriever
176cd345fd3a-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionDocument loadersDocument transformersText embedding modelsVector storesRetrieversMultiQueryRetrieverContextual compressionEnsemble RetrieverSelf-que...
https://python.langchain.com/docs/modules/data_connection/retrievers/MultiQueryRetriever
176cd345fd3a-2
chunk_overlap=0)splits = text_splitter.split_documents(data)# VectorDBembedding = OpenAIEmbeddings()vectordb = Chroma.from_documents(documents=splits, embedding=embedding)Simple usageSpecify the LLM to use for query generation, and the retriver will do the rest.from langchain.chat_models import ChatOpenAIfrom langchain...
https://python.langchain.com/docs/modules/data_connection/retrievers/MultiQueryRetriever
176cd345fd3a-3
def __init__(self) -> None: super().__init__(pydantic_object=LineList) def parse(self, text: str) -> LineList: lines = text.strip().split("\n") return LineList(lines=lines)output_parser = LineListOutputParser()QUERY_PROMPT = PromptTemplate( input_variables=["question"], template="""You are...
https://python.langchain.com/docs/modules/data_connection/retrievers/MultiQueryRetriever
176cd345fd3a-4
How does the course cover the topic of regression?', "4. What are the course's teachings on regression?", '5. In relation to the course, what is mentioned about regression?'] 11PreviousRetrieversNextContextual compressionCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright © 2023 LangChain, Inc.
https://python.langchain.com/docs/modules/data_connection/retrievers/MultiQueryRetriever
b86242c73919-0
Vector store-backed retriever | 🦜�🔗 Langchain
https://python.langchain.com/docs/modules/data_connection/retrievers/vectorstore
b86242c73919-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionDocument loadersDocument transformersText embedding modelsVector storesRetrieversMultiQueryRetrieverContextual compressionEnsemble RetrieverSelf-que...
https://python.langchain.com/docs/modules/data_connection/retrievers/vectorstore
b86242c73919-2
It uses the search methods implemented by a vector store, like similarity search and MMR, to query the texts in the vector store.Once you construct a Vector store, it's very easy to construct a retriever. Let's walk through an example.from langchain.document_loaders import TextLoaderloader = TextLoader('../../../state_...
https://python.langchain.com/docs/modules/data_connection/retrievers/vectorstore
b86242c73919-3
1})docs = retriever.get_relevant_documents("what did he say about ketanji brown jackson")len(docs) 1PreviousTime-weighted vector store retrieverNextChainsCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright © 2023 LangChain, Inc.
https://python.langchain.com/docs/modules/data_connection/retrievers/vectorstore
b5f224b82f73-0
Ensemble Retriever | 🦜�🔗 Langchain
https://python.langchain.com/docs/modules/data_connection/retrievers/ensemble
b5f224b82f73-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionDocument loadersDocument transformersText embedding modelsVector storesRetrieversMultiQueryRetrieverContextual compressionEnsemble RetrieverSelf-que...
https://python.langchain.com/docs/modules/data_connection/retrievers/ensemble
b5f224b82f73-2
faiss_vectorstore.as_retriever(search_kwargs={"k": 2})# initialize the ensemble retrieverensemble_retriever = EnsembleRetriever(retrievers=[bm25_retriever, faiss_retriever], weights=[0.5, 0.5])docs = ensemble_retriever.get_relevant_documents("apples")docs [Document(page_content='I like apples', metadata={}), Doc...
https://python.langchain.com/docs/modules/data_connection/retrievers/ensemble
177a8ccdd721-0
Time-weighted vector store retriever | 🦜�🔗 Langchain
https://python.langchain.com/docs/modules/data_connection/retrievers/time_weighted_vectorstore