mirror of
https://github.com/hwchase17/langchain
synced 2024-11-10 01:10:59 +00:00
32c5be8b73
## Summary This PR implements the "Connery Action Tool" and "Connery Toolkit". Using them, you can integrate Connery actions into your LangChain agents and chains. Connery is an open-source plugin infrastructure for AI. With Connery, you can easily create a custom plugin with a set of actions and seamlessly integrate them into your LangChain agents and chains. Connery will handle the rest: runtime, authorization, secret management, access management, audit logs, and other vital features. Additionally, Connery and our community offer a wide range of ready-to-use open-source plugins for your convenience. Learn more about Connery: - GitHub: https://github.com/connery-io/connery-platform - Documentation: https://docs.connery.io - Twitter: https://twitter.com/connery_io ## TODOs - [x] API wrapper - [x] Integration tests - [x] Connery Action Tool - [x] Docs - [x] Example - [x] Integration tests - [x] Connery Toolkit - [x] Docs - [x] Example - [x] Formatting (`make format`) - [x] Linting (`make lint`) - [x] Testing (`make test`)
42 lines
1.4 KiB
Python
42 lines
1.4 KiB
Python
"""Integration test for Connery API Wrapper."""
|
|
from langchain_community.tools.connery import ConneryService
|
|
|
|
|
|
def test_list_actions() -> None:
|
|
"""Test for listing Connery Actions."""
|
|
connery = ConneryService()
|
|
output = connery._list_actions()
|
|
assert output is not None
|
|
assert len(output) > 0
|
|
|
|
|
|
def test_get_action() -> None:
|
|
"""Test for getting Connery Action."""
|
|
connery = ConneryService()
|
|
# This is the ID of the preinstalled action "Refresh plugin cache"
|
|
output = connery._get_action("CAF979E6D2FF4C8B946EEBAFCB3BA475")
|
|
assert output is not None
|
|
assert output.id == "CAF979E6D2FF4C8B946EEBAFCB3BA475"
|
|
|
|
|
|
def test_run_action_with_no_iput() -> None:
|
|
"""Test for running Connery Action without input."""
|
|
connery = ConneryService()
|
|
# refreshPluginCache action from connery-io/connery-runner-administration plugin
|
|
output = connery._run_action("CAF979E6D2FF4C8B946EEBAFCB3BA475")
|
|
assert output is not None
|
|
assert output == {}
|
|
|
|
|
|
def test_run_action_with_iput() -> None:
|
|
"""Test for running Connery Action with input."""
|
|
connery = ConneryService()
|
|
# summarizePublicWebpage action from connery-io/summarization-plugin plugin
|
|
output = connery._run_action(
|
|
"CA72DFB0AB4DF6C830B43E14B0782F70",
|
|
{"publicWebpageUrl": "http://www.paulgraham.com/vb.html"},
|
|
)
|
|
assert output is not None
|
|
assert output["summary"] is not None
|
|
assert len(output["summary"]) > 0
|