Skip to content

Commit

Permalink
feat(cookbooks): minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Vedantsahai18 committed Oct 9, 2024
1 parent 9894aa6 commit 6bb5c0f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
11 changes: 11 additions & 0 deletions cookbooks/11-Advanced_Chat_Interactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 5 additions & 7 deletions cookbooks/13-Error_Handling_and_Recovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}}"
Expand All @@ -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
Expand Down

0 comments on commit 6bb5c0f

Please sign in to comment.