Skip to content

Commit 592745e

Browse files
author
Erick Friis
authored
Merge branch 'master' into box/citations
2 parents e751a4e + 0495b7f commit 592745e

File tree

153 files changed

+4161
-11745
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

153 files changed

+4161
-11745
lines changed

.github/workflows/_release.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,6 @@ jobs:
294294
VOYAGE_API_KEY: ${{ secrets.VOYAGE_API_KEY }}
295295
UPSTAGE_API_KEY: ${{ secrets.UPSTAGE_API_KEY }}
296296
FIREWORKS_API_KEY: ${{ secrets.FIREWORKS_API_KEY }}
297-
UNSTRUCTURED_API_KEY: ${{ secrets.UNSTRUCTURED_API_KEY }}
298297
run: make integration_tests
299298
working-directory: ${{ inputs.working-directory }}
300299

.github/workflows/api_doc_build.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ jobs:
6565
with:
6666
repository: langchain-ai/langchain-experimental
6767
path: langchain-experimental
68+
- uses: actions/checkout@v4
69+
with:
70+
repository: langchain-ai/langchain-milvus
71+
path: langchain-milvus
72+
- uses: actions/checkout@v4
73+
with:
74+
repository: langchain-ai/langchain-unstructured
75+
path: langchain-unstructured
6876

6977

7078
- name: Set Git config
@@ -73,7 +81,7 @@ jobs:
7381
git config --local user.email "[email protected]"
7482
git config --local user.name "Github Actions"
7583
76-
- name: Move google libs
84+
- name: Move libs
7785
run: |
7886
rm -rf \
7987
langchain/libs/partners/google-genai \
@@ -87,7 +95,9 @@ jobs:
8795
langchain/libs/partners/ai21 \
8896
langchain/libs/partners/together \
8997
langchain/libs/standard-tests \
90-
langchain/libs/experimental
98+
langchain/libs/experimental \
99+
langchain/libs/partners/milvus \
100+
langchain/libs/partners/unstructured
91101
mv langchain-google/libs/genai langchain/libs/partners/google-genai
92102
mv langchain-google/libs/vertexai langchain/libs/partners/google-vertexai
93103
mv langchain-google/libs/community langchain/libs/partners/google-community
@@ -101,6 +111,8 @@ jobs:
101111
mv langchain-ai21/libs/ai21 langchain/libs/partners/ai21
102112
mv langchain-together/libs/together langchain/libs/partners/together
103113
mv langchain-experimental/libs/experimental langchain/libs/experimental
114+
mv langchain-milvus/libs/milvus langchain/libs/partners/milvus
115+
mv langchain-unstructured/libs/unstructured langchain/libs/partners/unstructured
104116
105117
- name: Rm old html
106118
run:

