Closed Lihengwannafly closed 1 year ago
当使用map tool的时候,会产生KeyError: 'type'的报错,这是由于bmtools/tools/map/api.py里每个方法的参数没有指定类型,例如:
@tool.get("/get_coordinates") def get_coordinates(location): """Get the coordinates of a location""" url = BASE_URL + "Locations" params = { "query": location, "key": KEY } response = requests.get(url, params=params) json_data = response.json() coordinates = json_data["resourceSets"][0]["resources"][0]["point"]["coordinates"] return coordinates,
需要给location添加str的类型,修改后的代码是:
@tool.get("/get_coordinates") def get_coordinates(location: str): """Get the coordinates of a location""" url = BASE_URL + "Locations" params = { "query": location, "key": KEY } response = requests.get(url, params=params) json_data = response.json() coordinates = json_data["resourceSets"][0]["resources"][0]["point"]["coordinates"] return coordinates
感谢指出!麻烦 @Kunlun-Zhu 改一下吧,map和stock里都需要改一下
当使用map tool的时候,会产生KeyError: 'type'的报错,这是由于bmtools/tools/map/api.py里每个方法的参数没有指定类型,例如:
需要给location添加str的类型,修改后的代码是: