From e7ba9328acc80a4efe88331daefe7e8351f7a3ee Mon Sep 17 00:00:00 2001 From: Volodymyr Machula Date: Thu, 1 Feb 2024 17:24:55 +0000 Subject: [PATCH 1/4] Add Connery Actions to the list of available tools --- .env.example | 2 ++ .env.gcp.yaml.example | 2 ++ README.md | 11 +++++++++++ backend/app/tools.py | 15 +++++++++++++++ frontend/src/components/Config.tsx | 2 ++ 5 files changed, 32 insertions(+) diff --git a/.env.example b/.env.example index dba4767e..0a360598 100644 --- a/.env.example +++ b/.env.example @@ -8,3 +8,5 @@ AZURE_OPENAI_API_BASE=placeholder AZURE_OPENAI_API_VERSION=placeholder ROBOCORP_ACTION_SERVER_URL=https://dummy-action-server.robocorp.link ROBOCORP_ACTION_SERVER_KEY=dummy-api-key +CONNERY_RUNNER_URL=https://your-personal-connery-runner-url +CONNERY_RUNNER_API_KEY=placeholder \ No newline at end of file diff --git a/.env.gcp.yaml.example b/.env.gcp.yaml.example index c8d8a8c6..4646afb9 100644 --- a/.env.gcp.yaml.example +++ b/.env.gcp.yaml.example @@ -15,3 +15,5 @@ AZURE_OPENAI_API_KEY: your_secret_here KAY_API_KEY: your_secret_here ROBOCORP_ACTION_SERVER_URL: https://dummy-action-server.robocorp.link ROBOCORP_ACTION_SERVER_KEY: dummy-api-key +CONNERY_RUNNER_URL: https://your-personal-connery-runner-url +CONNERY_RUNNER_API_KEY: your_secret_here diff --git a/README.md b/README.md index 88db65c6..647c7f10 100644 --- a/README.md +++ b/README.md @@ -292,6 +292,17 @@ ROBOCORP_ACTION_SERVER_URL=https://dummy-action-server.robocorp.link ROBOCORP_ACTION_SERVER_KEY=dummy-api-key ``` +**_Connery Actions_** + +Connect OpenGPTs to the real world with [Connery Actions](https://github.com/connery-io/connery). + +Requires setting an environment variable, which you get during the [Connery Runner setup](https://docs.connery.io/docs/runner/quick-start/): + +```shell +CONNERY_RUNNER_URL=https://your-personal-connery-runner-url +CONNERY_RUNNER_API_KEY=... +``` + **DuckDuckGo Search** Search the web with [DuckDuckGo](https://pypi.org/project/duckduckgo-search/). Does not require any API keys. diff --git a/backend/app/tools.py b/backend/app/tools.py index 5610c10a..c3773e14 100644 --- a/backend/app/tools.py +++ b/backend/app/tools.py @@ -11,6 +11,8 @@ ) from langchain_community.retrievers.you import YouRetriever from langchain_community.tools import ArxivQueryRun, DuckDuckGoSearchRun +from langchain_community.agent_toolkits.connery import ConneryToolkit +from langchain_community.tools.connery import ConneryService from langchain_community.tools.tavily_search import TavilyAnswer, TavilySearchResults from langchain_community.utilities.arxiv import ArxivAPIWrapper from langchain_community.utilities.tavily_search import TavilySearchAPIWrapper @@ -128,9 +130,21 @@ def _get_action_server(): tools = toolkit.get_tools() return tools +@lru_cache(maxsize=1) +def _get_connery_actions(): + connery_service = ConneryService( + runner_url=os.environ.get("CONNERY_RUNNER_URL"), + api_key=os.environ.get("CONNERY_RUNNER_API_KEY"), + ) + connery_toolkit = ConneryToolkit.create_instance(connery_service) + tools = connery_toolkit.get_tools() + return tools + + class AvailableTools(str, Enum): ACTION_SERVER = "Action Server by Robocorp" + CONNERY = "Actions by Connery" DDG_SEARCH = "DDG Search" TAVILY = "Search (Tavily)" TAVILY_ANSWER = "Search (short answer, Tavily)" @@ -145,6 +159,7 @@ class AvailableTools(str, Enum): TOOLS = { AvailableTools.ACTION_SERVER: _get_action_server, + AvailableTools.CONNERY: _get_connery_actions, AvailableTools.DDG_SEARCH: _get_duck_duck_go, AvailableTools.ARXIV: _get_arxiv, AvailableTools.YOU_SEARCH: _get_you_search, diff --git a/frontend/src/components/Config.tsx b/frontend/src/components/Config.tsx index 36f40095..615e47d0 100644 --- a/frontend/src/components/Config.tsx +++ b/frontend/src/components/Config.tsx @@ -142,6 +142,8 @@ const TOOL_DESCRIPTIONS = { Retrieval: "Look up information in uploaded files.", "Action Server by Robocorp": "Run AI actions with [Robocorp Action Server](https://github.com/robocorp/robocorp).", + "Actions by Connery": + "Connect OpenGPTs to the real world with [Connery Actions](https://github.com/connery-io/connery).", "DDG Search": "Search the web with [DuckDuckGo](https://pypi.org/project/duckduckgo-search/).", "Search (Tavily)": From f9dda52aa09dce8368ad630988a18b642a376aed Mon Sep 17 00:00:00 2001 From: Volodymyr Machula Date: Thu, 1 Feb 2024 17:35:22 +0000 Subject: [PATCH 2/4] Fix --- .env.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.example b/.env.example index 0a360598..3b435aed 100644 --- a/.env.example +++ b/.env.example @@ -9,4 +9,4 @@ AZURE_OPENAI_API_VERSION=placeholder ROBOCORP_ACTION_SERVER_URL=https://dummy-action-server.robocorp.link ROBOCORP_ACTION_SERVER_KEY=dummy-api-key CONNERY_RUNNER_URL=https://your-personal-connery-runner-url -CONNERY_RUNNER_API_KEY=placeholder \ No newline at end of file +CONNERY_RUNNER_API_KEY=placeholder From 23ed2610c44ebeddd46a0634a87d676a5f3e58eb Mon Sep 17 00:00:00 2001 From: Volodymyr Machula Date: Sun, 4 Feb 2024 22:35:51 +0000 Subject: [PATCH 3/4] Update Connery tool name --- backend/app/tools.py | 2 +- frontend/src/components/Config.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/app/tools.py b/backend/app/tools.py index c3773e14..5a144725 100644 --- a/backend/app/tools.py +++ b/backend/app/tools.py @@ -144,7 +144,7 @@ def _get_connery_actions(): class AvailableTools(str, Enum): ACTION_SERVER = "Action Server by Robocorp" - CONNERY = "Actions by Connery" + CONNERY = "AI Action Runner by Connery" DDG_SEARCH = "DDG Search" TAVILY = "Search (Tavily)" TAVILY_ANSWER = "Search (short answer, Tavily)" diff --git a/frontend/src/components/Config.tsx b/frontend/src/components/Config.tsx index 615e47d0..95e98bfc 100644 --- a/frontend/src/components/Config.tsx +++ b/frontend/src/components/Config.tsx @@ -142,7 +142,7 @@ const TOOL_DESCRIPTIONS = { Retrieval: "Look up information in uploaded files.", "Action Server by Robocorp": "Run AI actions with [Robocorp Action Server](https://github.com/robocorp/robocorp).", - "Actions by Connery": + "AI Action Runner by Connery": "Connect OpenGPTs to the real world with [Connery Actions](https://github.com/connery-io/connery).", "DDG Search": "Search the web with [DuckDuckGo](https://pypi.org/project/duckduckgo-search/).", From b5208616f5dc4f618fc157e8d61e9e4f9889fc2e Mon Sep 17 00:00:00 2001 From: Volodymyr Machula Date: Mon, 5 Feb 2024 00:34:17 +0000 Subject: [PATCH 4/4] Update the tool name and description --- README.md | 2 +- backend/app/tools.py | 2 +- frontend/src/components/Config.tsx | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b2aebe3e..eda4784b 100644 --- a/README.md +++ b/README.md @@ -294,7 +294,7 @@ ROBOCORP_ACTION_SERVER_KEY=dummy-api-key **_Connery Actions_** -Connect OpenGPTs to the real world with [Connery Actions](https://github.com/connery-io/connery). +Connect OpenGPTs to the real world with [Connery](https://github.com/connery-io/connery). Requires setting an environment variable, which you get during the [Connery Runner setup](https://docs.connery.io/docs/runner/quick-start/): diff --git a/backend/app/tools.py b/backend/app/tools.py index 5a144725..3269ad88 100644 --- a/backend/app/tools.py +++ b/backend/app/tools.py @@ -144,7 +144,7 @@ def _get_connery_actions(): class AvailableTools(str, Enum): ACTION_SERVER = "Action Server by Robocorp" - CONNERY = "AI Action Runner by Connery" + CONNERY = "\"AI Action Runner\" by Connery" DDG_SEARCH = "DDG Search" TAVILY = "Search (Tavily)" TAVILY_ANSWER = "Search (short answer, Tavily)" diff --git a/frontend/src/components/Config.tsx b/frontend/src/components/Config.tsx index 95e98bfc..97fd6c87 100644 --- a/frontend/src/components/Config.tsx +++ b/frontend/src/components/Config.tsx @@ -142,8 +142,8 @@ const TOOL_DESCRIPTIONS = { Retrieval: "Look up information in uploaded files.", "Action Server by Robocorp": "Run AI actions with [Robocorp Action Server](https://github.com/robocorp/robocorp).", - "AI Action Runner by Connery": - "Connect OpenGPTs to the real world with [Connery Actions](https://github.com/connery-io/connery).", + "\"AI Action Runner\" by Connery": + "Connect OpenGPTs to the real world with [Connery](https://github.com/connery-io/connery).", "DDG Search": "Search the web with [DuckDuckGo](https://pypi.org/project/duckduckgo-search/).", "Search (Tavily)":