Skip to content

Commit e09d90b

Browse files
authored
Merge branch 'master' into wip-v1.0
2 parents ddde1ef + b26e52a commit e09d90b

Some content is hidden

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

44 files changed

+8244
-154
lines changed

β€Ž.github/workflows/check_core_versions.ymlβ€Ž

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,30 @@ jobs:
2020

2121
- name: 'βœ… Verify pyproject.toml & version.py Match'
2222
run: |
23-
PYPROJECT_VERSION=$(grep -Po '(?<=^version = ")[^"]*' libs/core/pyproject.toml)
24-
VERSION_PY_VERSION=$(grep -Po '(?<=^VERSION = ")[^"]*' libs/core/langchain_core/version.py)
23+
# Check core versions
24+
CORE_PYPROJECT_VERSION=$(grep -Po '(?<=^version = ")[^"]*' libs/core/pyproject.toml)
25+
CORE_VERSION_PY_VERSION=$(grep -Po '(?<=^VERSION = ")[^"]*' libs/core/langchain_core/version.py)
2526
26-
# Compare the two versions
27-
if [ "$PYPROJECT_VERSION" != "$VERSION_PY_VERSION" ]; then
27+
# Compare core versions
28+
if [ "$CORE_PYPROJECT_VERSION" != "$CORE_VERSION_PY_VERSION" ]; then
2829
echo "langchain-core versions in pyproject.toml and version.py do not match!"
29-
echo "pyproject.toml version: $PYPROJECT_VERSION"
30-
echo "version.py version: $VERSION_PY_VERSION"
30+
echo "pyproject.toml version: $CORE_PYPROJECT_VERSION"
31+
echo "version.py version: $CORE_VERSION_PY_VERSION"
3132
exit 1
3233
else
33-
echo "Versions match: $PYPROJECT_VERSION"
34+
echo "Core versions match: $CORE_PYPROJECT_VERSION"
35+
fi
36+
37+
# Check langchain_v1 versions
38+
LANGCHAIN_PYPROJECT_VERSION=$(grep -Po '(?<=^version = ")[^"]*' libs/langchain_v1/pyproject.toml)
39+
LANGCHAIN_INIT_PY_VERSION=$(grep -Po '(?<=^__version__ = ")[^"]*' libs/langchain_v1/langchain/__init__.py)
40+
41+
# Compare langchain_v1 versions
42+
if [ "$LANGCHAIN_PYPROJECT_VERSION" != "$LANGCHAIN_INIT_PY_VERSION" ]; then
43+
echo "langchain_v1 versions in pyproject.toml and __init__.py do not match!"
44+
echo "pyproject.toml version: $LANGCHAIN_PYPROJECT_VERSION"
45+
echo "version.py version: $LANGCHAIN_INIT_PY_VERSION"
46+
exit 1
47+
else
48+
echo "Langchain v1 versions match: $LANGCHAIN_PYPROJECT_VERSION"
3449
fi

β€Ždocs/docs/how_to/index.mdxβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ sidebar_class_name: hidden
55

66
# How-to guides
77

8-
Here you’ll find answers to β€œHow do I….?” types of questions.
8+
Here you’ll find answers to "How do I….?" types of questions.
99
These guides are *goal-oriented* and *concrete*; they're meant to help you complete a specific task.
1010
For conceptual explanations see the [Conceptual guide](/docs/concepts/).
1111
For end-to-end walkthroughs see [Tutorials](/docs/tutorials).

β€Ždocs/docs/integrations/document_loaders/oracleadb_loader.ipynbβ€Ž