docs/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ vercel-build: install-vercel-deps build generate-references
8282
mv $(OUTPUT_NEW_DOCS_DIR) docs
8383
rm -rf build
8484
mkdir static/api_reference
85-
git clone --depth=1 https://github.com/baskaryan/langchain-api-docs-build.git
86-
mv langchain-api-docs-build/api_reference_build/html/* static/api_reference/
87-
rm -rf langchain-api-docs-build
85+
git clone --depth=1 https://github.com/langchain-ai/langchain-api-docs-html.git
86+
mv langchain-api-docs-html/api_reference_build/html/* static/api_reference/
87+
rm -rf langchain-api-docs-html
8888
NODE_OPTIONS="--max-old-space-size=5000" yarn run docusaurus build
8989

9090
start:

docs/docs/contributing/index.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ sidebar_position: 0
33
---
44
# Welcome Contributors
55

6-
Hi there! Thank you for even being interested in contributing to LangChain.
7-
As an open-source project in a rapidly developing field, we are extremely open to contributions, whether they involve new features, improved infrastructure, better documentation, or bug fixes.
6+
Hi there! Thank you for your interest in contributing to LangChain.
7+
As an open-source project in a fast developing field, we are extremely open to contributions, whether they involve new features, improved infrastructure, better documentation, or bug fixes.
88

99
## 🗺️ Guidelines
1010

docs/docs/how_to/migrate_agent.ipynb

Lines changed: 56 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@
3434
"LangChain agents (the [AgentExecutor](https://python.langchain.com/api_reference/langchain/agents/langchain.agents.agent.AgentExecutor.html#langchain.agents.agent.AgentExecutor) in particular) have multiple configuration parameters.\n",
3535
"In this notebook we will show how those parameters map to the LangGraph react agent executor using the [create_react_agent](https://langchain-ai.github.io/langgraph/reference/prebuilt/#create_react_agent) prebuilt helper method.\n",
3636
"\n",
37+
"\n",
38+
":::note\n",
39+
"In LangGraph, the graph replaces LangChain's agent executor. It manages the agent's cycles and tracks the scratchpad as messages within its state. The LangChain \"agent\" corresponds to the state_modifier and LLM you've provided.\n",
40+
":::\n",
41+
"\n",
42+
"\n",
3743
"#### Prerequisites\n",
3844
"\n",
3945
"This how-to guide uses OpenAI as the LLM. Install the dependencies to run."
@@ -183,10 +189,10 @@
183189
"source": [
184190
"from langgraph.prebuilt import create_react_agent\n",
185191
"\n",
186-
"app = create_react_agent(model, tools)\n",
192+
"langgraph_agent_executor = create_react_agent(model, tools)\n",
187193
"\n",
188194
"\n",
189-
"messages = app.invoke({\"messages\": [(\"human\", query)]})\n",
195+
"messages = langgraph_agent_executor.invoke({\"messages\": [(\"human\", query)]})\n",
190196
"{\n",
191197
" \"input\": query,\n",
192198
" \"output\": messages[\"messages\"][-1].content,\n",
@@ -216,7 +222,9 @@
216222
"\n",
217223
"new_query = \"Pardon?\"\n",
218224
"\n",
219-
"messages = app.invoke({\"messages\": message_history + [(\"human\", new_query)]})\n",
225+
"messages = langgraph_agent_executor.invoke(\n",
226+
" {\"messages\": message_history + [(\"human\", new_query)]}\n",
227+
")\n",
220228
"{\n",
221229
" \"input\": new_query,\n",
222230
" \"output\": messages[\"messages\"][-1].content,\n",
@@ -309,10 +317,12 @@
309317
"# This could also be a SystemMessage object\n",
310318
"# system_message = SystemMessage(content=\"You are a helpful assistant. Respond only in Spanish.\")\n",
311319
"\n",
312-
"app = create_react_agent(model, tools, state_modifier=system_message)\n",
320+
"langgraph_agent_executor = create_react_agent(\n",
321+
" model, tools, state_modifier=system_message\n",
322+
")\n",
313323
"\n",
314324
"\n",
315-
"messages = app.invoke({\"messages\": [(\"user\", query)]})"
325+
"messages = langgraph_agent_executor.invoke({\"messages\": [(\"user\", query)]})"
316326
]
317327
},
318328
{
@@ -356,10 +366,12 @@
356366
" ]\n",
357367
"\n",
358368
"\n",
359-
"app = create_react_agent(model, tools, state_modifier=_modify_state_messages)\n",
369+
"langgraph_agent_executor = create_react_agent(\n",
370+
" model, tools, state_modifier=_modify_state_messages\n",
371+
")\n",
360372
"\n",
361373
"\n",
362-
"messages = app.invoke({\"messages\": [(\"human\", query)]})\n",
374+
"messages = langgraph_agent_executor.invoke({\"messages\": [(\"human\", query)]})\n",
363375
"print(\n",
364376
" {\n",
365377
" \"input\": query,\n",
@@ -503,13 +515,13 @@
503515
"# system_message = SystemMessage(content=\"You are a helpful assistant. Respond only in Spanish.\")\n",
504516
"\n",
505517
"memory = MemorySaver()\n",
506-
"app = create_react_agent(\n",
518+
"langgraph_agent_executor = create_react_agent(\n",
507519
" model, tools, state_modifier=system_message, checkpointer=memory\n",
508520
")\n",
509521
"\n",
510522
"config = {\"configurable\": {\"thread_id\": \"test-thread\"}}\n",
511523
"print(\n",
512-
" app.invoke(\n",
524+
" langgraph_agent_executor.invoke(\n",
513525
" {\n",
514526
" \"messages\": [\n",
515527
" (\"user\", \"Hi, I'm polly! What's the output of magic_function of 3?\")\n",
@@ -520,15 +532,15 @@
520532
")\n",
521533
"print(\"---\")\n",
522534
"print(\n",
523-
" app.invoke({\"messages\": [(\"user\", \"Remember my name?\")]}, config)[\"messages\"][\n",
524-
" -1\n",
525-
" ].content\n",
535+
" langgraph_agent_executor.invoke(\n",
536+
" {\"messages\": [(\"user\", \"Remember my name?\")]}, config\n",
537+
" )[\"messages\"][-1].content\n",
526538
")\n",
527539
"print(\"---\")\n",
528540
"print(\n",
529-
" app.invoke({\"messages\": [(\"user\", \"what was that output again?\")]}, config)[\n",
530-
" \"messages\"\n",
531-
" ][-1].content\n",
541+
" langgraph_agent_executor.invoke(\n",
542+
" {\"messages\": [(\"user\", \"what was that output again?\")]}, config\n",
543+
" )[\"messages\"][-1].content\n",
532544
")"
533545
]
534546
},
@@ -636,9 +648,13 @@
636648
" return prompt.invoke({\"messages\": state[\"messages\"]}).to_messages()\n",
637649
"\n",
638650
"\n",
639-
"app = create_react_agent(model, tools, state_modifier=_modify_state_messages)\n",
651+
"langgraph_agent_executor = create_react_agent(\n",
652+
" model, tools, state_modifier=_modify_state_messages\n",
653+
")\n",
640654
"\n",
641-
"for step in app.stream({\"messages\": [(\"human\", query)]}, stream_mode=\"updates\"):\n",
655+
"for step in langgraph_agent_executor.stream(\n",
656+
" {\"messages\": [(\"human\", query)]}, stream_mode=\"updates\"\n",
657+
"):\n",
642658
" print(step)"
643659
]
644660
},
@@ -707,9 +723,9 @@
707723
"source": [
708724
"from langgraph.prebuilt import create_react_agent\n",
709725
"\n",
710-
"app = create_react_agent(model, tools=tools)\n",
726+
"langgraph_agent_executor = create_react_agent(model, tools=tools)\n",
711727
"\n",
712-
"messages = app.invoke({\"messages\": [(\"human\", query)]})\n",
728+
"messages = langgraph_agent_executor.invoke({\"messages\": [(\"human\", query)]})\n",
713729
"\n",
714730
"messages"
715731
]
@@ -839,10 +855,10 @@
839855
"\n",
840856
"RECURSION_LIMIT = 2 * 3 + 1\n",
841857
"\n",
842-
"app = create_react_agent(model, tools=tools)\n",
858+
"langgraph_agent_executor = create_react_agent(model, tools=tools)\n",
843859
"\n",
844860
"try:\n",
845-
" for chunk in app.stream(\n",
861+
" for chunk in langgraph_agent_executor.stream(\n",
846862
" {\"messages\": [(\"human\", query)]},\n",
847863
" {\"recursion_limit\": RECURSION_LIMIT},\n",
848864
" stream_mode=\"values\",\n",
@@ -953,12 +969,12 @@
953969
"source": [
954970
"from langgraph.prebuilt import create_react_agent\n",
955971
"\n",
956-
"app = create_react_agent(model, tools=tools)\n",
972+
"langgraph_agent_executor = create_react_agent(model, tools=tools)\n",
957973
"# Set the max timeout for each step here\n",
958-
"app.step_timeout = 2\n",
974+
"langgraph_agent_executor.step_timeout = 2\n",
959975
"\n",
960976
"try:\n",
961-
" for chunk in app.stream({\"messages\": [(\"human\", query)]}):\n",
977+
" for chunk in langgraph_agent_executor.stream({\"messages\": [(\"human\", query)]}):\n",
962978
" print(chunk)\n",
963979
" print(\"------\")\n",
964980
"except TimeoutError:\n",
@@ -994,17 +1010,21 @@
9941010
"\n",
9951011
"from langgraph.prebuilt import create_react_agent\n",
9961012
"\n",
997-
"app = create_react_agent(model, tools=tools)\n",
1013+
"langgraph_agent_executor = create_react_agent(model, tools=tools)\n",
9981014
"\n",
9991015
"\n",
1000-
"async def stream(app, inputs):\n",
1001-
" async for chunk in app.astream({\"messages\": [(\"human\", query)]}):\n",
1016+
"async def stream(langgraph_agent_executor, inputs):\n",
1017+
" async for chunk in langgraph_agent_executor.astream(\n",
1018+
" {\"messages\": [(\"human\", query)]}\n",
1019+
" ):\n",
10021020
" print(chunk)\n",
10031021
" print(\"------\")\n",
10041022
"\n",
10051023
"\n",
10061024
"try:\n",
1007-
" task = asyncio.create_task(stream(app, {\"messages\": [(\"human\", query)]}))\n",
1025+
" task = asyncio.create_task(\n",
1026+
" stream(langgraph_agent_executor, {\"messages\": [(\"human\", query)]})\n",
1027+
" )\n",
10081028
" await asyncio.wait_for(task, timeout=3)\n",
10091029
"except TimeoutError:\n",
10101030
" print(\"Task Cancelled.\")"
@@ -1108,10 +1128,10 @@
11081128
"\n",
11091129
"RECURSION_LIMIT = 2 * 1 + 1\n",
11101130
"\n",
1111-
"app = create_react_agent(model, tools=tools)\n",
1131+
"langgraph_agent_executor = create_react_agent(model, tools=tools)\n",
11121132
"\n",
11131133
"try:\n",
1114-
" for chunk in app.stream(\n",
1134+
" for chunk in langgraph_agent_executor.stream(\n",
11151135
" {\"messages\": [(\"human\", query)]},\n",
11161136
" {\"recursion_limit\": RECURSION_LIMIT},\n",
11171137
" stream_mode=\"values\",\n",
@@ -1289,10 +1309,14 @@
12891309
" return [(\"system\", \"You are a helpful assistant\"), state[\"messages\"][0]]\n",
12901310
"\n",
12911311
"\n",
1292-
"app = create_react_agent(model, tools, state_modifier=_modify_state_messages)\n",
1312+
"langgraph_agent_executor = create_react_agent(\n",
1313+
" model, tools, state_modifier=_modify_state_messages\n",
1314+
")\n",
12931315
"\n",
12941316
"try:\n",
1295-
" for step in app.stream({\"messages\": [(\"human\", query)]}, stream_mode=\"updates\"):\n",
1317+
" for step in langgraph_agent_executor.stream(\n",
1318+
" {\"messages\": [(\"human\", query)]}, stream_mode=\"updates\"\n",
1319+
" ):\n",
12961320
" pass\n",
12971321
"except GraphRecursionError as e:\n",
12981322
" print(\"Stopping agent prematurely due to triggering stop condition\")"

docs/docs/integrations/document_loaders/airbyte.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"metadata": {},
3030
"outputs": [],
3131
"source": [
32-
"% pip install -qU langchain-airbyte"
32+
"%pip install -qU langchain-airbyte"
3333
]
3434
},
3535
{

docs/docs/integrations/document_loaders/browserbase.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"metadata": {},
2727
"outputs": [],
2828
"source": [
29-
"% pip install browserbase"
29+
"%pip install browserbase"
3030
]
3131
},
3232
{

docs/docs/integrations/document_loaders/upstage.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
}
2626
},
2727
"source": [
28-
"# UpstageLayoutAnalysisLoader\n",
28+
"# UpstageDocumentParseLoader\n",
2929
"\n",
30-
"This notebook covers how to get started with `UpstageLayoutAnalysisLoader`.\n",
30+
"This notebook covers how to get started with `UpstageDocumentParseLoader`.\n",
3131
"\n",
3232
"## Installation\n",
3333
"\n",
@@ -89,10 +89,10 @@
8989
}
9090
],
9191
"source": [
92-
"from langchain_upstage import UpstageLayoutAnalysisLoader\n",
92+
"from langchain_upstage import UpstageDocumentParseLoader\n",
9393
"\n",
9494
"file_path = \"/PATH/TO/YOUR/FILE.pdf\"\n",
95-
"layzer = UpstageLayoutAnalysisLoader(file_path, split=\"page\")\n",
95+
"layzer = UpstageDocumentParseLoader(file_path, split=\"page\")\n",
9696
"\n",
9797
"# For improved memory efficiency, consider using the lazy_load method to load documents page by page.\n",
9898
"docs = layzer.load() # or layzer.lazy_load()\n",

docs/docs/integrations/graphs/azure_cosmosdb_gremlin.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"outputs": [],
8181
"source": [
8282
"graph = GremlinGraph(\n",
83-
" url=f\"=wss://{cosmosdb_name}.gremlin.cosmos.azure.com:443/\",\n",
83+
" url=f\"wss://{cosmosdb_name}.gremlin.cosmos.azure.com:443/\",\n",
8484
" username=f\"/dbs/{cosmosdb_db_id}/colls/{cosmosdb_db_graph_id}\",\n",
8585
" password=cosmosdb_access_Key,\n",
8686
")"

0 commit comments

Comments
 (0)