release(langgraph): v1 working branch (#6093)

Diff viewer for langgraph v1 alpha releases

---------

Co-authored-by: ccurme <chester.curme@gmail.com>
Co-authored-by: William FH <13333726+hinthornw@users.noreply.github.com>
Co-authored-by: Mason Daugherty <github@mdrxy.com>
Co-authored-by: Mason Daugherty <mason@langchain.dev>
This commit is contained in:
Sydney Runkle
2025-10-16 07:11:22 -04:00
committed by GitHub
co-authored by ccurme William FH Mason Daugherty Mason Daugherty
parent 9b46cba1fb
commit bce1dcfcd2
25 changed files with 233 additions and 556 deletions
File diff suppressed because one or more lines are too long
+29 -10
View File
@@ -74,17 +74,26 @@ class FakeChatModel(GenericFakeChatModel):
assert isinstance(content, str)
content_chunks = cast(list[str], re.split(r"(\s)", content))
for token in content_chunks:
chunk = ChatGenerationChunk(
message=AIMessageChunk(content=token, id=message.id)
)
for i, token in enumerate(content_chunks):
if i == len(content_chunks) - 1:
chunk = ChatGenerationChunk(
message=AIMessageChunk(
content=token, id=message.id, chunk_position="last"
)
)
else:
chunk = ChatGenerationChunk(
message=AIMessageChunk(content=token, id=message.id)
)
if run_manager:
run_manager.on_llm_new_token(token, chunk=chunk)
yield chunk
else:
args = message.__dict__
args.pop("type")
chunk = ChatGenerationChunk(message=AIMessageChunk(**args))
chunk = ChatGenerationChunk(
message=AIMessageChunk(**args, chunk_position="last")
)
if run_manager:
run_manager.on_llm_new_token("", chunk=chunk)
yield chunk
@@ -122,17 +131,27 @@ class FakeChatModel(GenericFakeChatModel):
assert isinstance(content, str)
content_chunks = cast(list[str], re.split(r"(\s)", content))
for token in content_chunks:
chunk = ChatGenerationChunk(
message=AIMessageChunk(content=token, id=message.id)
)
for i, token in enumerate(content_chunks):
if i == len(content_chunks) - 1:
chunk = ChatGenerationChunk(
message=AIMessageChunk(
content=token, id=message.id, chunk_position="last"
)
)
else:
chunk = ChatGenerationChunk(
message=AIMessageChunk(content=token, id=message.id)
)
if run_manager:
run_manager.on_llm_new_token(token, chunk=chunk)
yield chunk
else:
args = message.__dict__
args.pop("type")
chunk = ChatGenerationChunk(message=AIMessageChunk(**args))
chunk = ChatGenerationChunk(
message=AIMessageChunk(**args, chunk_position="last")
)
if run_manager:
await run_manager.on_llm_new_token("", chunk=chunk)
yield chunk
+3
View File
@@ -1387,6 +1387,7 @@ def test_prebuilt_tool_chat(snapshot: SnapshotAssertion) -> None:
"type": "tool_call_chunk",
}
],
chunk_position="last",
),
{
"langgraph_step": 1,
@@ -1446,6 +1447,7 @@ def test_prebuilt_tool_chat(snapshot: SnapshotAssertion) -> None:
"type": "tool_call_chunk",
},
],
chunk_position="last",
),
{
"langgraph_step": 3,
@@ -1494,6 +1496,7 @@ def test_prebuilt_tool_chat(snapshot: SnapshotAssertion) -> None:
(
_AnyIdAIMessageChunk(
content="answer",
chunk_position="last",
),
{
"langgraph_step": 5,
@@ -1140,6 +1140,7 @@ async def test_prebuilt_tool_chat() -> None:
"type": "tool_call_chunk",
}
],
chunk_position="last",
),
{
"langgraph_step": 1,
@@ -1199,6 +1200,7 @@ async def test_prebuilt_tool_chat() -> None:
"type": "tool_call_chunk",
},
],
chunk_position="last",
),
{
"langgraph_step": 3,
@@ -1247,6 +1249,7 @@ async def test_prebuilt_tool_chat() -> None:
(
_AnyIdAIMessageChunk(
content="answer",
chunk_position="last",
),
{
"langgraph_step": 5,
+4 -1
View File
@@ -20,7 +20,10 @@ from langgraph.graph.message import REMOVE_ALL_MESSAGES, MessagesState, push_mes
from langgraph.graph.state import StateGraph
from tests.messages import _AnyIdHumanMessage
_, CORE_MINOR, CORE_PATCH = (int(v) for v in langchain_core.__version__.split("."))
_, CORE_MINOR, CORE_PATCH = (
int("".join(c for c in v if c.isdigit()))
for v in langchain_core.__version__.split(".")
)
def test_add_single_message():
+1 -1
View File
@@ -6601,7 +6601,7 @@ def test_tags_stream_mode_messages() -> None:
)
) == [
(
_AnyIdAIMessageChunk(content="foo"),
_AnyIdAIMessageChunk(content="foo", chunk_position="last"),
{
"langgraph_step": 1,
"langgraph_node": "call_model",
+1 -1
View File
@@ -7548,7 +7548,7 @@ async def test_tags_stream_mode_messages() -> None:
)
] == [
(
_AnyIdAIMessageChunk(content="foo"),
_AnyIdAIMessageChunk(content="foo", chunk_position="last"),
{
"langgraph_step": 1,
"langgraph_node": "call_model",
+23 -5
View File
@@ -17,16 +17,13 @@ import langsmith
import pytest
from typing_extensions import NotRequired, Required, TypedDict
from langgraph._internal._config import _is_not_empty
from langgraph._internal._config import _is_not_empty, ensure_config
from langgraph._internal._fields import (
_is_optional_type,
get_enhanced_type_hints,
get_field_default,
)
from langgraph._internal._runnable import (
is_async_callable,
is_async_generator,
)
from langgraph._internal._runnable import is_async_callable, is_async_generator
from langgraph.constants import END
from langgraph.graph import StateGraph
from langgraph.graph.state import CompiledStateGraph
@@ -301,3 +298,24 @@ def test_is_not_empty() -> None:
assert not _is_not_empty([])
assert not _is_not_empty(())
assert not _is_not_empty({})
def test_configurable_metadata():
config = {
"configurable": {
"a-key": "foo",
"somesecretval": "bar",
"sometoken": "thetoken",
"__dontinclude": "bar",
"includeme": "hi",
"andme": 42,
"nested": {"foo": "bar"},
"nooverride": -2,
},
"metadata": {"nooverride": 18},
}
expected = {"includeme", "andme", "nooverride"}
merged = ensure_config(config)
metadata = merged["metadata"]
assert metadata.keys() == expected
assert metadata["nooverride"] == 18