diff --git a/cookbooks/05-Basic_Agent_Creation_and_Interaction.py b/cookbooks/05-Basic_Agent_Creation_and_Interaction.py index 93d30dd4b..c701471f7 100644 --- a/cookbooks/05-Basic_Agent_Creation_and_Interaction.py +++ b/cookbooks/05-Basic_Agent_Creation_and_Interaction.py @@ -33,7 +33,7 @@ # Create a session for interaction session = client.sessions.create( - agent_id=agent.id, + agent=agent.id, context_overflow="adaptive" ) @@ -41,9 +41,14 @@ # Function to chat with the agent def chat_with_agent(message): + message = { + "role": "user", + "content": message, + } + # TODO: message validation error response = client.sessions.chat( session_id=session.id, - message=message + messages=[message], ) return response.choices[0].message.content diff --git a/cookbooks/06-Designing_Multi-Step_Tasks.py b/cookbooks/06-Designing_Multi-Step_Tasks.py index 83262f20b..395f409cf 100644 --- a/cookbooks/06-Designing_Multi-Step_Tasks.py +++ b/cookbooks/06-Designing_Multi-Step_Tasks.py @@ -60,39 +60,39 @@ integration: provider: brave setup: - api_key: "your_brave_api_key" + api_key: "your_api_key" main: # Step 1: Prompt - Initial research question - prompt: - - role: system - content: "You are a research assistant. Your task is to formulate three specific research questions about the given topic: {{inputs[0].topic}}" + - role: system + content: "You are a research assistant. Your task is to formulate three specific research questions about the given topic: {{inputs[0].topic}}" unwrap: true # Step 2: Tool Call - Web search for each question - foreach: - in: "_.split('\\n')" + in: "_.split('\n')" do: tool: web_search arguments: - query: "_" + query: _ # Step 3: Evaluate - Extract relevant information - evaluate: - relevant_info: "[output['organic'][0]['description'] for output in _]" + relevant_info: "[output for output in _]" # Step 4: Conditional Logic - Check if enough information is gathered - if: "len(_.relevant_info) >= 3" then: - - prompt: - - role: system - content: "Summarize the following information about {{inputs[0].topic}}:\n{{_.relevant_info}}" - unwrap: true + prompt: + - role: system + content: "Summarize the following information about {{inputs[0].topic}}:\n{{_.relevant_info}}" + unwrap: true else: - - prompt: - - role: system - content: "Not enough information gathered. Please provide a brief overview of {{inputs[0].topic}} based on your knowledge." - unwrap: true + prompt: + - role: system + content: "Not enough information gathered. Please provide a brief overview of {{inputs[0].topic}} based on your knowledge." + unwrap: true # Step 5: Log - Record the summary - log: "Summary for {{inputs[0].topic}}: {{_}}" @@ -101,6 +101,7 @@ - return: summary: "_" topic: "inputs[0].topic" + """) # Creating/Updating a task diff --git a/cookbooks/07-Integrating_External_Tools_and_APIs.py b/cookbooks/07-Integrating_External_Tools_and_APIs.py index d23e7ef09..fa93f687a 100644 --- a/cookbooks/07-Integrating_External_Tools_and_APIs.py +++ b/cookbooks/07-Integrating_External_Tools_and_APIs.py @@ -56,13 +56,6 @@ integration: provider: wikipedia -- name: news_api - type: integration - integration: - provider: newsapi - setup: - api_key: "YOUR_NEWSAPI_API_KEY" - main: - tool: brave_search arguments: @@ -76,12 +69,6 @@ arguments: query: "{{inputs[0].topic}}" -- tool: news_api - arguments: - q: "{{inputs[0].topic}}" - language: "en" - sortBy: "relevancy" - - prompt: - role: system content: >- @@ -90,16 +77,14 @@ 1. Overview (based on Wikipedia data) 2. Latest Developments (based on Brave Search results) - 3. Recent News (based on News API results) - 4. Weather Impact (if applicable, based on weather data for {{inputs[0].location}}) - 5. Analysis and Conclusions + 3. Weather Impact (if applicable, based on weather data for {{inputs[0].location}}) + 4. Analysis and Conclusions Use the following data for your report: Brave Search Results: {{outputs[0]}} Weather Data: {{outputs[1]}} Wikipedia Data: {{outputs[2]}} - News API Results: {{outputs[3]}} Provide a well-structured, informative report that synthesizes information from all these sources. unwrap: true