Lines changed: 73 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2,67 +2,91 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5+
"metadata": {
6+
"collapsed": false,
7+
"jupyter": {
8+
"outputs_hidden": false
9+
}
10+
},
511
"source": [
612
"# Oracle Autonomous Database\n",
713
"\n",
8-
"Oracle autonomous database is a cloud database that uses machine learning to automate database tuning, security, backups, updates, and other routine management tasks traditionally performed by DBAs.\n",
14+
"Oracle Autonomous Database is a cloud database that uses machine learning to automate database tuning, security, backups, updates, and other routine management tasks traditionally performed by DBAs.\n",
915
"\n",
10-
"This notebook covers how to load documents from oracle autonomous database, the loader supports connection with connection string or tns configuration.\n",
16+
"This notebook covers how to load documents from Oracle Autonomous Database.\n",
1117
"\n",
1218
"## Prerequisites\n",
13-
"1. Database runs in a 'Thin' mode:\n",
14-
" https://python-oracledb.readthedocs.io/en/latest/user_guide/appendix_b.html\n",
15-
"2. `pip install oracledb`:\n",
16-
" https://python-oracledb.readthedocs.io/en/latest/user_guide/installation.html"
17-
],
18-
"metadata": {
19-
"collapsed": false
20-
}
19+
"1. Install python-oracledb:\n",
20+
"\n",
21+
" `pip install oracledb`\n",
22+
" \n",
23+
" See [Installing python-oracledb](https://python-oracledb.readthedocs.io/en/latest/user_guide/installation.html).\n",
24+
"\n",
25+
"2. A database that python-oracledb's default 'Thin' mode can connected to. This is true of Oracle Autonomous Database, see [python-oracledb Architecture](https://python-oracledb.readthedocs.io/en/latest/user_guide/introduction.html#architecture).\n"
26+
]
2127
},
2228
{
2329
"cell_type": "markdown",
30+
"metadata": {
31+
"collapsed": false,
32+
"jupyter": {
33+
"outputs_hidden": false
34+
}
35+
},
2436
"source": [
2537
"## Instructions"
26-
],
27-
"metadata": {
28-
"collapsed": false
29-
}
38+
]
3039
},
3140
{
3241
"cell_type": "code",
3342
"execution_count": null,
43+
"metadata": {
44+
"collapsed": false,
45+
"jupyter": {
46+
"outputs_hidden": false
47+
}
48+
},
3449
"outputs": [],
3550
"source": [
3651
"pip install oracledb"
37-
],
38-
"metadata": {
39-
"collapsed": false
40-
}
52+
]
4153
},
4254
{
4355
"cell_type": "code",
4456
"execution_count": null,
57+
"metadata": {
58+
"collapsed": false,
59+
"jupyter": {
60+
"outputs_hidden": false
61+
}
62+
},
4563
"outputs": [],
4664
"source": [
4765
"from langchain_community.document_loaders import OracleAutonomousDatabaseLoader\n",
4866
"from settings import s"
49-
],
50-
"metadata": {
51-
"collapsed": false
52-
}
67+
]
5368
},
5469
{
5570
"cell_type": "markdown",
56-
"source": [
57-
"With mutual TLS authentication (mTLS), wallet_location and wallet_password are required to create the connection, user can create connection by providing either connection string or tns configuration details."
58-
],
5971
"metadata": {
60-
"collapsed": false
61-
}
72+
"collapsed": false,
73+
"jupyter": {
74+
"outputs_hidden": false
75+
}
76+
},
77+
"source": [
78+
"With mutual TLS authentication (mTLS), wallet_location and wallet_password parameters are required to create the connection. See python-oracledb documentation [Connecting to Oracle Cloud Autonomous Databases](https://python-oracledb.readthedocs.io/en/latest/user_guide/connection_handling.html#connecting-to-oracle-cloud-autonomous-databases)."
79+
]
6280
},
6381
{
6482
"cell_type": "code",
6583
"execution_count": null,
84+
"metadata": {
85+
"collapsed": false,
86+
"jupyter": {
87+
"outputs_hidden": false
88+
}
89+
},
6690
"outputs": [],
6791
"source": [
6892
"SQL_QUERY = \"select prod_id, time_id from sh.costs fetch first 5 rows only\"\n",
@@ -89,24 +113,30 @@
89113
" wallet_password=s.PASSWORD,\n",
90114
")\n",
91115
"doc_2 = doc_loader_2.load()"
92-
],
93-
"metadata": {
94-
"collapsed": false
95-
}
116+
]
96117
},
97118
{
98119
"cell_type": "markdown",
99-
"source": [
100-
"With TLS authentication, wallet_location and wallet_password are not required.\n",
101-
"Bind variable option is provided by argument \"parameters\"."
102-
],
103120
"metadata": {
104-
"collapsed": false
105-
}
121+
"collapsed": false,
122+
"jupyter": {
123+
"outputs_hidden": false
124+
}
125+
},
126+
"source": [
127+
"With 1-way TLS authentication, only the database credentials and connection string are required to establish a connection.\n",
128+
"The example below also shows passing bind variable values with the argument \"parameters\"."
129+
]
106130
},
107131
{
108132
"cell_type": "code",
109133
"execution_count": null,
134+
"metadata": {
135+
"collapsed": false,
136+
"jupyter": {
137+
"outputs_hidden": false
138+
}
139+
},
110140
"outputs": [],
111141
"source": [
112142
"SQL_QUERY = \"select channel_id, channel_desc from sh.channels where channel_desc = :1 fetch first 5 rows only\"\n",
@@ -131,31 +161,28 @@
131161
" parameters=[\"Direct Sales\"],\n",
132162
")\n",
133163
"doc_4 = doc_loader_4.load()"
134-
],
135-
"metadata": {
136-
"collapsed": false
137-
}
164+
]
138165
}
139166
],
140167
"metadata": {
141168
"kernelspec": {
142-
"display_name": "Python 3",
169+
"display_name": "Python 3 (ipykernel)",
143170
"language": "python",
144171
"name": "python3"
145172
},
146173
"language_info": {
147174
"codemirror_mode": {
148175
"name": "ipython",
149-
"version": 2
176+
"version": 3
150177
},
151178
"file_extension": ".py",
152179
"mimetype": "text/x-python",
153180
"name": "python",
154181
"nbconvert_exporter": "python",
155-
"pygments_lexer": "ipython2",
156-
"version": "2.7.6"
182+
"pygments_lexer": "ipython3",
183+
"version": "3.12.11"
157184
}
158185
},
159186
"nbformat": 4,
160-
"nbformat_minor": 0
187+
"nbformat_minor": 4
161188
}

