Update test & description

This commit is contained in:
William Fu-Hinthorn
2025-05-14 06:53:07 -07:00
parent cd1003d7b5
commit f5cd30ad3c
4 changed files with 20 additions and 6 deletions

View File

@@ -59,4 +59,7 @@ convention = "google"
dev = [
"anyio>=4.7.0",
"langgraph-cli[inmem]>=0.2.8",
"mypy>=1.13.0",
"pytest>=8.3.5",
"ruff>=0.8.2",
]

View File

@@ -18,6 +18,7 @@ class Configuration(TypedDict):
Set these when creating assistants OR when invoking the graph.
See: https://langchain-ai.github.io/langgraph/cloud/how-tos/configuration_cloud/
"""
my_configurable_param: str
@@ -28,17 +29,18 @@ class State:
Defines the initial structure of incoming data.
See: https://langchain-ai.github.io/langgraph/concepts/low_level/#state
"""
changeme: str = "example"
async def my_node(state: State, config: RunnableConfig) -> Dict[str, Any]:
"""Example node: processes input and returns output.
async def call_model(state: State, config: RunnableConfig) -> Dict[str, Any]:
"""Process input and returns output.
Can use runtime configuration to alter behavior.
"""
configuration = config["configurable"]
return {
"changeme": "output from my_node. "
"changeme": "output from call_model. "
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
graph = (
StateGraph(State, config_schema=Configuration)
.add_node(my_node)
.add_edge("__start__", "my_node")
.add_node(call_model)
.add_edge("__start__", "call_model")
.compile(name="New Graph")
)

6
tests/conftest.py Normal file
View File

@@ -0,0 +1,6 @@
import pytest
@pytest.fixture(scope="session")
def anyio_backend():
return "asyncio"

View File

@@ -2,8 +2,11 @@ import pytest
from agent import graph
pytestmark = pytest.mark.anyio
@pytest.mark.langsmith
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