From f49c45a1ef52bf59b49c234f16dadb3b80a52cf1 Mon Sep 17 00:00:00 2001 From: nightcityblade Date: Tue, 14 Apr 2026 11:09:46 +0800 Subject: [PATCH] docs: fix async memory tool example --- .../lib/tools/_beta_builtin_memory_tool.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/anthropic/lib/tools/_beta_builtin_memory_tool.py b/src/anthropic/lib/tools/_beta_builtin_memory_tool.py index edb948a2..ec519e0b 100644 --- a/src/anthropic/lib/tools/_beta_builtin_memory_tool.py +++ b/src/anthropic/lib/tools/_beta_builtin_memory_tool.py @@ -175,21 +175,25 @@ class BetaAsyncAbstractMemoryTool(BetaAsyncBuiltinFunctionTool): Example usage: ```py - class MyMemoryTool(BetaAbstractMemoryTool): - def view(self, command: BetaMemoryTool20250818ViewCommand) -> BetaFunctionToolResultType: + class MyMemoryTool(BetaAsyncAbstractMemoryTool): + async def view( + self, command: BetaMemoryTool20250818ViewCommand + ) -> BetaFunctionToolResultType: ... return "view result" - def create(self, command: BetaMemoryTool20250818CreateCommand) -> BetaFunctionToolResultType: + async def create( + self, command: BetaMemoryTool20250818CreateCommand + ) -> BetaFunctionToolResultType: ... return "created successfully" # ... implement other abstract methods - client = Anthropic() + client = AsyncAnthropic() memory_tool = MyMemoryTool() - message = client.beta.messages.run_tools( + message = await client.beta.messages.run_tools( model="claude-sonnet-4-5", messages=[{"role": "user", "content": "Remember that I like coffee"}], tools=[memory_tool],