id stringlengths 14 16 | text stringlengths 44 2.73k | source stringlengths 49 115 |
|---|---|---|
34e3b7713c96-17 | username = "davitbun" # your username on app.activeloop.ai
source = f"hub://{username}/langchain_test" # could be local, s3, gcs, etc.
destination = f"hub://{username}/langchain_test_copy" # could be local, s3, gcs, etc.
deeplake.deepcopy(src=source, dest=destination, overwrite=True)
Copying dataset: 100%|██████████... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/deeplake.html |
34e3b7713c96-18 | metadata json (4, 1) str None
text text (4, 1) str None
Evaluating ingest: 100%|██████████| 1/1 [00:31<00:00
-
Dataset(path='hub://davitbun/langchain_test_copy', tensors=['embedding', 'ids', 'metadata', 'text'])
tensor htype shape dtype compression
------- -... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/deeplake.html |
6c87b86c9e72-0 | .ipynb
.pdf
Annoy
Contents
Create VectorStore from texts
Create VectorStore from docs
Create VectorStore via existing embeddings
Search via embeddings
Search via docstore id
Save and load
Construct from scratch
Annoy#
This notebook shows how to use functionality related to the Annoy vector database.
“Annoy (Approxima... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/annoy.html |
6c87b86c9e72-1 | vector_store.similarity_search_with_score("food", k=3)
[(Document(page_content='pizza is great', metadata={}), 1.0944390296936035),
(Document(page_content='I love salad', metadata={}), 1.1273186206817627),
(Document(page_content='my car', metadata={}), 1.1580758094787598)]
Create VectorStore from docs#
from langchain... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/annoy.html |
6c87b86c9e72-2 | Document(page_content='Groups of citizens blocking tanks with their bodies. Everyone from students to retirees teachers turned soldiers defending their homeland. \n\nIn this struggle as President Zelenskyy said in his speech to the European Parliament “Light will win over darkness.” The Ukrainian Ambassador to the Unit... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/annoy.html |
6c87b86c9e72-3 | Document(page_content='Putin’s latest attack on Ukraine was premeditated and unprovoked. \n\nHe rejected repeated efforts at diplomacy. \n\nHe thought the West and NATO wouldn’t respond. And he thought he could divide us at home. Putin was wrong. We were ready. Here is what we did. \n\nWe prepared extensively and ca... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/annoy.html |
6c87b86c9e72-4 | Document(page_content='We are inflicting pain on Russia and supporting the people of Ukraine. Putin is now isolated from the world more than ever. \n\nTogether with our allies –we are right now enforcing powerful economic sanctions. \n\nWe are cutting off Russia’s largest banks from the international financial system. ... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/annoy.html |
6c87b86c9e72-5 | Document(page_content='And tonight I am announcing that we will join our allies in closing off American air space to all Russian flights – further isolating Russia – and adding an additional squeeze –on their economy. The Ruble has lost 30% of its value. \n\nThe Russian stock market has lost 40% of its value and tradin... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/annoy.html |
6c87b86c9e72-6 | (Document(page_content='I love salad', metadata={}), 1.1273186206817627),
(Document(page_content='my car', metadata={}), 1.1580758094787598)]
Search via embeddings#
motorbike_emb = embeddings_func.embed_query("motorbike")
vector_store.similarity_search_by_vector(motorbike_emb, k=3)
[Document(page_content='my car', met... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/annoy.html |
6c87b86c9e72-7 | Document(page_content='pizza is great', metadata={})
# same document has distance 0
vector_store.similarity_search_with_score_by_index(some_docstore_id, k=3)
[(Document(page_content='pizza is great', metadata={}), 0.0),
(Document(page_content='I love salad', metadata={}), 1.0734446048736572),
(Document(page_content='... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/annoy.html |
6c87b86c9e72-8 | index.build(10)
# docstore
documents = []
for i, text in enumerate(texts):
metadata = metadatas[i] if metadatas else {}
documents.append(Document(page_content=text, metadata=metadata))
index_to_docstore_id = {i: str(uuid.uuid4()) for i in range(len(documents))}
docstore = InMemoryDocstore(
{index_to_docstor... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/annoy.html |
0d472f34e763-0 | .ipynb
.pdf
Redis
Contents
RedisVectorStoreRetriever
Redis#
This notebook shows how to use functionality related to the Redis vector database.
from langchain.embeddings import OpenAIEmbeddings
from langchain.text_splitter import CharacterTextSplitter
from langchain.vectorstores.redis import Redis
from langchain.docum... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/redis.html |
0d472f34e763-1 | print(rds.add_texts(["Ankush went to Princeton"]))
['doc:link:d7d02e3faf1b40bbbe29a683ff75b280']
query = "Princeton"
results = rds.similarity_search(query)
print(results[0].page_content)
Ankush went to Princeton
# Load from existing index
rds = Redis.from_existing_index(embeddings, redis_url="redis://localhost:6379", i... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/redis.html |
0d472f34e763-2 | docs = retriever.get_relevant_documents(query)
We can also use similarity_limit as a search method. This is only return documents if they are similar enough
retriever = rds.as_retriever(search_type="similarity_limit")
# Here we can see it doesn't return any results because there are no relevant documents
retriever.get_... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/redis.html |
3fb840ad9d23-0 | .ipynb
.pdf
PGVector
Contents
Similarity search with score
Similarity Search with Euclidean Distance (Default)
PGVector#
This notebook shows how to use functionality related to the Postgres vector database (PGVector).
## Loading Environment Variables
from typing import List, Tuple
from dotenv import load_dotenv
load_... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/pgvector.html |
3fb840ad9d23-1 | # permission to create a table.
db = PGVector.from_documents(
embedding=embeddings,
documents=docs,
collection_name="state_of_the_union",
connection_string=CONNECTION_STRING,
)
query = "What did the president say about Ketanji Brown Jackson"
docs_with_score: List[Tuple[Document, float]] = db.similarity_... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/pgvector.html |
3fb840ad9d23-2 | 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 responsibilities a President h... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/pgvector.html |
3fb840ad9d23-3 | 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 responsibilities a President h... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/pgvector.html |
500d71c2a87e-0 | .ipynb
.pdf
AnalyticDB
AnalyticDB#
This notebook shows how to use functionality related to the AnalyticDB vector database.
To run, you should have an AnalyticDB instance up and running:
Using AnalyticDB Cloud Vector Database. Click here to fast deploy it.
from langchain.embeddings.openai import OpenAIEmbeddings
from la... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/analyticdb.html |
500d71c2a87e-1 | embeddings,
connection_string= connection_string,
)
Query and retrieve data
query = "What did the president say about Ketanji Brown Jackson"
docs = vector_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 Act. An... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/analyticdb.html |
5bb199c4b570-0 | .ipynb
.pdf
Pinecone
Pinecone#
This notebook shows how to use functionality related to the Pinecone vector database.
from langchain.embeddings.openai import OpenAIEmbeddings
from langchain.text_splitter import CharacterTextSplitter
from langchain.vectorstores import Pinecone
from langchain.document_loaders import TextL... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/pinecone.html |
ebf075e37819-0 | .ipynb
.pdf
Milvus
Milvus#
This notebook shows how to use functionality related to the Milvus vector database.
To run, you should have a Milvus instance up and running: https://milvus.io/docs/install_standalone-docker.md
from langchain.embeddings.openai import OpenAIEmbeddings
from langchain.text_splitter import Charac... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/milvus.html |
1d903c5144ec-0 | .ipynb
.pdf
Zilliz
Zilliz#
This notebook shows how to use functionality related to the Zilliz Cloud managed vector database.
To run, you should have a Zilliz Cloud instance up and running: https://zilliz.com/cloud
from langchain.embeddings.openai import OpenAIEmbeddings
from langchain.text_splitter import CharacterText... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/zilliz.html |
cfef47c1b766-0 | .ipynb
.pdf
ElasticSearch
ElasticSearch#
This notebook shows how to use functionality related to the ElasticSearch database.
from langchain.embeddings.openai import OpenAIEmbeddings
from langchain.text_splitter import CharacterTextSplitter
from langchain.vectorstores import ElasticVectorSearch
from langchain.document_l... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/elasticsearch.html |
cfef47c1b766-1 | 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 Justice Breyer’s legacy of excellence.
previous
Deep Lake
next
FAISS
By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Apr 28, 20... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/elasticsearch.html |
2e29e1321b92-0 | .ipynb
.pdf
Chroma
Contents
Similarity search with score
Persistance
Initialize PeristedChromaDB
Persist the Database
Load the Database from disk, and create the chain
Retriever options
MMR
Chroma#
This notebook shows how to use functionality related to the Chroma vector database.
from langchain.embeddings.openai imp... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/chroma.html |
2e29e1321b92-1 | 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 Justice Breyer’s legacy of excellence.
Similarity search with score#
docs = db.similarity_search_with_score(query)
docs[0]
(Document(page_content='In state after state... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/chroma.html |
2e29e1321b92-2 | # Supplying a persist_directory will store the embeddings on disk
persist_directory = 'db'
embedding = OpenAIEmbeddings()
vectordb = Chroma.from_documents(documents=docs, embedding=embedding, persist_directory=persist_directory)
Running Chroma using direct local API.
No existing DB found in db, skipping load
No existin... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/chroma.html |
2e29e1321b92-3 | retriever.get_relevant_documents(query)[0]
Document(page_content='Tonight. I call on the Senate to: Pass the Freedom to Vote Act. Pass the John Lewis Voting Rights Act. And while you’re at it, pass the Disclose Act so Americans can know who is funding our elections. \n\nTonight, I’d like to honor someone who has dedica... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/chroma.html |
ed49eb02d036-0 | .ipynb
.pdf
SupabaseVectorStore
Contents
Similarity search with score
Retriever options
Maximal Marginal Relevance Searches
SupabaseVectorStore#
This notebook shows how to use Supabase and pgvector as your VectorStore.
To run this notebook, please ensure:
the pgvector extension is enabled
you have installed the supab... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/supabase.html |
ed49eb02d036-1 | $$;
# with pip
# !pip install supabase
# with conda
# !conda install -c conda-forge supabase
# If you're storing your Supabase and OpenAI API keys in a .env file, you can load them with dotenv
from dotenv import load_dotenv
load_dotenv()
True
import os
from supabase.client import Client, create_client
supabase_url = os... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/supabase.html |
ed49eb02d036-2 | print(matched_docs[0].page_content)
Tonight. I call on the Senate to: Pass the Freedom to Vote Act. Pass the John Lewis Voting Rights Act. And while you’re at it, pass the Disclose Act so Americans can know who is funding our elections.
Tonight, I’d like to honor someone who has dedicated his life to serve this countr... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/supabase.html |
ed49eb02d036-3 | 0.802509746274066)
Retriever options#
This section goes over different options for how to use SupabaseVectorStore as a retriever.
Maximal Marginal Relevance Searches#
In addition to using similarity search in the retriever object, you can also use mmr.
retriever = vector_store.as_retriever(search_type="mmr")
matched_do... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/supabase.html |
ed49eb02d036-4 | A cancer that would put them in a flag-draped coffin.
I know.
One of those soldiers was my son Major Beau Biden.
We don’t know for sure if a burn pit was the cause of his brain cancer, or the diseases of so many of our troops.
But I’m committed to finding out everything we can.
Committed to military families like ... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/supabase.html |
ed49eb02d036-5 | ## Document 3
We can’t change how divided we’ve been. But we can change how we move forward—on COVID-19 and other issues we must face together.
I recently visited the New York City Police Department days after the funerals of Officer Wilbert Mora and his partner, Officer Jason Rivera.
They were responding to a 9-1-1 ... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/supabase.html |
56624d4fc1d2-0 | .ipynb
.pdf
Weaviate
Weaviate#
This notebook shows how to use functionality related to the Weaviate vector database.
from langchain.embeddings.openai import OpenAIEmbeddings
from langchain.text_splitter import CharacterTextSplitter
from langchain.vectorstores import Weaviate
from langchain.document_loaders import TextL... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/weaviate.html |
56624d4fc1d2-1 | },
],
},
]
}
client.schema.create(schema)
vectorstore = Weaviate(client, "Paragraph", "content")
query = "What did the president say about Ketanji Brown Jackson"
docs = vectorstore.similarity_search(query)
print(docs[0].page_content)
previous
SupabaseVectorStore
next
Zilliz
By Harrison Chase
... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/weaviate.html |
7331e4ceddd1-0 | .ipynb
.pdf
MyScale
Contents
Setting up envrionments
Get connection info and data schema
Filtering
Deleting your data
MyScale#
This notebook shows how to use functionality related to the MyScale vector database.
from langchain.embeddings.openai import OpenAIEmbeddings
from langchain.text_splitter import CharacterText... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/myscale.html |
7331e4ceddd1-1 | docs = docsearch.similarity_search(query)
Inserting data...: 100%|██████████| 42/42 [00:18<00:00, 2.21it/s]
print(docs[0].page_content)
As Frances Haugen, who is here with us tonight, has shown, we must hold social media platforms accountable for the national experiment they’re conducting on our children for profit.
... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/myscale.html |
7331e4ceddd1-2 | docs = text_splitter.split_documents(documents)
embeddings = OpenAIEmbeddings()
for i, d in enumerate(docs):
d.metadata = {'doc_id': i}
docsearch = MyScale.from_documents(docs, embeddings)
Inserting data...: 100%|██████████| 42/42 [00:15<00:00, 2.69it/s]
meta = docsearch.metadata_column
output = docsearch.similari... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/myscale.html |
04c7c8f8245e-0 | .ipynb
.pdf
AtlasDB
AtlasDB#
This notebook shows you how to use functionality related to the AtlasDB
import time
from langchain.embeddings.openai import OpenAIEmbeddings
from langchain.text_splitter import SpacyTextSplitter
from langchain.vectorstores import AtlasDB
from langchain.document_loaders import TextLoader
!py... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/atlas.html |
04c7c8f8245e-1 | By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Apr 28, 2023. | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/atlas.html |
3229e38151fc-0 | .ipynb
.pdf
OpenSearch
Contents
similarity_search using Approximate k-NN Search with Custom Parameters
similarity_search using Script Scoring with Custom Parameters
similarity_search using Painless Scripting with Custom Parameters
Using a preexisting OpenSearch instance
OpenSearch#
This notebook shows how to use func... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/opensearch.html |
3229e38151fc-1 | query = "What did the president say about Ketanji Brown Jackson"
docs = docsearch.similarity_search(query)
print(docs[0].page_content)
similarity_search using Script Scoring with Custom Parameters#
docsearch = OpenSearchVectorSearch.from_documents(docs, embeddings, opensearch_url="http://localhost:9200", is_appx_search... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/opensearch.html |
3229e38151fc-2 | docs = docsearch.similarity_search("Who was asking about getting lunch today?", search_type="script_scoring", space_type="cosinesimil", vector_field="message_embedding", text_field="message", metadata_field="message_metadata")
previous
MyScale
next
PGVector
Contents
similarity_search using Approximate k-NN Search w... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/opensearch.html |
62b75472a264-0 | .ipynb
.pdf
Qdrant
Contents
Connecting to Qdrant from LangChain
Local mode
In-memory
On-disk storage
On-premise server deployment
Qdrant Cloud
Reusing the same collection
Similarity search
Similarity search with score
Maximum marginal relevance search (MMR)
Qdrant as a Retriever
Customizing Qdrant
Qdrant#
This notebo... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/qdrant.html |
62b75472a264-1 | qdrant = Qdrant.from_documents(
docs, embeddings,
location=":memory:", # Local mode with in-memory storage only
collection_name="my_documents",
)
On-disk storage#
Local mode, without using the Qdrant server, may also store your vectors on disk so they’re persisted between runs.
qdrant = Qdrant.from_docume... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/qdrant.html |
62b75472a264-2 | collection_name="my_documents",
)
Reusing the same collection#
Both Qdrant.from_texts and Qdrant.from_documents methods are great to start using Qdrant with LangChain, but they are going to destroy the collection and create it from scratch! If you want to reuse the existing collection, you can always create an instance... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/qdrant.html |
62b75472a264-3 | 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 Justice Breyer’s legacy of excellence.
Similarity search with score#
Sometimes we might want to perform the search, but also obtain a relevancy score to know how good ... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/qdrant.html |
62b75472a264-4 | query = "What did the president say about Ketanji Brown Jackson"
found_docs = qdrant.max_marginal_relevance_search(query, k=2, fetch_k=10)
for i, doc in enumerate(found_docs):
print(f"{i + 1}.", doc.page_content, "\n")
1. Tonight. I call on the Senate to: Pass the Freedom to Vote Act. Pass the John Lewis Voting Rig... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/qdrant.html |
62b75472a264-5 | I spoke with their families and told them that we are forever in debt for their sacrifice, and we will carry on their mission to restore the trust and safety every community deserves.
I’ve worked on these issues a long time.
I know what works: Investing in crime preventionand community police officers who’ll walk the... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/qdrant.html |
62b75472a264-6 | retriever.get_relevant_documents(query)[0]
Document(page_content='Tonight. I call on the Senate to: Pass the Freedom to Vote Act. Pass the John Lewis Voting Rights Act. And while you’re at it, pass the Disclose Act so Americans can know who is funding our elections. \n\nTonight, I’d like to honor someone who has dedica... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/qdrant.html |
62b75472a264-7 | metadata_payload_key="my_meta",
)
<langchain.vectorstores.qdrant.Qdrant at 0x7fc4e2baa230>
previous
Pinecone
next
Redis
Contents
Connecting to Qdrant from LangChain
Local mode
In-memory
On-disk storage
On-premise server deployment
Qdrant Cloud
Reusing the same collection
Similarity search
Similarity search with sco... | https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/qdrant.html |
ea5d2e98adcd-0 | .ipynb
.pdf
EverNote
EverNote#
How to load EverNote file from disk.
# !pip install pypandoc
# import pypandoc
# pypandoc.download_pandoc()
from langchain.document_loaders import EverNoteLoader
loader = EverNoteLoader("example_data/testing.enex")
loader.load()
[Document(page_content='testing this\n\nwhat happens?\n\nto ... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/evernote.html |
6fe178ae2b5c-0 | .ipynb
.pdf
Notion
Contents
🧑 Instructions for ingesting your own dataset
Notion#
This notebook covers how to load documents from a Notion database dump.
In order to get this notion dump, follow these instructions:
🧑 Instructions for ingesting your own dataset#
Export your dataset from Notion. You can do this by cl... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/notion.html |
88d27b982597-0 | .ipynb
.pdf
Markdown
Contents
Retain Elements
Markdown#
This covers how to load markdown documents into a document format that we can use downstream.
from langchain.document_loaders import UnstructuredMarkdownLoader
loader = UnstructuredMarkdownLoader("../../../../README.md")
data = loader.load()
data | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/markdown.html |
88d27b982597-1 | [Document(page_content="ð\x9f¦\x9cï¸\x8fð\x9f”\x97 LangChain\n\nâ\x9a¡ Building applications with LLMs through composability â\x9a¡\n\nProduction Support: As you move your LangChains into production, we'd love to offer more comprehensive support.\nPlease fill out this form and we'll set up a dedicated support Slack cha... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/markdown.html |
88d27b982597-2 | Chatbots\n\nDocumentation\n\nEnd-to-end Example: Chat-LangChain\n\nð\x9f¤\x96 Agents\n\nDocumentation\n\nEnd-to-end Example: GPT+WolframAlpha\n\nð\x9f“\x96 Documentation\n\nPlease see here for full documentation on:\n\nGetting started (installation, setting up the environment, simple examples)\n\nHow-To examples (demos... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/markdown.html |
88d27b982597-3 | chains for common applications.\n\nð\x9f“\x9a Data Augmented Generation:\n\nData Augmented Generation involves specific types of chains that first interact with an external datasource to fetch data to use in the generation step. Examples of this include summarization of long pieces of text and question/answering over s... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/markdown.html |
88d27b982597-4 | is using language models themselves to do the evaluation. LangChain provides some prompts/chains for assisting in this.\n\nFor more information on these concepts, please see our full documentation.\n\nð\x9f’\x81 Contributing\n\nAs an open source project in a rapidly developing field, we are extremely open to contributi... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/markdown.html |
88d27b982597-5 | Retain Elements#
Under the hood, Unstructured creates different “elements” for different chunks of text. By default we combine those together, but you can easily keep that separation by specifying mode="elements".
loader = UnstructuredMarkdownLoader("../../../../README.md", mode="elements")
data = loader.load()
data[0]... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/markdown.html |
46c6fed1cef2-0 | .ipynb
.pdf
Arxiv
Contents
Installation
Examples
Arxiv#
arXiv is an open-access archive for 2 million scholarly articles in the fields of physics, mathematics, computer science, quantitative biology, quantitative finance, statistics, electrical engineering and systems science, and economics.
This notebook shows how t... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/arxiv.html |
46c6fed1cef2-1 | 'Authors': 'Caprice Stanley, Tobias Windisch',
'Summary': 'Graphs on lattice points are studied whose edges come from a finite set of\nallowed moves of arbitrary length. We show that the diameter of these graphs on\nfibers of a fixed integer matrix can be bounded from above by a constant. We\nthen study the mixing beh... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/arxiv.html |
0e95acbb849f-0 | .ipynb
.pdf
Azure Blob Storage File
Azure Blob Storage File#
This covers how to load document objects from a Azure Blob Storage file.
from langchain.document_loaders import AzureBlobStorageFileLoader
#!pip install azure-storage-blob
loader = AzureBlobStorageFileLoader(conn_str='<connection string>', container='<contain... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/azure_blob_storage_file.html |
0feb0a757fc3-0 | .ipynb
.pdf
WhatsApp Chat
WhatsApp Chat#
This notebook covers how to load data from the WhatsApp Chats into a format that can be ingested into LangChain.
from langchain.document_loaders import WhatsAppChatLoader
loader = WhatsAppChatLoader("example_data/whatsapp_chat.txt")
loader.load()
previous
Web Base
next
Word Docu... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/whatsapp_chat.html |
2f7c81235c55-0 | .ipynb
.pdf
GCS File Storage
GCS File Storage#
This covers how to load document objects from an Google Cloud Storage (GCS) file object.
from langchain.document_loaders import GCSFileLoader
# !pip install google-cloud-storage
loader = GCSFileLoader(project_name="aist", bucket="testing-hwc", blob="fake.docx")
loader.load... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/gcs_file.html |
ea5b56abc0d8-0 | .ipynb
.pdf
Airbyte JSON
Airbyte JSON#
This covers how to load any source from Airbyte into a local JSON file that can be read in as a document
Prereqs:
Have docker desktop installed
Steps:
Clone Airbyte from GitHub - git clone https://github.com/airbytehq/airbyte.git
Switch into Airbyte directory - cd airbyte
Start Ai... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/airbyte_json.html |
ea5b56abc0d8-1 | game_indices:
game_index: 180
version:
name: red
url: https://pokeapi.co/api/v2/version/1/
game_index: 180
version:
name: blue
url: https://pokeapi.co/api/v2/version/2/
game_index: 180
version:
n
previous
CoNLL-U
next
Apify Dataset
By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/airbyte_json.html |
71db41683013-0 | .ipynb
.pdf
URL
Contents
URL
Selenium URL Loader
Setup
Playwright URL Loader
Setup
URL#
This covers how to load HTML documents from a list of URLs into a document format that we can use downstream.
from langchain.document_loaders import UnstructuredURLLoader
urls = [
"https://www.understandingwar.org/backgrounde... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/url.html |
71db41683013-1 | !pip install "playwright"
!pip install "unstructured"
!playwright install
from langchain.document_loaders import PlaywrightURLLoader
urls = [
"https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"https://goo.gl/maps/NDSHwePEyaHMFGwh8"
]
loader = PlaywrightURLLoader(urls=urls, remove_selectors=["header", "footer"])
da... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/url.html |
c2ce8a2a0d13-0 | .ipynb
.pdf
Sitemap Loader
Contents
Filtering sitemap URLs
Sitemap Loader#
Extends from the WebBaseLoader, this will load a sitemap from a given URL, and then scrape and load all the pages in the sitemap, returning each page as a document.
The scraping is done concurrently, using WebBaseLoader. There are reasonable ... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
c2ce8a2a0d13-1 | Document(page_content='\n\n\n\n\n\nWelcome to LangChain — 🦜🔗 LangChain 0.0.123\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nSkip to main content\n\n\n\n\n\n\n\n\n\n\nCtrl+K\n\n\n\n\n\n\n\n\n\n\n\n\n🦜🔗 LangChain 0.0.123\n\n\n\nGetting Started\n\nQuickstart Guide\n\nMod... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
c2ce8a2a0d13-2 | OpenAI\nSageMakerEndpoint\nSelf-Hosted Models via Runhouse\nStochasticAI\nWriter\n\n\nAsync API for LLM\nStreaming with LLMs\n\n\nReference\n\n\nDocument Loaders\nKey Concepts\nHow To Guides\nCoNLL-U\nAirbyte JSON\nAZLyrics\nBlackboard\nCollege Confidential\nCopy Paste\nCSV Loader\nDirectory Loader\nEmail\nEverNote\nFa... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
c2ce8a2a0d13-3 | Document Embeddings\nText Splitter\nVectorStores\nAtlasDB\nChroma\nDeep Lake\nElasticSearch\nFAISS\nMilvus\nOpenSearch\nPGVector\nPinecone\nQdrant\nRedis\nWeaviate\nChatGPT Plugin Retriever\nVectorStore Retriever\nAnalyze Document\nChat Index\nGraph QA\nQuestion Answering with Sources\nQuestion Answering\nSummarization... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
c2ce8a2a0d13-4 | Agent\nJSON Agent\nOpenAPI Agent\nPandas Dataframe Agent\nPython Agent\nSQL Database Agent\nVectorstore Agent\nMRKL\nMRKL Chat\nReAct\nSelf Ask With Search\n\n\nReference\n\n\nMemory\nGetting Started\nKey Concepts\nHow-To Guides\nConversationBufferMemory\nConversationBufferWindowMemory\nEntity Memory\nConversation Know... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
c2ce8a2a0d13-5 | Generation\nQuestion Answering\nSQL Question Answering Benchmarking: Chinook\n\n\nModel Comparison\n\nReference\n\nInstallation\nIntegrations\nAPI References\nPrompts\nPromptTemplates\nExample Selector\n\n\nUtilities\nPython REPL\nSerpAPI\nSearxNG Search\nDocstore\nText Splitter\nEmbeddings\nVectorStores\n\n\nChains\nA... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
c2ce8a2a0d13-6 | Started\nModules\nUse Cases\nReference Docs\nLangChain Ecosystem\nAdditional Resources\n\n\n\n\n\n\n\n\nWelcome to LangChain#\nLarge language models (LLMs) are emerging as a transformative technology, enabling\ndevelopers to build applications that they previously could not.\nBut using these LLMs in isolation is often ... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
c2ce8a2a0d13-7 | support for.\nFor each module we provide some examples to get started, how-to guides, reference docs, and conceptual guides.\nThese modules are, in increasing order of complexity:\n\nPrompts: This includes prompt management, prompt optimization, and prompt serialization.\nLLMs: This includes a generic interface for all... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
c2ce8a2a0d13-8 | models are often more powerful when combined with your own text data - this module covers best practices for doing exactly that.\nAgents: Agents involve an LLM making decisions about which Actions to take, taking that Action, seeing an Observation, and repeating that until done. LangChain provides a standard interface ... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
c2ce8a2a0d13-9 | the common use cases LangChain supports.\n\nAgents: Agents are systems that use a language model to interact with other tools. These can be used to do more grounded question/answering, interact with APIs, or even take actions.\nChatbots: Since language models are good at producing text, that makes them ideal for creati... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
c2ce8a2a0d13-10 | SQL, dataframes, etc) you should read this page.\nEvaluation: Generative models are notoriously hard to evaluate with traditional metrics. One new way of evaluating them is using language models themselves to do the evaluation. LangChain provides some prompts/chains for assisting in this.\nGenerate similar examples: Ge... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
c2ce8a2a0d13-11 | application!\n\nLangChainHub: The LangChainHub is a place to share and explore other prompts, chains, and agents.\nGlossary: A glossary of all related terms, papers, methods, etc. Whether implemented in LangChain or not!\nGallery: A collection of our favorite projects that use LangChain. Useful for finding inspiration ... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
c2ce8a2a0d13-12 | Harrison Chase\n\n\n\n\n \n © Copyright 2023, Harrison Chase.\n \n\n\n\n\n Last updated on Mar 24, 2023.\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n', lookup_str='', metadata={'source': 'https://python.langchain.com/en/stable/', 'loc': 'https://python.langchain.com/en/stable/', 'lastmod': '2023-03-24T19:30:54.647... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
c2ce8a2a0d13-13 | Filtering sitemap URLs#
Sitemaps can be massive files, with thousands of urls. Often you don’t need every single one of them. You can filter the urls by passing a list of strings or regex patterns to the url_filter parameter. Only urls that match one of the patterns will be loaded.
loader = SitemapLoader(
"https... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
c2ce8a2a0d13-14 | Document(page_content='\n\n\n\n\n\nWelcome to LangChain — 🦜🔗 LangChain 0.0.123\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nSkip to main content\n\n\n\n\n\n\n\n\n\n\nCtrl+K\n\n\n\n\n\n\n\n\n\n\n\n\n🦜🔗 LangChain 0.0.123\n\n\n\nGetting Started\n\nQuickstart Guide\n\nMod... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
c2ce8a2a0d13-15 | Models\nGetting Started\nHow-To Guides\nHow to use few shot examples\nHow to stream responses\n\n\nIntegrations\nAzure\nOpenAI\nPromptLayer ChatOpenAI\n\n\n\n\nText Embedding Models\nAzureOpenAI\nCohere\nFake Embeddings\nHugging Face Hub\nInstructEmbeddings\nOpenAI\nSageMaker Endpoint Embeddings\nSelf Hosted Embeddings... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
c2ce8a2a0d13-16 | File Storage\nGitBook\nGoogle Drive\nGutenberg\nHacker News\nHTML\niFixit\nImages\nIMSDb\nMarkdown\nNotebook\nNotion\nObsidian\nPDF\nPowerPoint\nReadTheDocs Documentation\nRoam\ns3 Directory\ns3 File\nSubtitle Files\nTelegram\nUnstructured File Loader\nURL\nWeb Base\nWord Documents\nYouTube\n\n\nText Splitters\nGetting... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
c2ce8a2a0d13-17 | Memory class\nHow to use multiple memroy classes in the same chain\n\n\n\n\nChains\nGetting Started\nHow-To Guides\nAsync API for Chain\nLoading from LangChainHub\nLLM Chain\nSequential Chains\nSerialization\nTransformation Chain\nAnalyze Document\nChat Index\nGraph QA\nHypothetical Document Embeddings\nQuestion Answer... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
c2ce8a2a0d13-18 | Dataframe Agent\nPython Agent\nSQL Database Agent\nVectorstore Agent\n\n\nAgent Executors\nHow to combine agents and vectorstores\nHow to use the async API for Agents\nHow to create ChatGPT Clone\nHow to access intermediate steps\nHow to cap the max number of iterations\nHow to add SharedMemory to an Agent and its Tool... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
c2ce8a2a0d13-19 | Lake\nForefrontAI\nGoogle Search Wrapper\nGoogle Serper Wrapper\nGooseAI\nGraphsignal\nHazy Research\nHelicone\nHugging Face\nMilvus\nModal\nNLPCloud\nOpenAI\nOpenSearch\nPetals\nPGVector\nPinecone\nPromptLayer\nQdrant\nRunhouse\nSearxNG Search API\nSerpAPI\nStochasticAI\nUnstructured\nWeights & Biases\nWeaviate\nWolfr... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
c2ce8a2a0d13-20 | data\nBe agentic: allow a language model to interact with its environment\n\nThe LangChain framework is designed with the above principles in mind.\nThis is the Python specific portion of the documentation. For a purely conceptual guide to LangChain, see here. For the JavaScript documentation, see here.\n\nGetting Star... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
c2ce8a2a0d13-21 | that use memory.\nIndexes: Language models are often more powerful when combined with your own text data - this module covers best practices for doing exactly that.\nChains: Chains go beyond just a single LLM call, and are sequences of calls (whether to an LLM or a different utility). LangChain provides a standard inte... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
c2ce8a2a0d13-22 | have knowledge about your data.\nQuestion Answering: The second big LangChain use case. Answering questions over specific documents, only utilizing the information in those documents to construct an answer.\nChatbots: Since language models are good at producing text, that makes them ideal for creating chatbots.\nQueryi... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
c2ce8a2a0d13-23 | assisting in this.\n\n\n\n\n\nReference Docs#\nAll of LangChain’s reference documentation, in one place. Full documentation on all methods, classes, installation methods, and integration setups for LangChain.\n\nReference Documentation\n\n\n\n\n\nLangChain Ecosystem#\nGuides for how other companies/products can be used... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
c2ce8a2a0d13-24 | prompts, models, and chains is a big part of developing the best possible application. The ModelLaboratory makes it easy to do so.\nDiscord: Join us on our Discord to discuss all things LangChain!\nProduction Support: As you move your LangChains into production, we’d love to offer more comprehensive support. Please fil... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
c2ce8a2a0d13-25 | previous
s3 File
next
Slack (Local Exported Zipfile)
Contents
Filtering sitemap URLs
By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Apr 28, 2023. | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
e5cd2761d693-0 | .ipynb
.pdf
Directory Loader
Contents
Show a progress bar
Change loader class
Directory Loader#
This covers how to use the DirectoryLoader to load all documents in a directory. Under the hood, by default this uses the UnstructuredLoader
from langchain.document_loaders import DirectoryLoader
We can use the glob parame... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/directory_loader.html |
e5cd2761d693-1 | Diffbot
next
Discord
Contents
Show a progress bar
Change loader class
By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Apr 28, 2023. | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/directory_loader.html |
c605775a53b9-0 | .ipynb
.pdf
DataFrame Loader
DataFrame Loader#
This notebook goes over how to load data from a pandas dataframe
import pandas as pd
df = pd.read_csv('example_data/mlb_teams_2012.csv')
df.head()
Team
"Payroll (millions)"
"Wins"
0
Nationals
81.34
98
1
Reds
82.20
97
2
Yankees
197.96
95
3
Giants
117.62
94
4
Braves
83.31
94... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/dataframe.html |
c605775a53b9-1 | Document(page_content='Rays', metadata={' "Payroll (millions)"': 64.17, ' "Wins"': 90}),
Document(page_content='Angels', metadata={' "Payroll (millions)"': 154.49, ' "Wins"': 89}),
Document(page_content='Tigers', metadata={' "Payroll (millions)"': 132.3, ' "Wins"': 88}),
Document(page_content='Cardinals', metadata={... | https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/dataframe.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.