From 67718c1d6b980b3afef83604fcef59e76e468fc8 Mon Sep 17 00:00:00 2001 From: GitHub-L <40889019+xzy103@users.noreply.github.com> Date: Tue, 8 Aug 2023 22:33:21 +0800 Subject: [PATCH] Update OpenAPI code to fetch use the requestBody - Description: The API doc passed to LLM only included the content of responses but did not include the content of requestBody, causing the agent to be unable to construct the correct request parameters based on the requestBody information. Add two lines of code fixed the bug, - Issue: the issue # it fixes (if applicable), - Dependencies: any dependencies required for this change, - Tag maintainer: @hinthornw , - Twitter handle: we announce bigger features on Twitter. If your PR gets announced and you'd like a mention, we'll gladly shout you out! --- libs/langchain/langchain/agents/agent_toolkits/openapi/spec.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libs/langchain/langchain/agents/agent_toolkits/openapi/spec.py b/libs/langchain/langchain/agents/agent_toolkits/openapi/spec.py index b819623982..1c717db7b9 100644 --- a/libs/langchain/langchain/agents/agent_toolkits/openapi/spec.py +++ b/libs/langchain/langchain/agents/agent_toolkits/openapi/spec.py @@ -97,6 +97,8 @@ def reduce_openapi_spec(spec: dict, dereference: bool = True) -> ReducedOpenAPIS ] if "200" in docs["responses"]: out["responses"] = docs["responses"]["200"] + if docs.get("requestBody"): + out["requestBody"] = docs.get("requestBody") return out endpoints = [