From 6bb5c0f4321bb6cb0a6255fa24388a203ff9a848 Mon Sep 17 00:00:00 2001 From: vedantsahai18 Date: Wed, 9 Oct 2024 17:47:45 -0400 Subject: [PATCH] feat(cookbooks): minor fixes --- cookbooks/11-Advanced_Chat_Interactions.py | 11 +++++++++++ cookbooks/13-Error_Handling_and_Recovery.py | 12 +++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/cookbooks/11-Advanced_Chat_Interactions.py b/cookbooks/11-Advanced_Chat_Interactions.py index cfa9161c2..e3b9bebad 100644 --- a/cookbooks/11-Advanced_Chat_Interactions.py +++ b/cookbooks/11-Advanced_Chat_Interactions.py @@ -39,6 +39,17 @@ model="gpt-4-turbo", ) +# Add a web search tool to the agent +client.agents.tools.create( + agent_id=AGENT_UUID, + name="web_search", + integration={ + "provider": "brave", + "method": "search", + "setup": {"api_key": "YOUR_BRAVE_API_KEY"}, + }, +) + # Defining a task for handling complex conversations chat_task_def = yaml.safe_load(""" name: Advanced Chat Interaction diff --git a/cookbooks/13-Error_Handling_and_Recovery.py b/cookbooks/13-Error_Handling_and_Recovery.py index 186e3e77c..971e6889e 100644 --- a/cookbooks/13-Error_Handling_and_Recovery.py +++ b/cookbooks/13-Error_Handling_and_Recovery.py @@ -75,11 +75,9 @@ type: string main: -- evaluate: - value: inputs[0].operation - + - switch: - case: "'divide'" + case: "inputs[0].operation == 'divide'" tool: divide arguments: divisor: inputs[0].value @@ -89,7 +87,7 @@ delay: 2 fallback: return: "Error: Division by zero or invalid input" - case: "'api_call'" + case: "inputs[0].operation == 'api_call'" tool: api_call arguments: endpoint: "/status/{{inputs[0].value}}" @@ -99,9 +97,9 @@ delay: 5 fallback: return: "Error: API call failed after multiple attempts" - case: "'process_data'" + case: "inputs[0].operation == 'process_data'" evaluate: - data: "'Sample data: ' + str(inputs[0].value)" + data: "'Sample data: ' + str(inputs[0].value)" tool: process_data arguments: data: _.data