From 6be5d7c6129e1ba126798850720084c18b594e10 Mon Sep 17 00:00:00 2001 From: Adam McCabe Date: Thu, 13 Apr 2023 23:27:40 -0400 Subject: [PATCH] Update reduce_openapi_spec for PATCH and DELETE (#2861) My recent pull request (#2729) neglected to update the `reduce_openapi_spec` in spec.py to also accommodate PATCH and DELETE added to planner.py and prompt_planner.py. --- langchain/agents/agent_toolkits/openapi/spec.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/langchain/agents/agent_toolkits/openapi/spec.py b/langchain/agents/agent_toolkits/openapi/spec.py index 72f3ff9d..b8196239 100644 --- a/langchain/agents/agent_toolkits/openapi/spec.py +++ b/langchain/agents/agent_toolkits/openapi/spec.py @@ -68,12 +68,12 @@ def reduce_openapi_spec(spec: dict, dereference: bool = True) -> ReducedOpenAPIS I was hoping https://openapi.tools/ would have some useful bits to this end, but doesn't seem so. """ - # 1. Consider only get, post endpoints. + # 1. Consider only get, post, patch, delete endpoints. endpoints = [ (f"{operation_name.upper()} {route}", docs.get("description"), docs) for route, operation in spec["paths"].items() for operation_name, docs in operation.items() - if operation_name in ["get", "post"] + if operation_name in ["get", "post", "patch", "delete"] ] # 2. Replace any refs so that complete docs are retrieved.