Skip to content

The agent engineering platform.

community: fix tool appending logic and update planner prompt in OpenAPI agent toolkit (#24384)

Eun Hye Kim07c5c60f63a3
diff --git a/libs/community/langchain_community/agent_toolkits/openapi/planner.py b/libs/community/langchain_community/agent_toolkits/openapi/planner.py
index 9f801b0ca2..d793182e36 100644
--- a/libs/community/langchain_community/agent_toolkits/openapi/planner.py
+++ b/libs/community/langchain_community/agent_toolkits/openapi/planner.py
@@ -292,17 +292,21 @@ def _create_api_controller_agent(
)
if "DELETE" in allowed_operations:
delete_llm_chain = LLMChain(llm=llm, prompt=PARSING_DELETE_PROMPT)
- RequestsDeleteToolWithParsing( # type: ignore[call-arg]
- requests_wrapper=requests_wrapper,
- llm_chain=delete_llm_chain,
- allow_dangerous_requests=allow_dangerous_requests,
+ tools.append(
+ RequestsDeleteToolWithParsing( # type: ignore[call-arg]
+ requests_wrapper=requests_wrapper,
+ llm_chain=delete_llm_chain,
+ allow_dangerous_requests=allow_dangerous_requests,
+ )
)
if "PATCH" in allowed_operations:
patch_llm_chain = LLMChain(llm=llm, prompt=PARSING_PATCH_PROMPT)
- RequestsPatchToolWithParsing( # type: ignore[call-arg]
- requests_wrapper=requests_wrapper,
- llm_chain=patch_llm_chain,
- allow_dangerous_requests=allow_dangerous_requests,
+ tools.append(
+ RequestsPatchToolWithParsing( # type: ignore[call-arg]
+ requests_wrapper=requests_wrapper,
+ llm_chain=patch_llm_chain,
+ allow_dangerous_requests=allow_dangerous_requests,
+ )
)
if not tools:
raise ValueError("Tools not found")