id
stringlengths
14
15
text
stringlengths
27
2.12k
source
stringlengths
49
118
4e582ca2c9de-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryHow to add Memory to an LLMChainHow to add memory to a Multi-Input ChainHow to add Memory to an AgentAdding Message Memory backed by a d...
https://python.langchain.com/docs/modules/memory/vectorstore_retriever_memory
4e582ca2c9de-2
= FAISS(embedding_fn, index, InMemoryDocstore({}), {})Create your the VectorStoreRetrieverMemory​The memory object is instantiated from any VectorStoreRetriever.# In actual usage, you would set `k` to be a higher value, but we use k=1 to show that# the vector lookup still returns the semantically relevant information...
https://python.langchain.com/docs/modules/memory/vectorstore_retriever_memory
4e582ca2c9de-3
conversation:Human: {input}AI:"""PROMPT = PromptTemplate( input_variables=["history", "input"], template=_DEFAULT_TEMPLATE)conversation_with_summary = ConversationChain( llm=llm, prompt=PROMPT, # We set a very low max_token_limit for the purposes of testing. memory=memory, verbose=True)conversation_w...
https://python.langchain.com/docs/modules/memory/vectorstore_retriever_memory
4e582ca2c9de-4
does not know the answer to a question, it truthfully says it does not know. Relevant pieces of previous conversation: input: My favorite sport is soccer output: ... (You do not need to use these pieces of information if not relevant) Current conversation: Human: what's my favorite sport? ...
https://python.langchain.com/docs/modules/memory/vectorstore_retriever_memory
4e582ca2c9de-5
the user's name.conversation_with_summary.predict(input="What's my name?") > Entering new ConversationChain chain... Prompt after formatting: The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does no...
https://python.langchain.com/docs/modules/memory/vectorstore_retriever_memory
8782c9000d76-0
Conversation Knowledge Graph Memory | 🦜�🔗 Langchain
https://python.langchain.com/docs/modules/memory/kg
8782c9000d76-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryHow to add Memory to an LLMChainHow to add memory to a Multi-Input ChainHow to add Memory to an AgentAdding Message Memory backed by a d...
https://python.langchain.com/docs/modules/memory/kg
8782c9000d76-2
sam"}) {'history': [SystemMessage(content='On Sam: Sam is friend.', additional_kwargs={})]}We can also more modularly get current entities from a new message (will use previous messages as context.)memory.get_current_entities("what's Sams favorite color?") ['Sam']We can also more modularly get knowledge triplets ...
https://python.langchain.com/docs/modules/memory/kg
8782c9000d76-3
does not know the answer to a question, it truthfully says it does not know. The AI ONLY uses information contained in the "Relevant Information" section and does not hallucinate. Relevant Information: Conversation: Human: Hi, what's up? AI: > Finished chain. " Hi there! I'm doing ...
https://python.langchain.com/docs/modules/memory/kg
8782c9000d76-4
Will?") > Entering new ConversationChain chain... Prompt after formatting: The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not...
https://python.langchain.com/docs/modules/memory/kg
9c04b0c7c82f-0
How to customize conversational memory | 🦜�🔗 Langchain
https://python.langchain.com/docs/modules/memory/conversational_customization
9c04b0c7c82f-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryHow to add Memory to an LLMChainHow to add memory to a Multi-Input ChainHow to add Memory to an AgentAdding Message Memory backed by a d...
https://python.langchain.com/docs/modules/memory/conversational_customization
9c04b0c7c82f-2
is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know. Current conversation: Human: Hi there! AI: > Finished ConversationChain chain. " Hi there! It's nice to meet you. How can I help you toda...
https://python.langchain.com/docs/modules/memory/conversational_customization
9c04b0c7c82f-3
Assistant:"""PROMPT = PromptTemplate(input_variables=["history", "input"], template=template)conversation = ConversationChain( prompt=PROMPT, llm=llm, verbose=True, memory=ConversationBufferMemory(ai_prefix="AI Assistant"),)conversation.predict(input="Hi there!") > Entering new ConversationChain ...
https://python.langchain.com/docs/modules/memory/conversational_customization
9c04b0c7c82f-4
weather is sunny and warm with a temperature of 75 degrees Fahrenheit. The forecast for the rest of the day is sunny with a high of 78 degrees and a low of 65 degrees.'Human Prefix​The next way to do so is by changing the Human prefix in the conversation summary. By default, this is set to "Human", but you can set th...
https://python.langchain.com/docs/modules/memory/conversational_customization
9c04b0c7c82f-5
> Finished ConversationChain chain. " Hi there! It's nice to meet you. How can I help you today?"conversation.predict(input="What's the weather?") > Entering new ConversationChain chain... Prompt after formatting: The following is a friendly conversation between a human and an AI. The AI is talkativ...
https://python.langchain.com/docs/modules/memory/conversational_customization
a57012f3c864-0
Entity memory | 🦜�🔗 Langchain
https://python.langchain.com/docs/modules/memory/entity_summary_memory
a57012f3c864-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryHow to add Memory to an LLMChainHow to add memory to a Multi-Input ChainHow to add Memory to an AgentAdding Message Memory backed by a d...
https://python.langchain.com/docs/modules/memory/entity_summary_memory
a57012f3c864-2
= ConversationEntityMemory(llm=llm, return_messages=True)_input = {"input": "Deven & Sam are working on a hackathon project"}memory.load_memory_variables(_input)memory.save_context( _input, {"output": " That sounds like a great project! What kind of project are they working on?"})memory.load_memory_variables({"in...
https://python.langchain.com/docs/modules/memory/entity_summary_memory
a57012f3c864-3
language model, you are able to generate human-like text based on the input you receive, allowing you to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand. You are constantly learning and improving, and your capabilities are constantly evolving. Yo...
https://python.langchain.com/docs/modules/memory/entity_summary_memory
a57012f3c864-4
are trying to add more complex memory structures to Langchain") > Entering new ConversationChain chain... Prompt after formatting: You are an assistant to a human, powered by a large language model trained by OpenAI. You are designed to be able to assist with a wide range of tasks, from answerin...
https://python.langchain.com/docs/modules/memory/entity_summary_memory
a57012f3c864-5
Human: Deven & Sam are working on a hackathon project AI: That sounds like a great project! What kind of project are they working on? Last line: Human: They are trying to add more complex memory structures to Langchain You: > Finished chain. ' That sounds like an interesting project! What kind of...
https://python.langchain.com/docs/modules/memory/entity_summary_memory
a57012f3c864-6
and information on a wide range of topics. Whether the human needs help with a specific question or just wants to have a conversation about a particular topic, you are here to assist. Context: {'Deven': 'Deven is working on a hackathon project with Sam, which they are entering into a hackathon. They are tryin...
https://python.langchain.com/docs/modules/memory/entity_summary_memory
a57012f3c864-7
tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, you are able to generate human-like text based on the input you receive, allowing you to engage in natural-sounding conversations and provide responses that are coherent and relevant...
https://python.langchain.com/docs/modules/memory/entity_summary_memory
a57012f3c864-8
are they working on? Human: They are trying to add more complex memory structures to Langchain AI: That sounds like an interesting project! What kind of memory structures are they trying to add? Human: They are adding in a key-value store for entities mentioned so far in the conversation. AI: That sounds ...
https://python.langchain.com/docs/modules/memory/entity_summary_memory
a57012f3c864-9
' 'working hard on this project with a great idea for how the ' 'key-value store can help.', 'Key-Value Store': 'A key-value store is being added to the project to store ' 'entities mentioned in the conversation.', 'Langchain': 'Langchain is a project that is try...
https://python.langchain.com/docs/modules/memory/entity_summary_memory
a57012f3c864-10
to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, you are able to generate human-like text based on the input you receive, allowing you to engage in natural-sounding conversations and provid...
https://python.langchain.com/docs/modules/memory/entity_summary_memory
a57012f3c864-11
That sounds like a great idea! How will the key-value store help with the project? Human: What do you know about Deven & Sam? AI: Deven and Sam are working on a hackathon project together, trying to add more complex memory structures to Langchain, including a key-value store for entities mentioned so far in the ...
https://python.langchain.com/docs/modules/memory/entity_summary_memory
a57012f3c864-12
including a key-value store for ' 'entities mentioned so far in the conversation, and seem to be ' 'working hard on this project with a great idea for how the ' 'key-value store can help.', 'Key-Value Store': 'A key-value store is being added to the project to store ' ...
https://python.langchain.com/docs/modules/memory/entity_summary_memory
a57012f3c864-13
You are an assistant to a human, powered by a large language model trained by OpenAI. You are designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, you are able to generate human...
https://python.langchain.com/docs/modules/memory/entity_summary_memory
a57012f3c864-14
Langchain, including a key-value store for entities mentioned so far in the conversation. They seem to have a great idea for how the key-value store can help, and Sam is also the founder of a successful company called Daimon.', 'Langchain': 'Langchain is a project that is trying to add more complex memory structures, i...
https://python.langchain.com/docs/modules/memory/entity_summary_memory
a57012f3c864-15
memory structures to Langchain. They seem to have a great idea for how the key-value store can help.'PreviousHow to create a custom Memory classNextConversation Knowledge Graph MemoryCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright © 2023 LangChain, Inc.
https://python.langchain.com/docs/modules/memory/entity_summary_memory
d2149f47005e-0
How to add Memory to an Agent | 🦜�🔗 Langchain
https://python.langchain.com/docs/modules/memory/agent_with_memory
d2149f47005e-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionChainsMemoryHow to add Memory to an LLMChainHow to add memory to a Multi-Input ChainHow to add Memory to an AgentAdding Message Memory backed by a d...
https://python.langchain.com/docs/modules/memory/agent_with_memory
d2149f47005e-2
questions about current events", )]Notice the usage of the chat_history variable in the PromptTemplate, which matches up with the dynamic key name in the ConversationBufferMemory.prefix = """Have a conversation with a human, answering the following questions as best you can. You have access to the following tools:""...
https://python.langchain.com/docs/modules/memory/agent_with_memory
d2149f47005e-3
conducted by Statistics Canada provides a statistical portrait of Canada and its ... 14 records ... Estimated number of persons by quarter of a year and by year, Canada, provinces and territories. The 2021 Canadian census counted a total population of 36,991,981, an increase of around 5.2 percent over the 2016 figure....
https://python.langchain.com/docs/modules/memory/agent_with_memory
d2149f47005e-4
answered correctly.agent_chain.run(input="what is their national anthem called?") > Entering new AgentExecutor chain... Thought: I need to find out what the national anthem of Canada is called. Action: Search Action Input: National Anthem of Canada Observation: Jun 7, 2010 ... https://twitter.com...
https://python.langchain.com/docs/modules/memory/agent_with_memory
d2149f47005e-5
as a distinct category from British or French patriotism, preceding the first legal steps to ... Feb 4, 2022 ... English version: O Canada! Our home and native land! True patriot love in all of us command. With glowing hearts we ... Feb 1, 2018 ... Canada's Senate has passed a bill making the country's national anthe...
https://python.langchain.com/docs/modules/memory/agent_with_memory
d2149f47005e-6
find out the population of Canada Action: Search Action Input: Population of Canada Observation: The current population of Canada is 38,566,192 as of Saturday, December 31, 2022, based on Worldometer elaboration of the latest United Nations data. · Canada ... Additional information related to Canadian popula...
https://python.langchain.com/docs/modules/memory/agent_with_memory
d2149f47005e-7
The current population of Canada is 38,566,192 as of Saturday, December 31, 2022, based on Worldometer elaboration of the latest United Nations data. > Finished AgentExecutor chain. 'The current population of Canada is 38,566,192 as of Saturday, December 31, 2022, based on Worldometer elaboration of the latest Un...
https://python.langchain.com/docs/modules/memory/agent_with_memory
d2149f47005e-8
You can find an anthem in the menu at the top alphabetically or you can use the search feature. This site is focussed on the scholarly study of national anthems ... Feb 13, 2022 ... The 38-year-old country music artist had the honor of singing the National Anthem during this year's big game, and she did not disappoint...
https://python.langchain.com/docs/modules/memory/agent_with_memory
04ec225129ab-0
Data connection | 🦜�🔗 Langchain Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionDocument loadersDocument transformersText embedding modelsVector storesRetrieversChainsMemoryAgentsCall...
https://python.langchain.com/docs/modules/data_connection/
2e669cfb1afb-0
Document transformers | 🦜�🔗 Langchain
https://python.langchain.com/docs/modules/data_connection/document_transformers/
2e669cfb1afb-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionDocument loadersDocument transformersText splittersPost retrievalText embedding modelsVector storesRetrieversChainsMemoryAgentsCallbacksModulesGuide...
https://python.langchain.com/docs/modules/data_connection/document_transformers/
2e669cfb1afb-2
This notebook showcases several ways to do that.At a high level, text splitters work as following:Split the text up into small, semantically meaningful chunks (often sentences).Start combining these small chunks into a larger chunk until you reach a certain size (as measured by some function).Once you reach that size, ...
https://python.langchain.com/docs/modules/data_connection/document_transformers/
2e669cfb1afb-3
a really small chunk size, just to show. chunk_size = 100, chunk_overlap = 20, length_function = len, add_start_index = True,)texts = text_splitter.create_documents([state_of_the_union])print(texts[0])print(texts[1]) page_content='Madam Speaker, Madam Vice President, our First Lady and Second Gentleman....
https://python.langchain.com/docs/modules/data_connection/document_transformers/
2e669cfb1afb-4
EmbeddingsRedundantFilter we can identify similar documents and filter out redundancies. With integrations like doctran we can do things like translate documents from one language to another, extract desired properties and add them to metadata, and convert conversational dialogue into a Q/A format set of documents.Prev...
https://python.langchain.com/docs/modules/data_connection/document_transformers/
111793c1128f-0
Lost in the middle: The problem with long contexts | 🦜�🔗 Langchain
https://python.langchain.com/docs/modules/data_connection/document_transformers/post_retrieval/long_context_reorder
111793c1128f-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionDocument loadersDocument transformersText splittersPost retrievalLost in the middle: The problem with long contextsText embedding modelsVector store...
https://python.langchain.com/docs/modules/data_connection/document_transformers/post_retrieval/long_context_reorder
111793c1128f-2
See: https://arxiv.org/abs/2307.03172To avoid this issue you can re-order documents after retrieval to avoid performance degradation.import osimport chromadbfrom langchain.vectorstores import Chromafrom langchain.embeddings import HuggingFaceEmbeddingsfrom langchain.document_transformers import ( LongContextReorder,...
https://python.langchain.com/docs/modules/data_connection/document_transformers/post_retrieval/long_context_reorder
111793c1128f-3
Kornet is one of the best Celtics players.', metadata={}), Document(page_content='The Boston Celtics won the game by 20 points', metadata={}), Document(page_content='Larry Bird was an iconic NBA player.', metadata={}), Document(page_content='Elden Ring is one of the best games in the last 15 years.', metada...
https://python.langchain.com/docs/modules/data_connection/document_transformers/post_retrieval/long_context_reorder
111793c1128f-4
Bird was an iconic NBA player.', metadata={}), Document(page_content='L. Kornet is one of the best Celtics players.', metadata={}), Document(page_content='This is a document about the Boston Celtics', metadata={})]# We prepare and run a custom Stuff chain with reordered docs as context.# Override promptsdocumen...
https://python.langchain.com/docs/modules/data_connection/document_transformers/post_retrieval/long_context_reorder
5c74f3ba22c8-0
Split by character | 🦜�🔗 Langchain
https://python.langchain.com/docs/modules/data_connection/document_transformers/text_splitters/character_text_splitter
5c74f3ba22c8-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionDocument loadersDocument transformersText splittersSplit by characterSplit codeMarkdownHeaderTextSplitterRecursively split by characterSplit by toke...
https://python.langchain.com/docs/modules/data_connection/document_transformers/text_splitters/character_text_splitter
5c74f3ba22c8-2
an unwavering resolve that freedom will always triumph over tyranny. \n\nSix days ago, Russia’s Vladimir Putin sought to shake the foundations of the free world thinking he could make it bend to his menacing ways. But he badly miscalculated. \n\nHe thought he could roll into Ukraine and the world would roll over. Ins...
https://python.langchain.com/docs/modules/data_connection/document_transformers/text_splitters/character_text_splitter
5c74f3ba22c8-3
\n\nHe met the Ukrainian people. \n\nFrom President Zelenskyy to every Ukrainian, their fearlessness, their courage, their determination, inspires the world.' lookup_str='' metadata={'document': 1} lookup_index=0text_splitter.split_text(state_of_the_union)[0] 'Madam Speaker, Madam Vice President, our First Lady and ...
https://python.langchain.com/docs/modules/data_connection/document_transformers/text_splitters/character_text_splitter
a73554530151-0
Document loaders | 🦜�🔗 Langchain
https://python.langchain.com/docs/modules/data_connection/document_loaders/
a73554530151-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/
a73554530151-2
implement a "lazy load" as well for lazily loading data into memory.Get started​The simplest loader reads in a file as text and places it all into one Document.from langchain.document_loaders import TextLoaderloader = TextLoader("./index.md")loader.load()[ Document(page_content='---\nsidebar_position: 0\n---\n# Do...
https://python.langchain.com/docs/modules/data_connection/document_loaders/
218408cdf61f-0
JSON | 🦜�🔗 Langchain
https://python.langchain.com/docs/modules/data_connection/document_loaders/json
218408cdf61f-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/json
218408cdf61f-2
Check this manual for a detailed documentation of the jq syntax.#!pip install jqfrom langchain.document_loaders import JSONLoaderimport jsonfrom pathlib import Pathfrom pprint import pprintfile_path='./example_data/facebook_chat.json'data = json.loads(Path(file_path).read_text())pprint(data) {'image': {'creation_tim...
https://python.langchain.com/docs/modules/data_connection/document_loaders/json
218408cdf61f-3
'timestamp_ms': 1675596277579}, {'content': 'I thought you were selling the blue one!', 'sender_name': 'User 1', 'timestamp_ms': 1675595140251}, {'content': 'Im not interested in this bag. Im interested in the ' 'blue one...
https://python.langchain.com/docs/modules/data_connection/document_loaders/json
218408cdf61f-4
'url_of_some_picture.jpg'}], 'sender_name': 'User 2', 'timestamp_ms': 1675595060730}, {'content': 'Online is at least $100', 'sender_name': 'User 2', 'timestamp_ms': 1675595045152}, {'content': 'How much do you wan...
https://python.langchain.com/docs/modules/data_connection/document_loaders/json
218408cdf61f-5
'me know if you are interested. Thanks!', 'sender_name': 'User 1', 'timestamp_ms': 1675549022673}], 'participants': [{'name': 'User 1'}, {'name': 'User 2'}], 'thread_path': 'inbox/User 1 and User 2 chat', 'title': 'User 1 and User 2 chat'}Using JSONLoader​Suppose we are...
https://python.langchain.com/docs/modules/data_connection/document_loaders/json
218408cdf61f-6
Document(page_content='I thought you were selling the blue one!', metadata={'source': '/Users/avsolatorio/WBG/langchain/docs/modules/indexes/document_loaders/examples/example_data/facebook_chat.json', 'seq_num': 4}), Document(page_content='Im not interested in this bag. Im interested in the blue one!', metadata={'s...
https://python.langchain.com/docs/modules/data_connection/document_loaders/json
218408cdf61f-7
Im offering $50. Let me know if you are interested. Thanks!', metadata={'source': '/Users/avsolatorio/WBG/langchain/docs/modules/indexes/document_loaders/examples/example_data/facebook_chat.json', 'seq_num': 11})]JSON Lines file​If you want to load documents from a JSON Lines file, you pass json_lines=True
https://python.langchain.com/docs/modules/data_connection/document_loaders/json
218408cdf61f-8
and specify jq_schema to extract page_content from a single JSON object.file_path = './example_data/facebook_chat_messages.jsonl'pprint(Path(file_path).read_text()) ('{"sender_name": "User 2", "timestamp_ms": 1675597571851, "content": "Bye!"}\n' '{"sender_name": "User 1", "timestamp_ms": 1675597435669, "content"...
https://python.langchain.com/docs/modules/data_connection/document_loaders/json
218408cdf61f-9
jq_schema='.', content_key='sender_name', json_lines=True)data = loader.load()pprint(data) [Document(page_content='User 2', metadata={'source': 'langchain/docs/modules/indexes/document_loaders/examples/example_data/facebook_chat_messages.jsonl', 'seq_num': 1}), Document(page_content='User 1', metadata={'so...
https://python.langchain.com/docs/modules/data_connection/document_loaders/json
218408cdf61f-10
= record.get("sender_name") metadata["timestamp_ms"] = record.get("timestamp_ms") return metadataloader = JSONLoader( file_path='./example_data/facebook_chat.json', jq_schema='.messages[]', content_key="content", metadata_func=metadata_func)data = loader.load()pprint(data) [Document(page_content='B...
https://python.langchain.com/docs/modules/data_connection/document_loaders/json
218408cdf61f-11
not interested in this bag. Im interested in the blue one!', metadata={'source': '/Users/avsolatorio/WBG/langchain/docs/modules/indexes/document_loaders/examples/example_data/facebook_chat.json', 'seq_num': 5, 'sender_name': 'User 1', 'timestamp_ms': 1675595109305}), Document(page_content='Here is $129', metadata={...
https://python.langchain.com/docs/modules/data_connection/document_loaders/json
218408cdf61f-12
'seq_num': 10, 'sender_name': 'User 2', 'timestamp_ms': 1675577876645}), Document(page_content='Hi! Im interested in your bag. Im offering $50. Let me know if you are interested. Thanks!', metadata={'source': '/Users/avsolatorio/WBG/langchain/docs/modules/indexes/document_loaders/examples/example_data/facebook_chat...
https://python.langchain.com/docs/modules/data_connection/document_loaders/json
218408cdf61f-13
jq_schema='.messages[]', content_key="content", metadata_func=metadata_func)data = loader.load()pprint(data) [Document(page_content='Bye!', metadata={'source': 'langchain/docs/modules/indexes/document_loaders/examples/example_data/facebook_chat.json', 'seq_num': 1, 'sender_name': 'User 2', 'timestamp_ms': 1675...
https://python.langchain.com/docs/modules/data_connection/document_loaders/json
218408cdf61f-14
'seq_num': 6, 'sender_name': 'User 2', 'timestamp_ms': 1675595068468}), Document(page_content='', metadata={'source': 'langchain/docs/modules/indexes/document_loaders/examples/example_data/facebook_chat.json', 'seq_num': 7, 'sender_name': 'User 2', 'timestamp_ms': 1675595060730}), Document(page_content='Online ...
https://python.langchain.com/docs/modules/data_connection/document_loaders/json
218408cdf61f-15
to extract content from the JSON data depending on the structure.JSON -> [{"text": ...}, {"text": ...}, {"text": ...}]jq_schema -> ".[].text"JSON -> {"key": [{"text": ...}, {"text": ...}, {"text": ...}]}jq_schema -> ".key[].text"JSON -> ["...", "...", "..."]jq_schema -> ".[]"PreviousHTMLNextM...
https://python.langchain.com/docs/modules/data_connection/document_loaders/json
8f628e869692-0
HTML | 🦜�🔗 Langchain Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionDocument loadersCSVFile DirectoryHTMLJSONMarkdownPDFDocument transformersText embedding modelsVector storesRetriev...
https://python.langchain.com/docs/modules/data_connection/document_loaders/html
d1e5d115097d-0
Markdown | 🦜�🔗 Langchain
https://python.langchain.com/docs/modules/data_connection/document_loaders/markdown
d1e5d115097d-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/markdown
d1e5d115097d-2
the real power comes when you can combine them with other sources of computation or knowledge.\n\nThis library aims to assist in the development of those types of applications. Common examples of these applications include:\n\nâ\x9d“ Question Answering over specific documents\n\nDocumentation\n\nEnd-to-end Example: ...
https://python.langchain.com/docs/modules/data_connection/document_loaders/markdown
d1e5d115097d-3
Data Augmented Generation:\n\nData Augmented Generation involves specific types of chains that first interact with an external data source to fetch data for use in the generation step. Examples include summarization of long pieces of text and question/answering over specific data sources.\n\nð\x9f¤\x96 Agents:\n\nAge...
https://python.langchain.com/docs/modules/data_connection/document_loaders/markdown
d1e5d115097d-4
mode="elements")data = loader.load()data[0] Document(page_content='ð\x9f¦\x9cï¸\x8fð\x9f�\x97 LangChain', metadata={'source': '../../../../../README.md', 'page_number': 1, 'category': 'Title'})PreviousJSONNextPDFCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright © 2023 LangChain, Inc.
https://python.langchain.com/docs/modules/data_connection/document_loaders/markdown
ae2226ba3bde-0
File Directory | 🦜�🔗 Langchain
https://python.langchain.com/docs/modules/data_connection/document_loaders/file_directory
ae2226ba3bde-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/file_directory
ae2226ba3bde-2
can change up the type of loader pretty easily.from langchain.document_loaders import TextLoaderloader = DirectoryLoader('../', glob="**/*.md", loader_cls=TextLoader)docs = loader.load()len(docs) 1If you need to load Python source code files, use the PythonLoader.from langchain.document_loaders import PythonLoaderlo...
https://python.langchain.com/docs/modules/data_connection/document_loaders/file_directory
ae2226ba3bde-3
#bf7f7f; text-decoration-color: #bf7f7f; font-weight: bold">(most recent call last)</span><span style="color: #800000; text-decoration-color: #800000"> ────────────────────────────────╮</span><span style="color: #800000; text-decoration-color: #800000">â...
https://python.langchain.com/docs/modules/data_connection/document_loaders/file_directory
ae2226ba3bde-4
<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">26 </span><span style="color: #7f7f7f; text-decoration-color: #7f7f7f">│ │ </span>text = <span style="colo...
https://python.langchain.com/docs/modules/data_connection/document_loaders/file_directory
ae2226ba3bde-5
text-decoration-color: #7f7f7f">│ │ </span><span style="color: #0000ff; text-decoration-color: #0000ff">with</span> <span style="color: #00ffff; text-decoration-color: #00ffff">open</span>(<span style="color: #00ffff; text-decoration-color: #00ffff">self</span>.file_path, encoding=<span style="color: #00ffff; t...
https://python.langchain.com/docs/modules/data_connection/document_loaders/file_directory
ae2226ba3bde-6
<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>29 <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">│ │ │ │ </span>text = f.r...
https://python.langchain.com/docs/modules/data_connection/document_loaders/file_directory
ae2226ba3bde-7
text-decoration-color: #0000ff">as</span> e: <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">31 </span><span style...
https://python.langchain.com/docs/modules/data_connection/document_loaders/file_directory
ae2226ba3bde-8
#7f7f7f">│ │ │ │ │ </span>detected_encodings = <span style="color: #00ffff; text-decoration-color: #00ffff">self</span>.detect_file_encodings() <span style="color: #800000; text-decoration-color: #800000">│</span><span style="color: #800000; text-decoration-color: #800000">â”...
https://python.langchain.com/docs/modules/data_connection/document_loaders/file_directory
ae2226ba3bde-9
in <span style="color: #00ff00; text-decoration-color: #00ff00">decode</span> <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-10
#00ffff; text-decoration-color: #00ffff">input</span>, final=<span style="color: #0000ff; text-decoration-color: #0000ff">False</span>): <span style="color: #800000; text-decoration-color: #800000">│</span><span style="color: #800000; text-decoration-color: #800000">│...
https://python.langchain.com/docs/modules/data_connection/document_loaders/file_directory
ae2226ba3bde-11
│ </span>data = <span style="color: #00ffff; text-decoration-color: #00ffff">self</span>.buffer + <span style="color: #00ffff; text-decoration-color: #00ffff">input</span> <span style="color: #800000; text-decoration-color: #800000">│</span><span style="color...
https://python.langchain.com/docs/modules/data_connection/document_loaders/file_directory
ae2226ba3bde-12
</span><span style="color: #7f7f7f; text-decoration-color: #7f7f7f">│ │ </span><span style="color: #7f7f7f; text-decoration-color: #7f7f7f"># keep undecoded input until the next call</span> <span style="color: #800000; text-decoration-color: #800000">│</span><span style=...
https://python.langchain.com/docs/modules/data_connection/document_loaders/file_directory
ae2226ba3bde-13
#7f7f7f"> 325 </span><span style="color: #7f7f7f; text-decoration-color: #7f7f7f">│ │ </span><span style="color: #0000ff; text-decoration-color: #0000ff">return</span> result <span style="color: #800000; text-decoration-color: #800000">│</spa...
https://python.langchain.com/docs/modules/data_connection/document_loaders/file_directory
ae2226ba3bde-14
style="color: #800000; text-decoration-color: #800000">╰───────────────────────────────────────────────────────────────────────────────────────â...
https://python.langchain.com/docs/modules/data_connection/document_loaders/file_directory
ae2226ba3bde-15
style="color: #008080; text-decoration-color: #008080; font-weight: bold">0xca</span> in position <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">0</span>: invalid continuation byte<span style="font-style: italic">The above exception was the direct cause of the following exception:</span...
https://python.langchain.com/docs/modules/data_connection/document_loaders/file_directory
ae2226ba3bde-16
#800000; text-decoration-color: #800000">│</span> in <span style="color: #00ff00; text-decoration-color: #00ff00">&lt;module&gt;</span>:<span style="color: #0000ff; text-decoration-color: #0000ff">1</span> <span style="color: #800000; ...
https://python.langchain.com/docs/modules/data_connection/document_loaders/file_directory
ae2226ba3bde-17
<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">2 </span> <span style=...
https://python.langchain.com/docs/modules/data_connection/document_loaders/file_directory
ae2226ba3bde-18
<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