Update test & description
This commit is contained in:
@@ -59,4 +59,7 @@ convention = "google"
|
|||||||
dev = [
|
dev = [
|
||||||
"anyio>=4.7.0",
|
"anyio>=4.7.0",
|
||||||
"langgraph-cli[inmem]>=0.2.8",
|
"langgraph-cli[inmem]>=0.2.8",
|
||||||
|
"mypy>=1.13.0",
|
||||||
|
"pytest>=8.3.5",
|
||||||
|
"ruff>=0.8.2",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ class Configuration(TypedDict):
|
|||||||
Set these when creating assistants OR when invoking the graph.
|
Set these when creating assistants OR when invoking the graph.
|
||||||
See: https://langchain-ai.github.io/langgraph/cloud/how-tos/configuration_cloud/
|
See: https://langchain-ai.github.io/langgraph/cloud/how-tos/configuration_cloud/
|
||||||
"""
|
"""
|
||||||
|
|
||||||
my_configurable_param: str
|
my_configurable_param: str
|
||||||
|
|
||||||
|
|
||||||
@@ -28,17 +29,18 @@ class State:
|
|||||||
Defines the initial structure of incoming data.
|
Defines the initial structure of incoming data.
|
||||||
See: https://langchain-ai.github.io/langgraph/concepts/low_level/#state
|
See: https://langchain-ai.github.io/langgraph/concepts/low_level/#state
|
||||||
"""
|
"""
|
||||||
|
|
||||||
changeme: str = "example"
|
changeme: str = "example"
|
||||||
|
|
||||||
|
|
||||||
async def my_node(state: State, config: RunnableConfig) -> Dict[str, Any]:
|
async def call_model(state: State, config: RunnableConfig) -> Dict[str, Any]:
|
||||||
"""Example node: processes input and returns output.
|
"""Process input and returns output.
|
||||||
|
|
||||||
Can use runtime configuration to alter behavior.
|
Can use runtime configuration to alter behavior.
|
||||||
"""
|
"""
|
||||||
configuration = config["configurable"]
|
configuration = config["configurable"]
|
||||||
return {
|
return {
|
||||||
"changeme": "output from my_node. "
|
"changeme": "output from call_model. "
|
||||||
f'Configured with {configuration.get("my_configurable_param")}'
|
f'Configured with {configuration.get("my_configurable_param")}'
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,7 +48,7 @@ async def my_node(state: State, config: RunnableConfig) -> Dict[str, Any]:
|
|||||||
# Define the graph
|
# Define the graph
|
||||||
graph = (
|
graph = (
|
||||||
StateGraph(State, config_schema=Configuration)
|
StateGraph(State, config_schema=Configuration)
|
||||||
.add_node(my_node)
|
.add_node(call_model)
|
||||||
.add_edge("__start__", "my_node")
|
.add_edge("__start__", "call_model")
|
||||||
.compile(name="New Graph")
|
.compile(name="New Graph")
|
||||||
)
|
)
|
||||||
|
|||||||
6
tests/conftest.py
Normal file
6
tests/conftest.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(scope="session")
|
||||||
|
def anyio_backend():
|
||||||
|
return "asyncio"
|
||||||
@@ -2,8 +2,11 @@ import pytest
|
|||||||
|
|
||||||
from agent import graph
|
from agent import graph
|
||||||
|
|
||||||
|
pytestmark = pytest.mark.anyio
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.langsmith
|
@pytest.mark.langsmith
|
||||||
async def test_agent_simple_passthrough() -> None:
|
async def test_agent_simple_passthrough() -> None:
|
||||||
res = await graph.ainvoke({"changeme": "some_val"})
|
inputs = {"changeme": "some_val"}
|
||||||
|
res = await graph.ainvoke(inputs)
|
||||||
assert res is not None
|
assert res is not None
|
||||||
|
|||||||
Reference in New Issue
Block a user