β€Ždocs/docs/introduction.mdxβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Head to the reference section for full documentation of all classes and methods
104104
Trace and evaluate your language model applications and intelligent agents to help you move from prototype to production.
105105

106106
### [πŸ¦œπŸ•ΈοΈ LangGraph](https://langchain-ai.github.io/langgraph)
107-
Build stateful, multi-actor applications with LLMs. Integrates smoothly with LangChain, but can be used without it. LangGraph powers production-grade agents, trusted by Linkedin, Uber, Klarna, GitLab, and many more.
107+
Build stateful, multi-actor applications with LLMs. Integrates smoothly with LangChain, but can be used without it. LangGraph powers production-grade agents, trusted by LinkedIn, Uber, Klarna, GitLab, and many more.
108108

109109
## Additional resources
110110

β€Ždocs/docs/tutorials/llm_chain.ipynbβ€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@
159159
},
160160
{
161161
"cell_type": "code",
162-
"execution_count": 3,
162+
"execution_count": null,
163163
"id": "1b2481f0",
164164
"metadata": {},
165165
"outputs": [
@@ -178,8 +178,8 @@
178178
"from langchain_core.messages import HumanMessage, SystemMessage\n",
179179
"\n",
180180
"messages = [\n",
181-
" SystemMessage(\"Translate the following from English into Italian\"),\n",
182-
" HumanMessage(\"hi!\"),\n",
181+
" SystemMessage(content=\"Translate the following from English into Italian\"),\n",
182+
" HumanMessage(content=\"hi!\"),\n",
183183
"]\n",
184184
"\n",
185185
"model.invoke(messages)"

β€Žlibs/langchain_v1/Makefileβ€Ž

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: all clean docs_build docs_clean docs_linkcheck api_docs_build api_docs_clean api_docs_linkcheck format lint test tests test_watch integration_tests help extended_tests
1+
.PHONY: all clean docs_build docs_clean docs_linkcheck api_docs_build api_docs_clean api_docs_linkcheck format lint test tests test_watch integration_tests help extended_tests start_services stop_services
22

33
# Default target executed when no arguments are given to make.
44
all: help
@@ -7,6 +7,12 @@ all: help
77
# TESTING AND COVERAGE
88
######################
99

10+
start_services:
11+
docker compose -f tests/unit_tests/agents/compose-postgres.yml -f tests/unit_tests/agents/compose-redis.yml up -V --force-recreate --wait --remove-orphans
12+
13+
stop_services:
14+
docker compose -f tests/unit_tests/agents/compose-postgres.yml -f tests/unit_tests/agents/compose-redis.yml down -v
15+
1016
# Define a variable for the test file path.
1117
TEST_FILE ?= tests/unit_tests/
1218

@@ -21,17 +27,32 @@ coverage:
2127
--cov-report term-missing:skip-covered \
2228
$(TEST_FILE)
2329

24-
test tests:
25-
uv run --group test pytest -n auto --disable-socket --allow-unix-socket $(TEST_FILE)
30+
test:
31+
make start_services && LANGGRAPH_TEST_FAST=0 uv run --group test pytest -n auto --disable-socket --allow-unix-socket $(TEST_FILE) --cov-report term-missing:skip-covered; \
32+
EXIT_CODE=$$?; \
33+
make stop_services; \
34+
exit $$EXIT_CODE
35+
36+
test_fast:
37+
LANGGRAPH_TEST_FAST=1 uv run --group test pytest -n auto --disable-socket --allow-unix-socket $(TEST_FILE)
2638

2739
extended_tests:
28-
uv run --group test pytest --disable-socket --allow-unix-socket --only-extended tests/unit_tests
40+
make start_services && LANGGRAPH_TEST_FAST=0 uv run --group test pytest --disable-socket --allow-unix-socket --only-extended tests/unit_tests; \
41+
EXIT_CODE=$$?; \
42+
make stop_services; \
43+
exit $$EXIT_CODE
2944

3045
test_watch:
31-
uv run --group test ptw --snapshot-update --now . -- -x --disable-socket --allow-unix-socket --disable-warnings tests/unit_tests
46+
make start_services && LANGGRAPH_TEST_FAST=0 uv run --group test ptw --snapshot-update --now . -- -x --disable-socket --allow-unix-socket --disable-warnings tests/unit_tests; \
47+
EXIT_CODE=$$?; \
48+
make stop_services; \
49+
exit $$EXIT_CODE
3250

3351
test_watch_extended:
34-
uv run --group test ptw --snapshot-update --now . -- -x --disable-socket --allow-unix-socket --only-extended tests/unit_tests
52+
make start_services && LANGGRAPH_TEST_FAST=0 uv run --group test ptw --snapshot-update --now . -- -x --disable-socket --allow-unix-socket --only-extended tests/unit_tests; \
53+
EXIT_CODE=$$?; \
54+
make stop_services; \
55+
exit $$EXIT_CODE
3556

3657
integration_tests:
3758
uv run --group test --group test_integration pytest tests/integration_tests
@@ -87,7 +108,8 @@ help:
87108
@echo 'spell_fix - run codespell on the project and fix the errors'
88109
@echo '-- TESTS --'
89110
@echo 'coverage - run unit tests and generate coverage report'
90-
@echo 'test - run unit tests'
111+
@echo 'test - run unit tests with all services'
112+
@echo 'test_fast - run unit tests with in-memory services only'
91113
@echo 'tests - run unit tests (alias for "make test")'
92114
@echo 'test TEST_FILE=<test_file> - run all tests in file'
93115
@echo 'extended_tests - run only extended unit tests'

β€Žlibs/langchain_v1/langchain/__init__.pyβ€Ž

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
1-
"""Main entrypoint into package."""
1+
"""Main entrypoint into LangChain."""
22

3-
from importlib import metadata
43
from typing import Any
54

6-
try:
7-
__version__ = metadata.version(__package__)
8-
except metadata.PackageNotFoundError:
9-
# Case where package metadata is not available.
10-
__version__ = ""
11-
del metadata # optional, avoids polluting the results of dir(__package__)
5+
__version__ = "1.0.0a1"
126

137

148
def __getattr__(name: str) -> Any: # noqa: ANN401
15-
"""Get an attribute from the package."""
9+
"""Get an attribute from the package.
10+
11+
TODO: will be removed in a future alpha version.
12+
"""
1613
if name == "verbose":
1714
from langchain.globals import _verbose
1815

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
"""langgraph.prebuilt exposes a higher-level API for creating and executing agents and tools."""
2+
3+
from langchain.agents.react_agent import AgentState, create_react_agent
4+
from langchain.agents.tool_node import ToolNode
5+
6+
__all__ = [
7+
"AgentState",
8+
"ToolNode",
9+
"create_react_agent",
10+
]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Internal utilities for agents."""
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"""Typing utilities for agents."""
2+
3+
from __future__ import annotations
4+
5+
from collections.abc import Awaitable, Callable
6+
from typing import TypeVar, Union
7+
8+
from typing_extensions import ParamSpec
9+
10+
P = ParamSpec("P")
11+
R = TypeVar("R")
12+
13+
SyncOrAsync = Callable[P, Union[R, Awaitable[R]]]

0 commit comments

Comments
Β (0)