Skip to content

Commit 7cd0649

Browse files
committed
Merge remote-tracking branch 'upstream/master' into pprados/pdf_loaders
2 parents 4638199 + b258ff1 commit 7cd0649

Some content is hidden

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

55 files changed

+1938
-515
lines changed

.github/workflows/_test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ jobs:
5959
env:
6060
MIN_VERSIONS: ${{ steps.min-version.outputs.min-versions }}
6161
run: |
62-
poetry run pip install $MIN_VERSIONS
62+
poetry run pip install uv
63+
poetry run uv pip install $MIN_VERSIONS
6364
make tests
6465
working-directory: ${{ inputs.working-directory }}
6566

docs/docs/concepts/streaming.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ In some cases, you may need to stream **custom data** that goes beyond the infor
3939

4040
## Streaming APIs
4141

42-
LangChain two main APIs for streaming output in real-time. These APIs are supported by any component that implements the [Runnable Interface](/docs/concepts/runnables), including [LLMs](/docs/concepts/chat_models), [compiled LangGraph graphs](https://langchain-ai.github.io/langgraph/concepts/low_level/), and any Runnable generated with [LCEL](/docs/concepts/lcel).
42+
LangChain has two main APIs for streaming output in real-time. These APIs are supported by any component that implements the [Runnable Interface](/docs/concepts/runnables), including [LLMs](/docs/concepts/chat_models), [compiled LangGraph graphs](https://langchain-ai.github.io/langgraph/concepts/low_level/), and any Runnable generated with [LCEL](/docs/concepts/lcel).
4343

4444
1. sync [stream](https://python.langchain.com/api_reference/core/runnables/langchain_core.runnables.base.Runnable.html#langchain_core.runnables.base.Runnable.stream) and async [astream](https://python.langchain.com/api_reference/core/runnables/langchain_core.runnables.base.Runnable.html#langchain_core.runnables.base.Runnable.astream): Use to stream outputs from individual Runnables (e.g., a chat model) as they are generated or stream any workflow created with LangGraph.
4545
2. The async only [astream_events](https://python.langchain.com/api_reference/core/runnables/langchain_core.runnables.base.Runnable.html#langchain_core.runnables.base.Runnable.astream_events): Use this API to get access to custom events and intermediate outputs from LLM applications built entirely with [LCEL](/docs/concepts/lcel). Note that this API is available, but not needed when working with LangGraph.

docs/docs/how_to/custom_tools.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@
169169
" return a * max(b)\n",
170170
"\n",
171171
"\n",
172-
"multiply_by_max.args_schema.schema()"
172+
"print(multiply_by_max.args_schema.model_json_schema())"
173173
]
174174
},
175175
{
@@ -285,7 +285,7 @@
285285
" return bar\n",
286286
"\n",
287287
"\n",
288-
"foo.args_schema.schema()"
288+
"print(foo.args_schema.model_json_schema())"
289289
]
290290
},
291291
{

docs/docs/how_to/installation.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ By default, the dependencies needed to do that are NOT installed. You will need
3131
## Ecosystem packages
3232

3333
With the exception of the `langsmith` SDK, all packages in the LangChain ecosystem depend on `langchain-core`, which contains base
34-
classes and abstractions that other packages use. The dependency graph below shows how the difference packages are related.
34+
classes and abstractions that other packages use. The dependency graph below shows how the different packages are related.
3535
A directed arrow indicates that the source package depends on the target package:
3636

3737
![](/img/ecosystem_packages.png)
@@ -115,4 +115,4 @@ If you want to install a package from source, you can do so by cloning the [main
115115
pip install -e .
116116
```
117117

118-
LangGraph, LangSmith SDK, and certain integration packages live outside the main LangChain repo. You can see [all repos here](https://github.com/langchain-ai).
118+
LangGraph, LangSmith SDK, and certain integration packages live outside the main LangChain repo. You can see [all repos here](https://github.com/langchain-ai).

docs/docs/how_to/multi_vector.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@
292292
"id": "3faa9fde-1b09-4849-a815-8b2e89c30a02",
293293
"metadata": {},
294294
"source": [
295-
"Note that we can [batch](https://python.langchain.com/api_reference/core/runnables/langchain_core.runnables.base.Runnable.html#langchain_core.runnables.base.Runnable) the chain accross documents:"
295+
"Note that we can [batch](https://python.langchain.com/api_reference/core/runnables/langchain_core.runnables.base.Runnable.html#langchain_core.runnables.base.Runnable) the chain across documents:"
296296
]
297297
},
298298
{

docs/docs/how_to/structured_output.ipynb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@
165165
}
166166
],
167167
"source": [
168+
"from typing import Optional\n",
169+
"\n",
168170
"from typing_extensions import Annotated, TypedDict\n",
169171
"\n",
170172
"\n",
@@ -206,10 +208,10 @@
206208
{
207209
"data": {
208210
"text/plain": [
209-
"{'setup': 'Why was the cat sitting on the computer?',\n",
210-
" 'punchline': 'Because it wanted to keep an eye on the mouse!',\n",
211-
" 'rating': 7}"
212-
]
211+
"{'setup': 'Why was the cat sitting on the computer?',\n",
212+
" 'punchline': 'Because it wanted to keep an eye on the mouse!',\n",
213+
" 'rating': 7}"
214+
]
213215
},
214216
"execution_count": 4,
215217
"metadata": {},

docs/docs/integrations/chat/friendli.ipynb

Lines changed: 35 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22
"cells": [
33
{
44
"cell_type": "raw",
5-
"metadata": {},
5+
"metadata": {
6+
"vscode": {
7+
"languageId": "raw"
8+
}
9+
},
610
"source": [
711
"---\n",
8-
"sidebar_label: Friendli\n",
12+
"sidebar_label: ChatFriendli\n",
913
"---"
1014
]
1115
},
@@ -37,7 +41,7 @@
3741
},
3842
{
3943
"cell_type": "code",
40-
"execution_count": 1,
44+
"execution_count": 2,
4145
"metadata": {},
4246
"outputs": [],
4347
"source": [
@@ -57,13 +61,13 @@
5761
},
5862
{
5963
"cell_type": "code",
60-
"execution_count": 2,
64+
"execution_count": 3,
6165
"metadata": {},
6266
"outputs": [],
6367
"source": [
6468
"from langchain_community.chat_models.friendli import ChatFriendli\n",
6569
"\n",
66-
"chat = ChatFriendli(model=\"llama-2-13b-chat\", max_tokens=100, temperature=0)"
70+
"chat = ChatFriendli(model=\"meta-llama-3.1-8b-instruct\", max_tokens=100, temperature=0)"
6771
]
6872
},
6973
{
@@ -84,16 +88,16 @@
8488
},
8589
{
8690
"cell_type": "code",
87-
"execution_count": 3,
91+
"execution_count": 4,
8892
"metadata": {},
8993
"outputs": [
9094
{
9195
"data": {
9296
"text/plain": [
93-
"AIMessage(content=\" Knock, knock!\\nWho's there?\\nCows go.\\nCows go who?\\nMOO!\")"
97+
"AIMessage(content=\"Why don't eggs tell jokes? They'd crack each other up.\", additional_kwargs={}, response_metadata={}, id='run-d47c1056-54e8-4ea9-ad63-07cf74b834b7-0')"
9498
]
9599
},
96-
"execution_count": 3,
100+
"execution_count": 4,
97101
"metadata": {},
98102
"output_type": "execute_result"
99103
}
@@ -111,17 +115,17 @@
111115
},
112116
{
113117
"cell_type": "code",
114-
"execution_count": 4,
118+
"execution_count": 5,
115119
"metadata": {},
116120
"outputs": [
117121
{
118122
"data": {
119123
"text/plain": [
120-
"[AIMessage(content=\" Knock, knock!\\nWho's there?\\nCows go.\\nCows go who?\\nMOO!\"),\n",
121-
" AIMessage(content=\" Knock, knock!\\nWho's there?\\nCows go.\\nCows go who?\\nMOO!\")]"
124+
"[AIMessage(content=\"Why don't eggs tell jokes? They'd crack each other up.\", additional_kwargs={}, response_metadata={}, id='run-36775b84-2a7a-48f0-8c68-df23ffffe4b2-0'),\n",
125+
" AIMessage(content=\"Why don't eggs tell jokes? They'd crack each other up.\", additional_kwargs={}, response_metadata={}, id='run-b204be41-bc06-4d3a-9f74-e66ab1e60e4f-0')]"
122126
]
123127
},
124-
"execution_count": 4,
128+
"execution_count": 5,
125129
"metadata": {},
126130
"output_type": "execute_result"
127131
}
@@ -132,16 +136,16 @@
132136
},
133137
{
134138
"cell_type": "code",
135-
"execution_count": 5,
139+
"execution_count": 6,
136140
"metadata": {},
137141
"outputs": [
138142
{
139143
"data": {
140144
"text/plain": [
141-
"LLMResult(generations=[[ChatGeneration(text=\" Knock, knock!\\nWho's there?\\nCows go.\\nCows go who?\\nMOO!\", message=AIMessage(content=\" Knock, knock!\\nWho's there?\\nCows go.\\nCows go who?\\nMOO!\"))], [ChatGeneration(text=\" Knock, knock!\\nWho's there?\\nCows go.\\nCows go who?\\nMOO!\", message=AIMessage(content=\" Knock, knock!\\nWho's there?\\nCows go.\\nCows go who?\\nMOO!\"))]], llm_output={}, run=[RunInfo(run_id=UUID('a0c2d733-6971-4ae7-beea-653856f4e57c')), RunInfo(run_id=UUID('f3d35e44-ac9a-459a-9e4b-b8e3a73a91e1'))])"
145+
"LLMResult(generations=[[ChatGeneration(text=\"Why don't eggs tell jokes? They'd crack each other up.\", message=AIMessage(content=\"Why don't eggs tell jokes? They'd crack each other up.\", additional_kwargs={}, response_metadata={}, id='run-2e4cb949-8c51-40d5-92a0-cd0ac577db83-0'))], [ChatGeneration(text=\"Why don't eggs tell jokes? They'd crack each other up.\", message=AIMessage(content=\"Why don't eggs tell jokes? They'd crack each other up.\", additional_kwargs={}, response_metadata={}, id='run-afcdd1be-463c-4e50-9731-7a9f5958e396-0'))]], llm_output={}, run=[RunInfo(run_id=UUID('2e4cb949-8c51-40d5-92a0-cd0ac577db83')), RunInfo(run_id=UUID('afcdd1be-463c-4e50-9731-7a9f5958e396'))], type='LLMResult')"
142146
]
143147
},
144-
"execution_count": 5,
148+
"execution_count": 6,
145149
"metadata": {},
146150
"output_type": "execute_result"
147151
}
@@ -152,18 +156,14 @@
152156
},
153157
{
154158
"cell_type": "code",
155-
"execution_count": 6,
159+
"execution_count": 8,
156160
"metadata": {},
157161
"outputs": [
158162
{
159163
"name": "stdout",
160164
"output_type": "stream",
161165
"text": [
162-
" Knock, knock!\n",
163-
"Who's there?\n",
164-
"Cows go.\n",
165-
"Cows go who?\n",
166-
"MOO!"
166+
"Why don't eggs tell jokes? They'd crack each other up."
167167
]
168168
}
169169
],
@@ -181,16 +181,16 @@
181181
},
182182
{
183183
"cell_type": "code",
184-
"execution_count": 7,
184+
"execution_count": 9,
185185
"metadata": {},
186186
"outputs": [
187187
{
188188
"data": {
189189
"text/plain": [
190-
"AIMessage(content=\" Knock, knock!\\nWho's there?\\nCows go.\\nCows go who?\\nMOO!\")"
190+
"AIMessage(content=\"Why don't eggs tell jokes? They'd crack each other up.\", additional_kwargs={}, response_metadata={}, id='run-ba8062fb-68af-47b8-bd7b-d1e01b914744-0')"
191191
]
192192
},
193-
"execution_count": 7,
193+
"execution_count": 9,
194194
"metadata": {},
195195
"output_type": "execute_result"
196196
}
@@ -201,17 +201,17 @@
201201
},
202202
{
203203
"cell_type": "code",
204-
"execution_count": 8,
204+
"execution_count": 10,
205205
"metadata": {},
206206
"outputs": [
207207
{
208208
"data": {
209209
"text/plain": [
210-
"[AIMessage(content=\" Knock, knock!\\nWho's there?\\nCows go.\\nCows go who?\\nMOO!\"),\n",
211-
" AIMessage(content=\" Knock, knock!\\nWho's there?\\nCows go.\\nCows go who?\\nMOO!\")]"
210+
"[AIMessage(content=\"Why don't eggs tell jokes? They'd crack each other up.\", additional_kwargs={}, response_metadata={}, id='run-5d2c77ab-2637-45da-8bbe-1b1f18a22369-0'),\n",
211+
" AIMessage(content=\"Why don't eggs tell jokes? They'd crack each other up.\", additional_kwargs={}, response_metadata={}, id='run-f1338470-8b52-4d6e-9428-a694a08ae484-0')]"
212212
]
213213
},
214-
"execution_count": 8,
214+
"execution_count": 10,
215215
"metadata": {},
216216
"output_type": "execute_result"
217217
}
@@ -222,16 +222,16 @@
222222
},
223223
{
224224
"cell_type": "code",
225-
"execution_count": 9,
225+
"execution_count": 11,
226226
"metadata": {},
227227
"outputs": [
228228
{
229229
"data": {
230230
"text/plain": [
231-
"LLMResult(generations=[[ChatGeneration(text=\" Knock, knock!\\nWho's there?\\nCows go.\\nCows go who?\\nMOO!\", message=AIMessage(content=\" Knock, knock!\\nWho's there?\\nCows go.\\nCows go who?\\nMOO!\"))], [ChatGeneration(text=\" Knock, knock!\\nWho's there?\\nCows go.\\nCows go who?\\nMOO!\", message=AIMessage(content=\" Knock, knock!\\nWho's there?\\nCows go.\\nCows go who?\\nMOO!\"))]], llm_output={}, run=[RunInfo(run_id=UUID('f2255321-2d8e-41cc-adbd-3f4facec7573')), RunInfo(run_id=UUID('fcc297d0-6ca9-48cb-9d86-e6f78cade8ee'))])"
231+
"LLMResult(generations=[[ChatGeneration(text=\"Why don't eggs tell jokes? They'd crack each other up.\", message=AIMessage(content=\"Why don't eggs tell jokes? They'd crack each other up.\", additional_kwargs={}, response_metadata={}, id='run-d4e44569-39cc-40cc-93fc-de53e599fd51-0'))], [ChatGeneration(text=\"Why don't eggs tell jokes? They'd crack each other up.\", message=AIMessage(content=\"Why don't eggs tell jokes? They'd crack each other up.\", additional_kwargs={}, response_metadata={}, id='run-54647cc2-bee3-4154-ad00-2e547993e6d7-0'))]], llm_output={}, run=[RunInfo(run_id=UUID('d4e44569-39cc-40cc-93fc-de53e599fd51')), RunInfo(run_id=UUID('54647cc2-bee3-4154-ad00-2e547993e6d7'))], type='LLMResult')"
232232
]
233233
},
234-
"execution_count": 9,
234+
"execution_count": 11,
235235
"metadata": {},
236236
"output_type": "execute_result"
237237
}
@@ -242,18 +242,14 @@
242242
},
243243
{
244244
"cell_type": "code",
245-
"execution_count": 10,
245+
"execution_count": 12,
246246
"metadata": {},
247247
"outputs": [
248248
{
249249
"name": "stdout",
250250
"output_type": "stream",
251251
"text": [
252-
" Knock, knock!\n",
253-
"Who's there?\n",
254-
"Cows go.\n",
255-
"Cows go who?\n",
256-
"MOO!"
252+
"Why don't eggs tell jokes? They'd crack each other up."
257253
]
258254
}
259255
],
@@ -265,7 +261,7 @@
265261
],
266262
"metadata": {
267263
"kernelspec": {
268-
"display_name": "langchain",
264+
"display_name": ".venv",
269265
"language": "python",
270266
"name": "python3"
271267
},
@@ -279,7 +275,7 @@
279275
"name": "python",
280276
"nbconvert_exporter": "python",
281277
"pygments_lexer": "ipython3",
282-
"version": "3.11.7"
278+
"version": "3.12.2"
283279
}
284280
},
285281
"nbformat": 4,

0 commit comments

Comments
 (0)