id stringlengths 14 16 | text stringlengths 31 2.73k | source stringlengths 88 153 |
|---|---|---|
d970eff1c754-1 | # it is provided as a default value if none is specified.
# get_text_length: Callable[[str], int] = lambda x: len(re.split("\n| ", x))
)
dynamic_prompt = FewShotPromptTemplate(
# We provide an ExampleSelector instead of examples.
example_selector=example_selector,
example_prompt=example_prompt,
pref... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/prompts/example_selectors/examples/length_based.html |
d970eff1c754-2 | Input: sunny
Output: gloomy
Input: windy
Output: calm
Input: big
Output: small
Input: enthusiastic
Output:
previous
How to create a custom example selector
next
Maximal Marginal Relevance ExampleSelector
By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Apr 05, 2023. | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/prompts/example_selectors/examples/length_based.html |
c872b9d99ce9-0 | .ipynb
.pdf
Maximal Marginal Relevance ExampleSelector
Maximal Marginal Relevance ExampleSelector#
The MaxMarginalRelevanceExampleSelector selects examples based on a combination of which examples are most similar to the inputs, while also optimizing for diversity. It does this by finding the examples with the embeddin... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/prompts/example_selectors/examples/mmr.html |
c872b9d99ce9-1 | k=2
)
mmr_prompt = FewShotPromptTemplate(
# We provide an ExampleSelector instead of examples.
example_selector=example_selector,
example_prompt=example_prompt,
prefix="Give the antonym of every input",
suffix="Input: {adjective}\nOutput:",
input_variables=["adjective"],
)
# Input is a feeling,... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/prompts/example_selectors/examples/mmr.html |
42ab5ccc0c9b-0 | .ipynb
.pdf
NGram Overlap ExampleSelector
NGram Overlap ExampleSelector#
The NGramOverlapExampleSelector selects and orders examples based on which examples are most similar to the input, according to an ngram overlap score. The ngram overlap score is a float between 0.0 and 1.0, inclusive.
The selector allows for a th... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/prompts/example_selectors/examples/ngram_overlap.html |
42ab5ccc0c9b-1 | {"input": "Spot can run.", "output": "Spot puede correr."},
]
example_prompt = PromptTemplate(
input_variables=["input", "output"],
template="Input: {input}\nOutput: {output}",
)
example_selector = NGramOverlapExampleSelector(
# These are the examples it has available to choose from.
examples=examples, ... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/prompts/example_selectors/examples/ngram_overlap.html |
42ab5ccc0c9b-2 | Output: Ver correr a Spot.
Input: My dog barks.
Output: Mi perro ladra.
Input: Spot can run fast.
Output:
# You can add examples to NGramOverlapExampleSelector as well.
new_example = {"input": "Spot plays fetch.", "output": "Spot juega a buscar."}
example_selector.add_example(new_example)
print(dynamic_prompt.format(se... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/prompts/example_selectors/examples/ngram_overlap.html |
42ab5ccc0c9b-3 | Input: Spot plays fetch.
Output: Spot juega a buscar.
Input: Spot can play fetch.
Output:
# Setting threshold greater than 1.0
example_selector.threshold=1.0+1e-9
print(dynamic_prompt.format(sentence="Spot can play fetch."))
Give the Spanish translation of every input
Input: Spot can play fetch.
Output:
previous
Maxima... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/prompts/example_selectors/examples/ngram_overlap.html |
1c922a5ca8a2-0 | .ipynb
.pdf
Similarity ExampleSelector
Similarity ExampleSelector#
The SemanticSimilarityExampleSelector selects examples based on which examples are most similar to the inputs. It does this by finding the examples with the embeddings that have the greatest cosine similarity with the inputs.
from langchain.prompts.exam... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/prompts/example_selectors/examples/similarity.html |
1c922a5ca8a2-1 | example_prompt=example_prompt,
prefix="Give the antonym of every input",
suffix="Input: {adjective}\nOutput:",
input_variables=["adjective"],
)
Running Chroma using direct local API.
Using DuckDB in-memory for database. Data will be transient.
# Input is a feeling, so should select the happy/sad example
pr... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/prompts/example_selectors/examples/similarity.html |
2ba15d19f28e-0 | .ipynb
.pdf
Output Parsers
Output Parsers#
Language models output text. But many times you may want to get more structured information than just text back. This is where output parsers come in.
Output parsers are classes that help structure language model responses. There are two main methods an output parser must impl... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/prompts/output_parsers/getting_started.html |
2ba15d19f28e-1 | punchline: str = Field(description="answer to resolve the joke")
# You can add custom validation logic easily with Pydantic.
@validator('setup')
def question_ends_with_question_mark(cls, field):
if field[-1] != '?':
raise ValueError("Badly formed question!")
return field
# S... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/prompts/output_parsers/getting_started.html |
bbe15b9b1675-0 | .ipynb
.pdf
CommaSeparatedListOutputParser
CommaSeparatedListOutputParser#
Here’s another parser strictly less powerful than Pydantic/JSON parsing.
from langchain.output_parsers import CommaSeparatedListOutputParser
from langchain.prompts import PromptTemplate, ChatPromptTemplate, HumanMessagePromptTemplate
from langch... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/prompts/output_parsers/examples/comma_separated.html |
1f4b31e88ab5-0 | .ipynb
.pdf
OutputFixingParser
OutputFixingParser#
This output parser wraps another output parser and tries to fix any mmistakes
The Pydantic guardrail simply tries to parse the LLM response. If it does not parse correctly, then it errors.
But we can do other things besides throw errors. Specifically, we can pass the m... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/prompts/output_parsers/examples/output_fixing_parser.html |
1f4b31e88ab5-1 | 24 return self.pydantic_object.parse_obj(json_object)
File ~/.pyenv/versions/3.9.1/lib/python3.9/json/__init__.py:346, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
343 if (cls is None and object_hook is None and
344 parse_int is None and parse_float is N... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/prompts/output_parsers/examples/output_fixing_parser.html |
1f4b31e88ab5-2 | Cell In[6], line 1
----> 1 parser.parse(misformatted)
File ~/workplace/langchain/langchain/output_parsers/pydantic.py:29, in PydanticOutputParser.parse(self, text)
27 name = self.pydantic_object.__name__
28 msg = f"Failed to parse {name} from completion {text}. Got: {e}"
---> 29 raise OutputParserException(ms... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/prompts/output_parsers/examples/output_fixing_parser.html |
c29ada11d516-0 | .ipynb
.pdf
PydanticOutputParser
PydanticOutputParser#
This output parser allows users to specify an arbitrary JSON schema and query LLMs for JSON outputs that conform to that schema.
Keep in mind that large language models are leaky abstractions! You’ll have to use an LLM with sufficient capacity to generate well-form... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/prompts/output_parsers/examples/pydantic.html |
c29ada11d516-1 | prompt = PromptTemplate(
template="Answer the user query.\n{format_instructions}\n{query}\n",
input_variables=["query"],
partial_variables={"format_instructions": parser.get_format_instructions()}
)
_input = prompt.format_prompt(query=joke_query)
output = model(_input.to_string())
parser.parse(output)
Joke(... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/prompts/output_parsers/examples/pydantic.html |
9838be38eec9-0 | .ipynb
.pdf
RetryOutputParser
RetryOutputParser#
While in some cases it is possible to fix any parsing mistakes by only looking at the output, in other cases it can’t. An example of this is when the output is not just in the incorrect format, but is partially complete. Consider the below example.
from langchain.prompts... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/prompts/output_parsers/examples/retry.html |
9838be38eec9-1 | 23 json_object = json.loads(json_str)
---> 24 return self.pydantic_object.parse_obj(json_object)
26 except (json.JSONDecodeError, ValidationError) as e:
File ~/.pyenv/versions/3.9.1/envs/langchain/lib/python3.9/site-packages/pydantic/main.py:527, in pydantic.main.BaseModel.parse_obj()
File ~/.pyenv/version... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/prompts/output_parsers/examples/retry.html |
9838be38eec9-2 | fix_parser.parse(bad_response)
Action(action='search', action_input='')
Instead, we can use the RetryOutputParser, which passes in the prompt (as well as the original output) to try again to get a better response.
from langchain.output_parsers import RetryWithErrorOutputParser
retry_parser = RetryWithErrorOutputParser.... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/prompts/output_parsers/examples/retry.html |
ce854ab4c313-0 | .ipynb
.pdf
Structured Output Parser
Structured Output Parser#
While the Pydantic/JSON parser is more powerful, we initially experimented data structures having text fields only.
from langchain.output_parsers import StructuredOutputParser, ResponseSchema
from langchain.prompts import PromptTemplate, ChatPromptTemplate,... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/prompts/output_parsers/examples/structured.html |
ce854ab4c313-1 | ],
input_variables=["question"],
partial_variables={"format_instructions": format_instructions}
)
_input = prompt.format_prompt(question="what's the capital of france")
output = chat_model(_input.to_messages())
output_parser.parse(output.content)
{'answer': 'Paris', 'source': 'https://en.wikipedia.org/wiki/Pari... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/prompts/output_parsers/examples/structured.html |
81efa716ab21-0 | .ipynb
.pdf
Getting Started
Contents
One Line Index Creation
Walkthrough
Getting Started#
LangChain primary focuses on constructing indexes with the goal of using them as a Retriever. In order to best understand what this means, it’s worth highlighting what the base Retriever interface is. The BaseRetriever class in ... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/getting_started.html |
81efa716ab21-1 | Create a Retriever from that index
Create a question answering chain
Ask questions!
Each of the steps has multiple sub steps and potential configurations. In this notebook we will primarily focus on (1). We will start by showing the one-liner for doing so, but then break down what is actually going on.
First, let’s imp... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/getting_started.html |
81efa716ab21-2 | index.query_with_sources(query)
{'question': 'What did the president say about Ketanji Brown Jackson',
'answer': " The president said that he nominated Circuit Court of Appeals Judge Ketanji Brown Jackson, one of the nation's top legal minds, to continue Justice Breyer's legacy of excellence, and that she has received... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/getting_started.html |
81efa716ab21-3 | We will then select which embeddings we want to use.
from langchain.embeddings import OpenAIEmbeddings
embeddings = OpenAIEmbeddings()
We now create the vectorstore to use as the index.
from langchain.vectorstores import Chroma
db = Chroma.from_documents(texts, embeddings)
Running Chroma using direct local API.
Using D... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/getting_started.html |
81efa716ab21-4 | )
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.
previous
Indexes
next
Document Loaders
Contents
One Line Index Creation
Walkthrough... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/getting_started.html |
95498918f74c-0 | .rst
.pdf
Document Loaders
Document Loaders#
Note
Conceptual Guide
Combining language models with your own text data is a powerful way to differentiate them.
The first step in doing this is to load the data into “documents” - a fancy way of say some pieces of text.
This module is aimed at making this easy.
A primary dr... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders.html |
a821905b821c-0 | .rst
.pdf
Text Splitters
Text Splitters#
Note
Conceptual Guide
When you want to deal with long pieces of text, it is necessary to split up that text into chunks.
As simple as this sounds, there is a lot of potential complexity here. Ideally, you want to keep the semantically related pieces of text together. What “seman... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/text_splitters.html |
d3328e5c5341-0 | .rst
.pdf
Vectorstores
Vectorstores#
Note
Conceptual Guide
Vectorstores are one of the most important components of building indexes.
For an introduction to vectorstores and generic functionality see:
Getting Started
We also have documentation for all the types of vectorstores that are supported.
Please see below for t... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/vectorstores.html |
a2f06f6d07bf-0 | .rst
.pdf
Retrievers
Retrievers#
Note
Conceptual Guide
The retriever interface is a generic interface that makes it easy to combine documents with
language models. This interface exposes a get_relevant_documents method which takes in a query
(a string) and returns a list of documents.
Please see below for a list of all... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/retrievers.html |
5843ba6bfc76-0 | .ipynb
.pdf
CoNLL-U
CoNLL-U#
This is an example of how to load a file in CoNLL-U format. The whole file is treated as one document. The example data (conllu.conllu) is based on one of the standard UD/CoNLL-U examples.
from langchain.document_loaders import CoNLLULoader
loader = CoNLLULoader("example_data/conllu.conllu"... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/CoNLL-U.html |
2700c4e7c5dd-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... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/airbyte_json.html |
2700c4e7c5dd-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... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/airbyte_json.html |
6de7d2731352-0 | .ipynb
.pdf
Apify Dataset
Contents
Prerequisites
An example with question answering
Apify Dataset#
This notebook shows how to load Apify datasets to LangChain.
Apify Dataset is a scaleable append-only storage with sequential access built for storing structured web scraping results, such as a list of products or Googl... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/apify_dataset.html |
6de7d2731352-1 | from langchain.docstore.document import Document
from langchain.document_loaders import ApifyDatasetLoader
from langchain.indexes import VectorstoreIndexCreator
loader = ApifyDatasetLoader(
dataset_id="your-dataset-id",
dataset_mapping_function=lambda item: Document(
page_content=item["text"] or "", met... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/apify_dataset.html |
cf410a661521-0 | .ipynb
.pdf
AZLyrics
AZLyrics#
This covers how to load AZLyrics webpages into a document format that we can use downstream.
from langchain.document_loaders import AZLyricsLoader
loader = AZLyricsLoader("https://www.azlyrics.com/lyrics/mileycyrus/flowers.html")
data = loader.load()
data | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/azlyrics.html |
cf410a661521-1 | [Document(page_content="Miley Cyrus - Flowers Lyrics | AZLyrics.com\n\r\nWe were good, we were gold\nKinda dream that can't be sold\nWe were right till we weren't\nBuilt a home and watched it burn\n\nI didn't wanna leave you\nI didn't wanna lie\nStarted to cry but then remembered I\n\nI can buy myself flowers\nWrite my... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/azlyrics.html |
cf410a661521-2 | to myself for hours, yeah\nSay things you don't understand\nI can take myself dancing\nAnd I can hold my own hand\nYeah, I can love me better than you can\n\nCan love me better\nI can love me better, baby\nCan love me better\nI can love me better, baby\nCan love me better\nI can love me better, baby\nCan love me better... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/azlyrics.html |
cf410a661521-3 | love me better\nI\n", lookup_str='', metadata={'source': 'https://www.azlyrics.com/lyrics/mileycyrus/flowers.html'}, lookup_index=0)] | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/azlyrics.html |
cf410a661521-4 | previous
Apify Dataset
next
Azure Blob Storage Container
By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Apr 05, 2023. | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/azlyrics.html |
c51609c539cf-0 | .ipynb
.pdf
Azure Blob Storage Container
Contents
Specifying a prefix
Azure Blob Storage Container#
This covers how to load document objects from a container on Azure Blob Storage.
from langchain.document_loaders import AzureBlobStorageContainerLoader
#!pip install azure-storage-blob
loader = AzureBlobStorageContaine... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/azure_blob_storage_container.html |
94e4a762e301-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... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/azure_blob_storage_file.html |
8ce5ce8a9cf2-0 | .ipynb
.pdf
BigQuery Loader
Contents
Basic Usage
Specifying Which Columns are Content vs Metadata
Adding Source to Metadata
BigQuery Loader#
Load a BigQuery query with one document per row.
from langchain.document_loaders import BigQueryLoader
BASE_QUERY = '''
SELECT
id,
dna_sequence,
organism
FROM (
SELECT
... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/bigquery.html |
8ce5ce8a9cf2-1 | Specifying Which Columns are Content vs Metadata#
loader = BigQueryLoader(BASE_QUERY, page_content_columns=["dna_sequence", "organism"], metadata_columns=["id"])
data = loader.load()
print(data)
[Document(page_content='dna_sequence: ATTCGA\norganism: Lokiarchaeum sp. (strain GC14_75).', lookup_str='', metadata={'id': 1... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/bigquery.html |
8ce5ce8a9cf2-2 | data = loader.load()
print(data)
[Document(page_content='id: 1\ndna_sequence: ATTCGA\norganism: Lokiarchaeum sp. (strain GC14_75).\nsource: 1', lookup_str='', metadata={'source': 1}, lookup_index=0), Document(page_content='id: 2\ndna_sequence: AGGCGA\norganism: Heimdallarchaeota archaeon (strain LC_2).\nsource: 2', loo... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/bigquery.html |
1d10d24ea88f-0 | .ipynb
.pdf
Blackboard
Blackboard#
This covers how to load data from a Blackboard Learn instance.
from langchain.document_loaders import BlackboardLoader
loader = BlackboardLoader(
blackboard_course_url="https://blackboard.example.com/webapps/blackboard/execute/announcement?method=search&context=course_entry&course... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/blackboard.html |
bef752ed6d7a-0 | .ipynb
.pdf
College Confidential
College Confidential#
This covers how to load College Confidential webpages into a document format that we can use downstream.
from langchain.document_loaders import CollegeConfidentialLoader
loader = CollegeConfidentialLoader("https://www.collegeconfidential.com/colleges/brown-universi... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/college_confidential.html |
bef752ed6d7a-1 | [Document(page_content='\n\n\n\n\n\n\n\nA68FEB02-9D19-447C-B8BC-818149FD6EAF\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n Media (2)\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nE45B8B13-33D4-450E-B7DB-F66EFE8F2097\n\n\n\n\n\n\n\n\n\nE45B8B13-33D4-450E-B7DB-F66EFE8F2097\n\n\n\n\n\n\n\n\n\n\n\n\n\... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/college_confidential.html |
bef752ed6d7a-2 | students to get involved at Brown! \nLove music or performing? Join a campus band, sing in a chorus, or perform with one of the school\'s theater groups.\nInterested in journalism or communications? Brown students can write for the campus newspaper, host a radio show or be a producer for the student-run television chan... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/college_confidential.html |
bef752ed6d7a-3 | "good" school. Some factors that can help you determine what a good school for you might be include admissions criteria, acceptance rate, tuition costs, and more.\nLet\'s take a look at these factors to get a clearer sense of what Brown offers and if it could be the right college for you.\nBrown Acceptance Rate 2022\nI... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/college_confidential.html |
bef752ed6d7a-4 | six-year graduation rate for U.S. colleges and universities is 61% for public schools, and 67% for private, non-profit schools.\nJob Outcomes for Brown Grads\nJob placement stats are a good resource for understanding the value of a degree from Brown by providing a look on how job placement has gone for other grads. \nC... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/college_confidential.html |
bef752ed6d7a-5 | Financial Aid at Brown\nTuition is another important factor when choose a college. Some colleges may have high tuition, but do a better job at meeting students\' financial need.\nBrown meets 100% of the demonstrated financial need for undergraduates. The average financial aid package for a full-time, first-year studen... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/college_confidential.html |
bef752ed6d7a-6 | so be very wary of anyone asking you for money.\nLearn more about Tuition and Financial Aid at Brown.\nBased on this information, does Brown seem like a good fit? Remember, a school that is perfect for one person may be a terrible fit for someone else! So ask yourself: Is Brown a good school for you?\nIf Brown Universi... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/college_confidential.html |
bef752ed6d7a-7 | best way to reach campus is to take Interstate 95 to Providence, or book a flight to the nearest airport, T.F. Green.\nYou can also take a virtual campus tour to get a sense of what Brown and Providence are like without leaving home.\nConsidering Going to School in Rhode Island?\nSee a full list of colleges in Rhode Is... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/college_confidential.html |
bef752ed6d7a-8 | \n\n Virtual Tour\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nBrown Application Deadline\n\n\n\nFirst-Year Applications are Due\n\nJan 5\n\nTransfer Applications are Due\n\nMar 1\n\n\n\n \n The deadline for Fall first-year applications to Brown is \n ... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/college_confidential.html |
bef752ed6d7a-9 | for more information about deadlines for specific programs or special admissions programs\n \n \n\n\n\n\n\n\nBrown ACT Scores\n\n\n\n\nic_reflect\n\n\n\n\n\n\n\n\nACT Range\n\n\n \n 33 - 35\n \n \n\n\n\nEstimated Chance of Acceptanc... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/college_confidential.html |
bef752ed6d7a-10 | 720 - 770\n \n \n\n\n\nic_reflect\n\n\n\n\n\n\n\n\nMath SAT Range\n\n\n \n Not available\n \n \n\n\n\nic_reflect\n\n\n\n\n\n\n\n\nReading SAT Range\n\n\n \n 740 - 800\n... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/college_confidential.html |
bef752ed6d7a-11 | $82,286\n \nOut-of-State\n\n\n\n\n\n\n\nCost Breakdown\n\n\nIn State\n\n\nOut-of-State\n\n\n\n\nState Tuition\n\n\n\n $62,680\n \n\n\n\n $62,680\n \n\n\n\n\nFees\n\n\n\n $2,4... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/college_confidential.html |
bef752ed6d7a-12 | \n\n\n\n $15,840\n \n\n\n\n\nBooks\n\n\n\n $1,300\n \n\n\n\n $1,300\n \n\n\n\n\n\n Total (Before Financial Aid):\n \n\n\... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/college_confidential.html |
bef752ed6d7a-13 | \n\n\n\n\n\n\n\n\n\n\n\nStudent Life\n\n Wondering what life at Brown is like? There are approximately \n 10,696 students enrolled at \n Brown, \n including 7,349 undergraduate students and \n 3,347 graduate students.\n 96% percent of students attend school \n full-time... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/college_confidential.html |
bef752ed6d7a-14 | 4%\n \nPart Time\n\n\n\n\n\n\n\n 94%\n \n\n\n\n\nResidency\n\n\n\n 6%\n \nIn State\n\n\n\n\n 94%\n \nOut-of-State\n\n\n\n\n\n\n\n Data Source: IPEDs and Peterso... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/college_confidential.html |
bef752ed6d7a-15 | previous
Blackboard
next
Copy Paste
By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Apr 05, 2023. | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/college_confidential.html |
aa9edb85416c-0 | .ipynb
.pdf
Copy Paste
Contents
Metadata
Copy Paste#
This notebook covers how to load a document object from something you just want to copy and paste. In this case, you don’t even need to use a DocumentLoader, but rather can just construct the Document directly.
from langchain.docstore.document import Document
text ... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/copypaste.html |
609997a46efa-0 | .ipynb
.pdf
CSV Loader
Contents
CSV Loader
Customizing the csv parsing and loading
Specify a column to be used identify the document source
CSV Loader#
Load csv files with a single row per document.
from langchain.document_loaders.csv_loader import CSVLoader
loader = CSVLoader(file_path='./example_data/mlb_teams_2012... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/csv.html |
609997a46efa-1 | [Document(page_content='Team: Nationals\n"Payroll (millions)": 81.34\n"Wins": 98', lookup_str='', metadata={'source': './example_data/mlb_teams_2012.csv', 'row': 0}, lookup_index=0), Document(page_content='Team: Reds\n"Payroll (millions)": 82.20\n"Wins": 97', lookup_str='', metadata={'source': './example_data/mlb_teams... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/csv.html |
609997a46efa-2 | lookup_index=0), Document(page_content='Team: Rangers\n"Payroll (millions)": 120.51\n"Wins": 93', lookup_str='', metadata={'source': './example_data/mlb_teams_2012.csv', 'row': 6}, lookup_index=0), Document(page_content='Team: Orioles\n"Payroll (millions)": 81.43\n"Wins": 93', lookup_str='', metadata={'source': './exam... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/csv.html |
609997a46efa-3 | 'row': 11}, lookup_index=0), Document(page_content='Team: Dodgers\n"Payroll (millions)": 95.14\n"Wins": 86', lookup_str='', metadata={'source': './example_data/mlb_teams_2012.csv', 'row': 12}, lookup_index=0), Document(page_content='Team: White Sox\n"Payroll (millions)": 96.92\n"Wins": 85', lookup_str='', metadata={'so... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/csv.html |
609997a46efa-4 | '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_content='Team: Mariners\n"Payroll (millions)": 81.97\n"Wins": 75', lookup_str='', metadata={'sour... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/csv.html |
609997a46efa-5 | 'row': 23}, lookup_index=0), Document(page_content='Team: Red 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={'sou... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/csv.html |
609997a46efa-6 | Customizing the csv parsing and loading#
See the csv module documentation for more information of what csv args are supported.
loader = CSVLoader(file_path='./example_data/mlb_teams_2012.csv', csv_args={
'delimiter': ',',
'quotechar': '"',
'fieldnames': ['MLB Team', 'Payroll in millions', 'Wins']
})
data = ... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/csv.html |
609997a46efa-7 | [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_content='MLB Team: Nationals\nPayroll in millions: 81.34\nWins: 98', lookup_str='', metadata={'source': './e... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/csv.html |
609997a46efa-8 | './example_data/mlb_teams_2012.csv', 'row': 5}, lookup_index=0), Document(page_content='MLB Team: Athletics\nPayroll 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\nW... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/csv.html |
609997a46efa-9 | in millions: 132.30\nWins: 88', lookup_str='', metadata={'source': './example_data/mlb_teams_2012.csv', 'row': 11}, lookup_index=0), Document(page_content='MLB Team: Cardinals\nPayroll in millions: 110.30\nWins: 88', lookup_str='', metadata={'source': './example_data/mlb_teams_2012.csv', 'row': 12}, lookup_index=0), Do... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/csv.html |
609997a46efa-10 | 16}, lookup_index=0), Document(page_content='MLB Team: Diamondbacks\nPayroll in millions: 74.28\nWins: 81', lookup_str='', metadata={'source': './example_data/mlb_teams_2012.csv', 'row': 17}, lookup_index=0), Document(page_content='MLB Team: Pirates\nPayroll in millions: 63.43\nWins: 79', lookup_str='', metadata={'sour... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/csv.html |
609997a46efa-11 | metadata={'source': './example_data/mlb_teams_2012.csv', 'row': 22}, lookup_index=0), Document(page_content='MLB Team: Royals\nPayroll in millions: 60.91\nWins: 72', lookup_str='', metadata={'source': './example_data/mlb_teams_2012.csv', 'row': 23}, lookup_index=0), Document(page_content='MLB Team: Marlins\nPayroll in ... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/csv.html |
609997a46efa-12 | in millions: 78.06\nWins: 64', lookup_str='', metadata={'source': './example_data/mlb_teams_2012.csv', 'row': 28}, lookup_index=0), Document(page_content='MLB Team: Cubs\nPayroll in millions: 88.19\nWins: 61', lookup_str='', metadata={'source': './example_data/mlb_teams_2012.csv', 'row': 29}, lookup_index=0), Document(... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/csv.html |
609997a46efa-13 | Specify a column to be used identify the document source#
Use the source_column argument to specify a column to be set as the source for the document created from each row. Otherwise file_path will be used as the source for all documents created from the csv file.
This is useful when using documents loaded from CSV fil... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/csv.html |
609997a46efa-14 | [Document(page_content='Team: Nationals\n"Payroll (millions)": 81.34\n"Wins": 98', lookup_str='', metadata={'source': 'Nationals', 'row': 0}, lookup_index=0), Document(page_content='Team: Reds\n"Payroll (millions)": 82.20\n"Wins": 97', lookup_str='', metadata={'source': 'Reds', 'row': 1}, lookup_index=0), Document(page... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/csv.html |
609997a46efa-15 | 'row': 6}, lookup_index=0), Document(page_content='Team: Orioles\n"Payroll (millions)": 81.43\n"Wins": 93', lookup_str='', metadata={'source': 'Orioles', 'row': 7}, lookup_index=0), Document(page_content='Team: Rays\n"Payroll (millions)": 64.17\n"Wins": 90', lookup_str='', metadata={'source': 'Rays', 'row': 8}, lookup_... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/csv.html |
609997a46efa-16 | lookup_str='', metadata={'source': 'White Sox', 'row': 13}, lookup_index=0), Document(page_content='Team: Brewers\n"Payroll (millions)": 97.65\n"Wins": 83', lookup_str='', metadata={'source': 'Brewers', 'row': 14}, lookup_index=0), Document(page_content='Team: Phillies\n"Payroll (millions)": 174.54\n"Wins": 81', lookup... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/csv.html |
609997a46efa-17 | (millions)": 93.35\n"Wins": 74', lookup_str='', metadata={'source': 'Mets', 'row': 20}, lookup_index=0), Document(page_content='Team: Blue Jays\n"Payroll (millions)": 75.48\n"Wins": 73', lookup_str='', metadata={'source': 'Blue Jays', 'row': 21}, lookup_index=0), Document(page_content='Team: Royals\n"Payroll (millions)... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/csv.html |
609997a46efa-18 | lookup_index=0), Document(page_content='Team: Rockies\n"Payroll (millions)": 78.06\n"Wins": 64', lookup_str='', metadata={'source': 'Rockies', 'row': 27}, lookup_index=0), Document(page_content='Team: Cubs\n"Payroll (millions)": 88.19\n"Wins": 61', lookup_str='', metadata={'source': 'Cubs', 'row': 28}, lookup_index=0),... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/csv.html |
609997a46efa-19 | previous
Copy Paste
next
DataFrame Loader
Contents
CSV Loader
Customizing the csv parsing and loading
Specify a column to be used identify the document source
By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Apr 05, 2023. | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/csv.html |
cee26fb89f4c-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... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/dataframe.html |
cee26fb89f4c-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={... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/dataframe.html |
cee26fb89f4c-2 | Document(page_content='Mets', metadata={' "Payroll (millions)"': 93.35, ' "Wins"': 74}),
Document(page_content='Blue Jays', metadata={' "Payroll (millions)"': 75.48, ' "Wins"': 73}),
Document(page_content='Royals', metadata={' "Payroll (millions)"': 60.91, ' "Wins"': 72}),
Document(page_content='Marlins', metadata={... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/dataframe.html |
4a63c9012279-0 | .ipynb
.pdf
Directory Loader
Contents
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 parameter to control which... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/directory_loader.html |
308187032beb-0 | .ipynb
.pdf
DuckDB Loader
Contents
Specifying Which Columns are Content vs Metadata
Adding Source to Metadata
DuckDB Loader#
Load a DuckDB query with one document per row.
from langchain.document_loaders import DuckDBLoader
%%file example.csv
Team,Payroll
Nationals,81.34
Reds,82.20
Writing example.csv
loader = DuckDB... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/duckdb.html |
308187032beb-1 | Specifying Which Columns are Content vs Metadata
Adding Source to Metadata
By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Apr 05, 2023. | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/duckdb.html |
741ae46f6321-0 | .ipynb
.pdf
Email
Contents
Using Unstructured
Retain Elements
Using OutlookMessageLoader
Email#
This notebook shows how to load email (.eml) and Microsoft Outlook (.msg) files.
Using Unstructured#
from langchain.document_loaders import UnstructuredEmailLoader
loader = UnstructuredEmailLoader('example_data/fake-email.... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/email.html |
741ae46f6321-1 | previous
DuckDB Loader
next
EPubs
Contents
Using Unstructured
Retain Elements
Using OutlookMessageLoader
By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Apr 05, 2023. | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/email.html |
7fad6aac8986-0 | .ipynb
.pdf
EPubs
Contents
Retain Elements
EPubs#
This covers how to load .epub documents into a document format that we can use downstream. You’ll need to install the pandocs package for this loader to work.
from langchain.document_loaders import UnstructuredEPubLoader
loader = UnstructuredEPubLoader("winter-sports.... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/epub.html |
d3c602576681-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 ... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/evernote.html |
92ec42c7193c-0 | .ipynb
.pdf
Facebook Chat
Facebook Chat#
This notebook covers how to load data from the Facebook Chats into a format that can be ingested into LangChain.
from langchain.document_loaders import FacebookChatLoader
loader = FacebookChatLoader("example_data/facebook_chat.json")
loader.load()
[Document(page_content='User 2 ... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/facebook_chat.html |
92ec42c7193c-1 | previous
EverNote
next
Figma
By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Apr 05, 2023. | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/facebook_chat.html |
f085561b4e67-0 | .ipynb
.pdf
Figma
Figma#
This notebook covers how to load data from the Figma REST API into a format that can be ingested into LangChain, along with example usage for code generation.
import os
from langchain.document_loaders.figma import FigmaFileLoader
from langchain.text_splitter import CharacterTextSplitter
from la... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/figma.html |
f085561b4e67-1 | # See https://python.langchain.com/en/latest/modules/models/chat/getting_started.html for chat info
system_prompt_template = """You are expert coder Jon Carmack. Use the provided design context to create idomatic HTML/CSS code as possible based on the user request.
Everything must be inline in one file and your... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/figma.html |
f085561b4e67-2 | <!DOCTYPE html>\n<html lang="en">\n<head>\n <meta charset="UTF-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n <style>\n @import url(\'https://fonts.googleapis.com/css2?family=DM+Sans:wght@500;700&family=Inter:wght@600&display=swap\');\n\n body {\n margin... | /content/drive/MyDrive/Chatgpt-plugins/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/figma.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.