mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-13 02:16:23 +00:00
Community: Update and fix ZenGuardTool docs and add ZenguardTool to init files (#23415)
Thank you for contributing to LangChain! - [x] **PR title**: "community: update docs and add tool to init.py" - [x] **PR message**: - **Description:** Fixed some errors and comments in the docs and added our ZenGuardTool and additional classes to init.py for easy access when importing - **Question:** when will you update the langchain-community package in pypi to make our tool available? - [x] **Lint and test**: Run `make format`, `make lint` and `make test` from the root of the package(s) you've modified. See contribution guidelines for more: https://python.langchain.com/docs/contributing/ Thank you for review! --------- Co-authored-by: Baur <baur.krykpayev@gmail.com>
This commit is contained in:
parent
8955bc1866
commit
c93d9e66e4
@ -4,11 +4,11 @@
|
|||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"# ZenGuard AI Langchain Tool\n",
|
"# ZenGuard AI\n",
|
||||||
"\n",
|
"\n",
|
||||||
"<a href=\"https://colab.research.google.com/github/langchain-ai/langchail/blob/main/docs/docs/integrations/tools/zenguard.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\" /></a>\n",
|
"<a href=\"https://colab.research.google.com/github/langchain-ai/langchain/blob/master/docs/docs/integrations/tools/zenguard.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\" /></a>\n",
|
||||||
"\n",
|
"\n",
|
||||||
"This Langchain Tool lets you quickly set up [ZenGuard AI](https://www.zenguard.ai/) in your Langchain-powered application. The ZenGuard AI provides ultrafast guardrails to protect your GenAI application from:\n",
|
"This tool lets you quickly set up [ZenGuard AI](https://www.zenguard.ai/) in your Langchain-powered application. The ZenGuard AI provides ultrafast guardrails to protect your GenAI application from:\n",
|
||||||
"\n",
|
"\n",
|
||||||
"- Prompts Attacks\n",
|
"- Prompts Attacks\n",
|
||||||
"- Veering of the pre-defined topics\n",
|
"- Veering of the pre-defined topics\n",
|
||||||
@ -86,7 +86,7 @@
|
|||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"%set_env ZENGUARD_API_KEY="
|
"%set_env ZENGUARD_API_KEY=your_api_key"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -131,6 +131,7 @@
|
|||||||
"* `is_detected(boolean)`: Indicates whether a prompt injection attack was detected in the provided message. In this example, it is False.\n",
|
"* `is_detected(boolean)`: Indicates whether a prompt injection attack was detected in the provided message. In this example, it is False.\n",
|
||||||
" * `score(float: 0.0 - 1.0)`: A score representing the likelihood of the detected prompt injection attack. In this example, it is 0.0.\n",
|
" * `score(float: 0.0 - 1.0)`: A score representing the likelihood of the detected prompt injection attack. In this example, it is 0.0.\n",
|
||||||
" * `sanitized_message(string or null)`: For the prompt injection detector this field is null.\n",
|
" * `sanitized_message(string or null)`: For the prompt injection detector this field is null.\n",
|
||||||
|
" * `latency(float or null)`: Time in milliseconds during which the detection was performed\n",
|
||||||
"\n",
|
"\n",
|
||||||
" **Error Codes:**\n",
|
" **Error Codes:**\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
@ -318,6 +318,11 @@ if TYPE_CHECKING:
|
|||||||
ZapierNLAListActions,
|
ZapierNLAListActions,
|
||||||
ZapierNLARunAction,
|
ZapierNLARunAction,
|
||||||
)
|
)
|
||||||
|
from langchain_community.tools.zenguard.tool import (
|
||||||
|
Detector,
|
||||||
|
ZenGuardInput,
|
||||||
|
ZenGuardTool,
|
||||||
|
)
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"AINAppOps",
|
"AINAppOps",
|
||||||
@ -456,6 +461,9 @@ __all__ = [
|
|||||||
"YouTubeSearchTool",
|
"YouTubeSearchTool",
|
||||||
"ZapierNLAListActions",
|
"ZapierNLAListActions",
|
||||||
"ZapierNLARunAction",
|
"ZapierNLARunAction",
|
||||||
|
"Detector",
|
||||||
|
"ZenGuardInput",
|
||||||
|
"ZenGuardTool",
|
||||||
"authenticate",
|
"authenticate",
|
||||||
"format_tool_to_openai_function",
|
"format_tool_to_openai_function",
|
||||||
"tool",
|
"tool",
|
||||||
@ -503,6 +511,7 @@ _module_lookup = {
|
|||||||
"CurrentWebPageTool": "langchain_community.tools.playwright",
|
"CurrentWebPageTool": "langchain_community.tools.playwright",
|
||||||
"DataheraldTextToSQL": "langchain_community.tools.dataherald.tool",
|
"DataheraldTextToSQL": "langchain_community.tools.dataherald.tool",
|
||||||
"DeleteFileTool": "langchain_community.tools.file_management",
|
"DeleteFileTool": "langchain_community.tools.file_management",
|
||||||
|
"Detector": "langchain_community.tools.zenguard.tool",
|
||||||
"DuckDuckGoSearchResults": "langchain_community.tools.ddg_search.tool",
|
"DuckDuckGoSearchResults": "langchain_community.tools.ddg_search.tool",
|
||||||
"DuckDuckGoSearchRun": "langchain_community.tools.ddg_search.tool",
|
"DuckDuckGoSearchRun": "langchain_community.tools.ddg_search.tool",
|
||||||
"E2BDataAnalysisTool": "langchain_community.tools.e2b_data_analysis.tool",
|
"E2BDataAnalysisTool": "langchain_community.tools.e2b_data_analysis.tool",
|
||||||
@ -601,6 +610,8 @@ _module_lookup = {
|
|||||||
"YouTubeSearchTool": "langchain_community.tools.youtube.search",
|
"YouTubeSearchTool": "langchain_community.tools.youtube.search",
|
||||||
"ZapierNLAListActions": "langchain_community.tools.zapier.tool",
|
"ZapierNLAListActions": "langchain_community.tools.zapier.tool",
|
||||||
"ZapierNLARunAction": "langchain_community.tools.zapier.tool",
|
"ZapierNLARunAction": "langchain_community.tools.zapier.tool",
|
||||||
|
"ZenGuardInput": "langchain_community.tools.zenguard.tool",
|
||||||
|
"ZenGuardTool": "langchain_community.tools.zenguard.tool",
|
||||||
"authenticate": "langchain_community.tools.office365.utils",
|
"authenticate": "langchain_community.tools.office365.utils",
|
||||||
"format_tool_to_openai_function": "langchain_community.tools.convert_to_openai",
|
"format_tool_to_openai_function": "langchain_community.tools.convert_to_openai",
|
||||||
"tool": "langchain_core.tools",
|
"tool": "langchain_core.tools",
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from langchain_community.tools.zenguard.tools import (
|
from langchain_community.tools.zenguard.tool import (
|
||||||
Detector,
|
Detector,
|
||||||
ZenGuardInput,
|
ZenGuardInput,
|
||||||
ZenGuardTool,
|
ZenGuardTool,
|
||||||
|
@ -3,7 +3,7 @@ from typing import Any, Dict, List
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from langchain_community.tools.zenguard.tools import Detector, ZenGuardTool
|
from langchain_community.tools.zenguard.tool import Detector, ZenGuardTool
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture()
|
@pytest.fixture()
|
||||||
|
@ -135,6 +135,9 @@ EXPECTED_ALL = [
|
|||||||
"YouTubeSearchTool",
|
"YouTubeSearchTool",
|
||||||
"ZapierNLAListActions",
|
"ZapierNLAListActions",
|
||||||
"ZapierNLARunAction",
|
"ZapierNLARunAction",
|
||||||
|
"Detector",
|
||||||
|
"ZenGuardInput",
|
||||||
|
"ZenGuardTool",
|
||||||
"authenticate",
|
"authenticate",
|
||||||
"format_tool_to_openai_function",
|
"format_tool_to_openai_function",
|
||||||
"tool",
|
"tool",
|
||||||
|
@ -138,6 +138,9 @@ _EXPECTED = [
|
|||||||
"YouTubeSearchTool",
|
"YouTubeSearchTool",
|
||||||
"ZapierNLAListActions",
|
"ZapierNLAListActions",
|
||||||
"ZapierNLARunAction",
|
"ZapierNLARunAction",
|
||||||
|
"Detector",
|
||||||
|
"ZenGuardInput",
|
||||||
|
"ZenGuardTool",
|
||||||
"authenticate",
|
"authenticate",
|
||||||
"format_tool_to_openai_function",
|
"format_tool_to_openai_function",
|
||||||
"tool",
|
"tool",
|
||||||
|
Loading…
Reference in New Issue
Block a user