In order to install
pip install nucliaYou can login with your Nuclia user How to sign-up via
nuclia auth loginYou can login to a specific knowledgebox if you have a Service Token (How to get a Service Token) or your NucliaDB is deployed on-premise
nuclia auth kb --url KB_URL --token SERVICE_TOKENKB_URL its the url of the Knowledge Box. On the cloud service you can retrieve it on the dashboard. On the on-premise/community deployment its the url mapped to it.
You can login with a Nuclia Understanding API key to process files, predict and train using our system
nuclia auth nua --key ZZZZAccount guardrail policies can be managed with the synchronous or asynchronous SDK:
from nuclia_models.accounts.guardrails import CreateGuardrailPolicy
from nuclia.sdk import NucliaGuardrails
guardrails = NucliaGuardrails()
policy = guardrails.create(
CreateGuardrailPolicy(
name="Safety policy",
instruction="Flag requests that ask for dangerous instructions.",
query="Does the request violate the safety policy?",
enabled=True,
blocking=True,
),
zone="europe-1",
)Enabled account policies are evaluated automatically for Predict chat requests. Content can also be evaluated directly against a configured or inline policy:
from nuclia_models.predict.guardrails import GuardrailRequest
from nuclia.sdk import NucliaPredict
result = NucliaPredict().guardrail(
GuardrailRequest(
content="Content to evaluate",
policy_id=str(policy.id),
)
)Policy violations always block chat generation. The blocking setting controls
failure handling: evaluation failures fail closed when enabled and fail open
when disabled.
You can find the documentation here
Find more information on the internal CI setup here