From 355c9709f89ff95e74f4e9864c9f487ad48de3ab Mon Sep 17 00:00:00 2001 From: vedantsahai18 Date: Fri, 1 Nov 2024 21:57:01 -0400 Subject: [PATCH] feat(agents-api): prompt step claude hotfix for tools --- .../agents_api/activities/task_steps/prompt_step.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/agents-api/agents_api/activities/task_steps/prompt_step.py b/agents-api/agents_api/activities/task_steps/prompt_step.py index 6a7f136f6..7f08e8d1f 100644 --- a/agents-api/agents_api/activities/task_steps/prompt_step.py +++ b/agents-api/agents_api/activities/task_steps/prompt_step.py @@ -162,11 +162,17 @@ async def prompt_step(context: StepContext) -> StepOutcome: # Anthropic expects a list of messages with role and content (and no name etc) prompt = [{"role": "user", "content": message["content"]} for message in prompt] + # Filter tools for specific types + filtered_tools = [ + tool for tool in formatted_tools + if tool["type"] in ["computer_20241022", "bash_20241022", "text_editor_20241022"] + ] + # Claude Response claude_response: BetaMessage = await client.beta.messages.create( model="claude-3-5-sonnet-20241022", messages=prompt, - tools=formatted_tools, + tools=filtered_tools, max_tokens=1024, betas=betas, )