Skip to content

The agent engineering platform.

Update reduce_openapi_spec for PATCH and DELETE (#2861)

Adam McCabe6be5d7c6129e
diff --git a/langchain/agents/agent_toolkits/openapi/spec.py b/langchain/agents/agent_toolkits/openapi/spec.py
index 72f3ff9d61..b819623982 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.