From 64f747fe095570923a331cf29cb6b92d5588512a Mon Sep 17 00:00:00 2001 From: Michael Clifford Date: Wed, 23 Apr 2025 09:57:54 -0400 Subject: [PATCH] feat: add tool name to chat output in playground (#1996) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # What does this PR do? This PR adds the name of the tool that is used by the agent on the "tools" page of the playground. See image below for an example. ![Screenshot 2025-04-18 at 3 14 18 PM](https://github.com/user-attachments/assets/04e97783-4003-4121-9446-9e0ad7209256) ## Test Plan Run the playground and navigate to the tools page. There users can see that this additional text is present when tools are invoked and absent when they are not. ``` streamlit run llama_stack/distribution/ui/app.py ``` Signed-off-by: Michael Clifford --- llama_stack/distribution/ui/page/playground/tools.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/llama_stack/distribution/ui/page/playground/tools.py b/llama_stack/distribution/ui/page/playground/tools.py index c5bb2216a..96c6a1783 100644 --- a/llama_stack/distribution/ui/page/playground/tools.py +++ b/llama_stack/distribution/ui/page/playground/tools.py @@ -144,7 +144,11 @@ def tool_chat_page(): yield response.event.payload.delta.text if response.event.payload.event_type == "step_complete": if response.event.payload.step_details.step_type == "tool_execution": - yield " 🛠 " + if response.event.payload.step_details.tool_calls: + tool_name = str(response.event.payload.step_details.tool_calls[0].tool_name) + yield f'\n\n🛠 :grey[_Using "{tool_name}" tool:_]\n\n' + else: + yield "No tool_calls present in step_details" else: yield f"Error occurred in the Llama Stack Cluster: {response}"