Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions python/restate/ext/langchain/_middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,9 @@ async def awrap_tool_call(
request: ToolCallRequest,
handler: Callable[[ToolCallRequest], Awaitable[ToolCallResult]],
) -> ToolCallResult:
tool_call = request.tool_call
tool_call_id: Optional[str] = tool_call.get("id") if isinstance(tool_call, dict) else None
tool_call_id = request.tool_call.get("id")
if tool_call_id is None:
return await handler(request)
return ToolMessage("Function call ID is required for tool invocation. Please set `id` on the ToolCall.")

ctx = current_context()
assert ctx is not None, "RestateMiddleware must run inside a Restate handler"
Expand Down
Loading