This commit is contained in:
Eugene Yurtsev 2024-11-22 16:21:07 -05:00
parent 6119424343
commit 557f85d7fd
2 changed files with 25 additions and 4 deletions

View File

@ -468,6 +468,7 @@
'const': 'ai',
'default': 'ai',
'title': 'Type',
'type': 'string',
}),
'usage_metadata': dict({
'anyOf': list([
@ -580,6 +581,7 @@
'const': 'AIMessageChunk',
'default': 'AIMessageChunk',
'title': 'Type',
'type': 'string',
}),
'usage_metadata': dict({
'anyOf': list([
@ -664,6 +666,7 @@
'const': 'chat',
'default': 'chat',
'title': 'Type',
'type': 'string',
}),
}),
'required': list([
@ -738,6 +741,7 @@
'const': 'ChatMessageChunk',
'default': 'ChatMessageChunk',
'title': 'Type',
'type': 'string',
}),
}),
'required': list([
@ -809,6 +813,7 @@
'const': 'function',
'default': 'function',
'title': 'Type',
'type': 'string',
}),
}),
'required': list([
@ -871,6 +876,7 @@
'const': 'FunctionMessageChunk',
'default': 'FunctionMessageChunk',
'title': 'Type',
'type': 'string',
}),
}),
'required': list([
@ -969,6 +975,7 @@
'const': 'human',
'default': 'human',
'title': 'Type',
'type': 'string',
}),
}),
'required': list([
@ -1043,6 +1050,7 @@
'const': 'HumanMessageChunk',
'default': 'HumanMessageChunk',
'title': 'Type',
'type': 'string',
}),
}),
'required': list([
@ -1141,6 +1149,7 @@
'type': dict({
'const': 'invalid_tool_call',
'title': 'Type',
'type': 'string',
}),
}),
'required': list([
@ -1266,6 +1275,7 @@
'const': 'system',
'default': 'system',
'title': 'Type',
'type': 'string',
}),
}),
'required': list([
@ -1335,6 +1345,7 @@
'const': 'SystemMessageChunk',
'default': 'SystemMessageChunk',
'title': 'Type',
'type': 'string',
}),
}),
'required': list([
@ -1383,6 +1394,7 @@
'type': dict({
'const': 'tool_call',
'title': 'Type',
'type': 'string',
}),
}),
'required': list([
@ -1461,6 +1473,7 @@
'type': dict({
'const': 'tool_call_chunk',
'title': 'Type',
'type': 'string',
}),
}),
'required': list([
@ -1583,6 +1596,7 @@
'const': 'tool',
'default': 'tool',
'title': 'Type',
'type': 'string',
}),
}),
'required': list([
@ -1664,6 +1678,7 @@
'const': 'ToolMessageChunk',
'default': 'ToolMessageChunk',
'title': 'Type',
'type': 'string',
}),
}),
'required': list([

View File

@ -12,6 +12,7 @@ from langchain_core.prompts.prompt import PromptTemplate
from langchain_core.runnables.base import Runnable, RunnableConfig
from langchain_core.runnables.graph import Edge, Graph, Node
from langchain_core.runnables.graph_mermaid import _escape_node_label
from langchain_core.utils.pydantic import PYDANTIC_MAJOR_VERSION, PYDANTIC_MINOR_VERSION
from tests.unit_tests.pydantic_utils import _normalize_schema
@ -210,10 +211,15 @@ def test_graph_sequence_map(snapshot: SnapshotAssertion) -> None:
}
)
graph = sequence.get_graph()
assert _normalize_schema(graph.to_json(with_schemas=True)) == snapshot(
name="graph_with_schema"
)
assert _normalize_schema(graph.to_json()) == snapshot(name="graph_no_schemas")
if (PYDANTIC_MAJOR_VERSION, PYDANTIC_MINOR_VERSION) >= (2, 10):
assert _normalize_schema(graph.to_json(with_schemas=True)) == snapshot(
name="graph_with_schema"
)
if (PYDANTIC_MAJOR_VERSION, PYDANTIC_MINOR_VERSION) >= (2, 10):
assert _normalize_schema(graph.to_json()) == snapshot(name="graph_no_schemas")
assert graph.draw_ascii() == snapshot(name="ascii")
assert graph.draw_mermaid() == snapshot(name="mermaid")
assert graph.draw_mermaid(with_styles=False) == snapshot(name="mermaid-simple")