AI Guard는 사이트에서 사용할 수 없습니다.
수동 통합의 경우 AI Guard 보호 기능을 활성화하려면 추가 구성이 필요합니다. 각 프레임워크별 지침에 따라 AI Guard 평가를 설정하세요.
지원되는 프레임워크 및 라이브러리
수동 통합은 Amazon Strands 및 LiteLLM Proxy에서 지원됩니다. 기타 프레임워크나 사용자 지정 LLM 또는 도구 호출 코드의 경우
SDK를 사용하여
evaluate() 코드에서 호출하세요.
Python
Set up the Datadog Agent
SDKs use the Datadog Agent to send AI Guard data to Datadog. The Agent must be running and accessible to your application.
If you don't use the Datadog Agent, the AI Guard evaluator API still works, but you can't see AI Guard traces in Datadog.
Required environment variables
Set the following environment variables in your application:
| Variable | Value |
|---|
DD_AI_GUARD_ENABLED | true |
DD_API_KEY | <YOUR_API_KEY> |
DD_APP_KEY | <YOUR_APPLICATION_KEY> |
DD_ENV | <YOUR_ENVIRONMENT> |
DD_SERVICE | <YOUR_SERVICE> |
Integrations
Amazon Strands
Python
Amazon Strands 통합을 통해 Amazon Strands Agents SDK로 빌드된 애플리케이션에서 AI Guard 평가를 수행할 수 있습니다.
설정
dd-trace-py v4.7.0 이상을 설치합니다.
pip install ddtrace>=4.7.0
다음으로, 플러그인/후크 공급자를 사용하여 통합 진입점을 정의합니다.
from ddtrace.appsec.ai_guard import AIGuardStrandsPlugin
agent = Agent(
model=model,
plugins=[AIGuardStrandsPlugin()]
)
from ddtrace.appsec.ai_guard import AIGuardStrandsHookProvider
agent = Agent(
model=model,
hooks=[AIGuardStrandsHookProvider()]
)
LiteLLM Proxy
Python
LiteLLM Proxy 통합을 통해 LiteLLM Proxy를 사용하는 애플리케이션에서 AI Guard 평가를 수행할 수 있습니다.
설정
dd-trace-py v4.8.0 이상을 설치합니다.
pip install ddtrace>=4.8.0
Datadog의 LiteLLM 가드레일을 구성 파일 옆으로 가져옵니다(예: guardrails.py).
from ddtrace.appsec.ai_guard.integrations.litellm import DatadogAIGuardGuardrail
__all__ = ["DatadogAIGuardGuardrail"]
가져온 가드레일을 구성 파일에 추가합니다.
guardrails:
- guardrail_name: datadog_ai_guard
litellm_params:
guardrail: guardrails.DatadogAIGuardGuardrail
mode: [pre_call, post_call]
on_input: true
on_output: true
block: true
이 가드레일은 세 가지 모드(pre_call, post_call, during_call)를 모두 지원합니다.
기본적으로 가드레일은 AI Guard 서비스 설정에서 지정한 차단 구성을 따릅니다. 차단을 비활성화하려면 block 파라미터를 false로 설정합니다(SDK 및 REST API의 block 옵션과 동일).
추가 자료