mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-24 03:52:10 +00:00
docs: docstrings langchain_community
update (#14889)
Addded missed docstrings. Fixed inconsistency in docstrings. **Note** CC @efriis There were PR errors on `langchain_experimental/prompt_injection_identifier/hugging_face_identifier.py` But, I didn't touch this file in this PR! Can it be some cache problems? I fixed this error.
This commit is contained in:
@@ -11,7 +11,9 @@ if TYPE_CHECKING:
|
||||
|
||||
|
||||
class PromptInjectionException(ValueError):
|
||||
def __init__(self, message="Prompt injection attack detected", score: float = 1.0):
|
||||
def __init__(
|
||||
self, message: str = "Prompt injection attack detected", score: float = 1.0
|
||||
):
|
||||
self.message = message
|
||||
self.score = score
|
||||
|
||||
@@ -83,7 +85,7 @@ class HuggingFaceInjectionIdentifier(BaseTool):
|
||||
|
||||
def _run(self, query: str) -> str:
|
||||
"""Use the tool."""
|
||||
result = self.model(query)
|
||||
result = self.model(query) # type: ignore
|
||||
score = (
|
||||
result[0]["score"]
|
||||
if result[0]["label"] == self.injection_label
|
||||
|
Reference in New Issue
Block a user