From 15b5c973af04d9c05925c5f130dba29f98f6be8c Mon Sep 17 00:00:00 2001 From: Patrick Marlow Date: Tue, 9 Jul 2024 22:54:52 -0600 Subject: [PATCH] fix: linting --- data/get_weather_tool.py | 9 ++++++-- .../genai_agents_101.ipynb | 21 +++++-------------- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/data/get_weather_tool.py b/data/get_weather_tool.py index 9d2a41b2..d95d37b7 100644 --- a/data/get_weather_tool.py +++ b/data/get_weather_tool.py @@ -1,3 +1,4 @@ +"""Sample Tool for Agent Builder.""" import logging import requests from google.auth import default as google_default_auth @@ -21,7 +22,8 @@ def get_request_params(param, default=None): request_json = request.get_json(silent=True) request_args = request.args - return (request_json or {}).get(param, default) or request_args.get(param, default) + return (request_json or {}).get(param, default) or request_args.get( + param, default) @app.route("/get_weather_grid", methods=["GET", "POST"]) def get_weather_grid(): @@ -43,7 +45,10 @@ def get_weather_grid(): # just take the weather from the current period period = data["properties"]["periods"][0] - return {"temperature": period["temperature"], "temperatureUnit": period["temperatureUnit"]} + return { + "temperature": period["temperature"], + "temperatureUnit": period["temperatureUnit"] + } return {} diff --git a/examples/bot_building_series/genai_agents_101.ipynb b/examples/bot_building_series/genai_agents_101.ipynb index 842ae958..987bfa1e 100644 --- a/examples/bot_building_series/genai_agents_101.ipynb +++ b/examples/bot_building_series/genai_agents_101.ipynb @@ -354,12 +354,9 @@ "- Functions\n", "- Data Stores\n", "\n", - "In this next section, we'll create an 2 `OpenAPI Spec` tools that can do the following:\n", - "- Search for points of interest based on the [Google Places API](https://developers.google.com/maps/documentation/places/web-service/overview)\n", + "In this next section, we'll create an `OpenAPI Spec` tool that can do the following:\n", "- Find the weather using the [National Weather Service Web API](https://www.weather.gov/documentation/services-web-api)\n", "\n", - "** NOTE: ** We are using a custom Cloud Run endpoint to host our code here. You will need to define your OpenAPI spec with _your_ endpoint and _your_ endpoint specs based on how it is deployed. You WILL NOT have access to our endpoints!
\n", - "\n", "For more information, see [Vertex Agents Tools](https://cloud.google.com/dialogflow/vertex/docs/concept/tools)" ] }, @@ -404,17 +401,9 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "zsh:1: command not found: wget\n" - ] - } - ], + "outputs": [], "source": [ "!wget https://raw.githubusercontent.com/GoogleCloudPlatform/dfcx-scrapi/main/data/get_weather_tool.py\n", "!mv get_weather_tool.py main.py\n", @@ -479,8 +468,8 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Call Create Tools\n", - "For creating the `OpenAPI Spec` tools, we'll use the `build_open_api_tool` helper method to create the proper Tool object, then pass it to the `create_tool` method and capture the result for each tool." + "### Call Create Tool\n", + "For creating the `OpenAPI Spec` tool, we'll use the `build_open_api_tool` helper method to create the proper Tool object, then pass it to the `create_tool` method and capture the result." ] }, {