From 3ddab6f1e15ed7ef34ca4bb74d22c2108196f180 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 29 Oct 2025 10:21:29 +0200 Subject: [PATCH] Fix formatting and highlight code sections MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I don’t see the point of having code highlighting only in this specific example and not elsewhere. But if it’s important, it should highlight the short-term-memory–specific parts rather than the general context. --- src/oss/langchain/short-term-memory.mdx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/oss/langchain/short-term-memory.mdx b/src/oss/langchain/short-term-memory.mdx index 11b1853d9..f30c8723f 100644 --- a/src/oss/langchain/short-term-memory.mdx +++ b/src/oss/langchain/short-term-memory.mdx @@ -679,9 +679,9 @@ def update_user_info( runtime: ToolRuntime[CustomContext, CustomState], ) -> Command: """Look up and update user info.""" - user_id = runtime.context.user_id # [!code highlight] + user_id = runtime.context.user_id name = "John Smith" if user_id == "user_123" else "Unknown user" - return Command(update={ + return Command(update={ # [!code highlight] "user_name": name, # update the message history "messages": [ @@ -699,12 +699,11 @@ def greet( """Use this to greet the user once you found their info.""" user_name = runtime.state["user_name"] return f"Hello {user_name}!" - # [!code highlight] agent = create_agent( model="openai:gpt-5-nano", tools=[update_user_info, greet], - state_schema=CustomState, - context_schema=CustomContext, # [!code highlight] + state_schema=CustomState, # [!code highlight] + context_schema=CustomContext, ) agent.invoke(