Llama guard
LlamaGuardDetector
Bases: ConnectionNode
Source code in dynamiq/nodes/detectors/llama_guard.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | |
__init__(**kwargs)
Initialize the LLama Guard Detector.
If neither client nor connection is provided in kwargs, a new Replicate connection is created.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**kwargs |
Keyword arguments to initialize the node. |
{}
|
Source code in dynamiq/nodes/detectors/llama_guard.py
36 37 38 39 40 41 42 43 44 45 46 | |
execute(input_data, config=None, **kwargs)
This node is a special guardrail powered by LLama. It can work both as a safety evaluator and as policy enforcement, following customizable guidelines.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_data |
LLamaGuardInputSchema
|
input data for the tool, which includes the message to check. |
required |
config |
RunnableConfig
|
Configuration for the runnable, including callbacks. |
None
|
**kwargs |
Additional arguments passed to the execution context. |
{}
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict[str, Any]: A dictionary containing check results. |
Source code in dynamiq/nodes/detectors/llama_guard.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | |