다음을 통해 공유


Python용 Azure AI 콘텐츠 보안 클라이언트 라이브러리 - 버전 1.0.0

Azure AI 콘텐츠 보안 애플리케이션 및 서비스에서 유해한 사용자 생성 및 AI 생성 콘텐츠를 검색합니다. 콘텐츠 안전에는 유해한 자료를 검색할 수 있는 텍스트 및 이미지 API가 포함되어 있습니다.

  • 텍스트 분석 API: 다중 심각도 수준으로 성적 콘텐츠, 폭력, 증오 및 자해에 대한 텍스트를 검사합니다.
  • 이미지 분석 API: 다중 심각도 수준으로 성적 콘텐츠, 폭력, 증오 및 자해에 대한 이미지를 검사합니다.
  • 텍스트 차단 목록 관리 API: 기본 AI 분류자는 대부분의 콘텐츠 안전 요구 사항에 충분합니다. 그러나 사용 사례와 관련된 용어를 검색해야 할 수 있습니다. Text API와 함께 사용할 용어의 차단 목록을 만들 수 있습니다.

설명서

시작하는 데 도움이 되는 다양한 설명서를 사용할 수 있습니다.

시작

필수 구성 요소

패키지 설치

pip install azure-ai-contentsafety

클라이언트 인증

엔드포인트 가져오기

Azure Portal 또는 Azure CLI를 사용하여 Azure AI 콘텐츠 보안 서비스 리소스에 대한 엔드포인트를 찾을 수 있습니다.

# Get the endpoint for the Azure AI Content Safety service resource
az cognitiveservices account show --name "resource-name" --resource-group "resource-group-name" --query "properties.endpoint"

API 키를 사용하여 ContentSafetyClient/BlocklistClient 만들기

API 키를 매개 변수로 credential 사용하려면

  • 1단계: API 키를 가져옵니다. API 키는 Azure Portal 에서 또는 다음 Azure CLI 명령을 실행하여 찾을 수 있습니다.

    az cognitiveservices account keys list --name "<resource-name>" --resource-group "<resource-group-name>"
    
  • 2단계: 키를 문자열로 의 instance AzureKeyCredential전달합니다.

    from azure.core.credentials import AzureKeyCredential
    from azure.ai.contentsafety import ContentSafetyClient, BlocklistClient
    
    endpoint = "https://<my-custom-subdomain>.cognitiveservices.azure.com/"
    credential = AzureKeyCredential("<api_key>")
    content_safety_client = ContentSafetyClient(endpoint, credential)
    blocklist_client = BlocklistClient(endpoint, credential)
    

Microsoft Entra ID 토큰 자격 증명을 사용하여 ContentSafetyClient/BlocklistClient 만들기

  • 1단계: 리소스에 Microsoft Entra ID를 사용하도록 설정합니다. 리소스에 Microsoft Entra ID를 사용하도록 설정하는 단계는 Microsoft Entra ID로 인증 문서를 참조하세요.

    주요 단계는 다음과 같습니다.

    • 사용자 지정 하위 도메인을 사용하여 리소스를 만듭니다.
    • 서비스 주체를 만들고 Cognitive Services 사용자 역할을 할당합니다.
  • 2단계: Microsoft Entra 애플리케이션의 클라이언트 ID, 테넌트 ID 및 클라이언트 암호 값을 환경 변수AZURE_CLIENT_ID로 설정합니다. , , AZURE_TENANT_IDAZURE_CLIENT_SECRET.

    DefaultAzureCredential은 이러한 환경 변수의 값을 사용합니다.

    from azure.identity import DefaultAzureCredential
    from azure.ai.contentsafety import ContentSafetyClient, BlocklistClient
    
    endpoint = "https://<my-custom-subdomain>.cognitiveservices.azure.com/"
    credential = DefaultAzureCredential()
    content_safety_client = ContentSafetyClient(endpoint, credential)
    blocklist_client = BlocklistClient(endpoint, credential)
    

주요 개념

사용 가능한 기능

이 서비스에는 다양한 유형의 분석이 제공됩니다. 다음 표에서는 현재 사용 가능한 API에 대해 설명합니다.

기능 Description
텍스트 분석 API 다중 심각도 수준으로 성적 콘텐츠, 폭력, 증오 및 자해에 대한 텍스트를 검색합니다.
Image Analysis API 다중 심각도 수준으로 성적 콘텐츠, 폭력, 증오 및 자해에 대한 이미지를 검색합니다.
텍스트 차단 목록 관리 API 기본 AI 분류자는 대부분의 콘텐츠 안전 요구 사항에 충분합니다. 그러나 사용 사례와 관련된 용어를 검색해야 할 수 있습니다. Text API와 함께 사용할 용어의 차단 목록을 만들 수 있습니다.

유해 범주

콘텐츠 안전에서는 불쾌한 콘텐츠를 네 가지 범주로 구분합니다.

범주 설명
증오 증오 및 공정성 관련 피해는 인종, 민족, 국적, 성 정체성 및 표현, 성적 지향, 종교, 이민 상태, 능력 상태, 외모 및 신체 크기를 포함하지만 이에 국한되지 않는 이러한 그룹의 특정 차별화 특성에 따라 개인 또는 ID 그룹을 참조하여 조롱적이거나 차별적인 언어를 공격하거나 사용하는 모든 콘텐츠를 말합니다.
성적 성적 해부학 기관 및 성기와 관련된 언어를 설명, 낭만적 인 관계, 에로틱하거나 애정 용어로 묘사 된 행위, 임신, 신체적 성적 행위, 폭행 또는 자신의 의지에 대한 강제 성적 폭력 행위로 묘사 된 사람들을 포함, 매춘, 포르노, 학대.
폭력 폭력은 누군가 또는 무언가를 다치게 하거나, 다치거나, 손상시키거나, 죽이기 위한 물리적 행동과 관련된 언어를 설명합니다. 는 무기, 총기 및 제조업체, 협회, 법규 등과 같은 관련 엔터티를 설명합니다.
자신에게 피해 자해는 의도적으로 상처를 입히거나, 부상을 입히거나, 몸을 손상시키거나, 자신을 죽이기 위한 물리적 행동과 관련된 언어를 설명합니다.

분류에는 다중 레이블이 지정될 수 있습니다. 예를 들어 텍스트 샘플이 텍스트 조정 모델을 거치면 성적인 콘텐츠와 폭력으로 분류될 수 있습니다.

심각도 수준

서비스가 적용되는 모든 피해 범주에는 심각도 수준 등급도 함께 제공됩니다. 심각도 수준은 플래그가 지정된 콘텐츠 표시로 인한 결과의 심각도를 나타냅니다.

텍스트: 현재 버전의 텍스트 모델은 전체 0-7 심각도 배율을 지원합니다. 기본적으로 응답은 0, 2, 4 및 6의 4개 값을 출력합니다. 인접한 두 수준은 각각 단일 수준에 매핑됩니다. 사용자는 요청에 "outputType"을 사용하고 "EightSeverityLevels"로 설정하여 출력에서 8개 값(0,1,2,3,4,5,6,7)을 가져올 수 있습니다. 자세한 내용은 텍스트 콘텐츠 심각도 수준 정의를 참조할 수 있습니다.

  • [0,1] -> 0
  • [2,3] -> 2
  • [4,5] -> 4
  • [6,7] -> 6

이미지: 이미지 모델의 현재 버전은 전체 0-7 심각도 눈금의 트리밍된 버전을 지원합니다. 분류자는 심각도 0, 2, 4 및 6만 반환합니다. 인접한 두 수준은 각각 단일 수준에 매핑됩니다. 자세한 내용은 이미지 콘텐츠 심각도 수준 정의를 참조할 수 있습니다.

  • [0,1] -> 0
  • [2,3] -> 2
  • [4,5] -> 4
  • [6,7] -> 6

텍스트 차단 목록 관리

텍스트 차단 목록을 관리하기 위해 지원되는 작업은 다음과 같습니다.

  • 차단 목록 만들기 또는 수정
  • 모든 차단 목록 나열
  • blocklistName으로 차단 목록 가져오기
  • 차단 목록에 blocklistItems 추가
  • 차단 목록에서 blocklistItems 제거
  • blocklistName을 사용하여 차단 목록에 있는 모든 blocklistItems 나열
  • blocklistItemId 및 blocklistName을 사용하여 차단 목록에 blocklistItem 가져오기
  • 차단 목록 및 모든 blocklistItems 삭제

텍스트를 분석할 때 사용할 차단 목록을 설정한 다음 반환된 응답에서 차단 목록 일치 결과를 가져올 수 있습니다.

예제

다음 섹션에서는 다음을 포함하여 가장 일반적인 콘텐츠 안전 서비스 작업 중 일부를 다루는 몇 가지 코드 조각을 제공합니다.

여기에 사용된 데이터에 대한 샘플 데이터를 참조하세요. 자세한 샘플은 샘플을 참조하세요.

텍스트 분석

차단 목록 없이 텍스트 분석


    import os
    from azure.ai.contentsafety import ContentSafetyClient
    from azure.ai.contentsafety.models import TextCategory
    from azure.core.credentials import AzureKeyCredential
    from azure.core.exceptions import HttpResponseError
    from azure.ai.contentsafety.models import AnalyzeTextOptions

    key = os.environ["CONTENT_SAFETY_KEY"]
    endpoint = os.environ["CONTENT_SAFETY_ENDPOINT"]

    # Create a Content Safety client
    client = ContentSafetyClient(endpoint, AzureKeyCredential(key))

    # Construct a request
    request = AnalyzeTextOptions(text="You are an idiot")

    # Analyze text
    try:
        response = client.analyze_text(request)
    except HttpResponseError as e:
        print("Analyze text failed.")
        if e.error:
            print(f"Error code: {e.error.code}")
            print(f"Error message: {e.error.message}")
            raise
        print(e)
        raise

    hate_result = next(item for item in response.categories_analysis if item.category == TextCategory.HATE)
    self_harm_result = next(item for item in response.categories_analysis if item.category == TextCategory.SELF_HARM)
    sexual_result = next(item for item in response.categories_analysis if item.category == TextCategory.SEXUAL)
    violence_result = next(item for item in response.categories_analysis if item.category == TextCategory.VIOLENCE)

    if hate_result:
        print(f"Hate severity: {hate_result.severity}")
    if self_harm_result:
        print(f"SelfHarm severity: {self_harm_result.severity}")
    if sexual_result:
        print(f"Sexual severity: {sexual_result.severity}")
    if violence_result:
        print(f"Violence severity: {violence_result.severity}")

차단 목록을 사용하여 텍스트 분석


    import os
    from azure.ai.contentsafety import ContentSafetyClient
    from azure.core.credentials import AzureKeyCredential
    from azure.ai.contentsafety.models import AnalyzeTextOptions
    from azure.core.exceptions import HttpResponseError

    key = os.environ["CONTENT_SAFETY_KEY"]
    endpoint = os.environ["CONTENT_SAFETY_ENDPOINT"]

    # Create a Content Safety client
    client = ContentSafetyClient(endpoint, AzureKeyCredential(key))

    blocklist_name = "TestBlocklist"
    input_text = "I h*te you and I want to k*ll you."

    try:
        # After you edit your blocklist, it usually takes effect in 5 minutes, please wait some time before analyzing with blocklist after editing.
        analysis_result = client.analyze_text(
            AnalyzeTextOptions(text=input_text, blocklist_names=[blocklist_name], halt_on_blocklist_hit=False)
        )
        if analysis_result and analysis_result.blocklists_match:
            print("\nBlocklist match results: ")
            for match_result in analysis_result.blocklists_match:
                print(
                    f"BlocklistName: {match_result.blocklist_name}, BlockItemId: {match_result.blocklist_item_id}, "
                    f"BlockItemText: {match_result.blocklist_item_text}"
                )
    except HttpResponseError as e:
        print("\nAnalyze text failed: ")
        if e.error:
            print(f"Error code: {e.error.code}")
            print(f"Error message: {e.error.message}")
            raise
        print(e)
        raise

이미지 분석


    import os
    from azure.ai.contentsafety import ContentSafetyClient
    from azure.ai.contentsafety.models import ImageCategory
    from azure.core.credentials import AzureKeyCredential
    from azure.core.exceptions import HttpResponseError
    from azure.ai.contentsafety.models import AnalyzeImageOptions, ImageData

    key = os.environ["CONTENT_SAFETY_KEY"]
    endpoint = os.environ["CONTENT_SAFETY_ENDPOINT"]
    image_path = os.path.abspath(os.path.join(os.path.abspath(__file__), "..", "./sample_data/image.jpg"))

    # Create a Content Safety client
    client = ContentSafetyClient(endpoint, AzureKeyCredential(key))

    # Build request
    with open(image_path, "rb") as file:
        request = AnalyzeImageOptions(image=ImageData(content=file.read()))

    # Analyze image
    try:
        response = client.analyze_image(request)
    except HttpResponseError as e:
        print("Analyze image failed.")
        if e.error:
            print(f"Error code: {e.error.code}")
            print(f"Error message: {e.error.message}")
            raise
        print(e)
        raise

    hate_result = next(item for item in response.categories_analysis if item.category == ImageCategory.HATE)
    self_harm_result = next(item for item in response.categories_analysis if item.category == ImageCategory.SELF_HARM)
    sexual_result = next(item for item in response.categories_analysis if item.category == ImageCategory.SEXUAL)
    violence_result = next(item for item in response.categories_analysis if item.category == ImageCategory.VIOLENCE)

    if hate_result:
        print(f"Hate severity: {hate_result.severity}")
    if self_harm_result:
        print(f"SelfHarm severity: {self_harm_result.severity}")
    if sexual_result:
        print(f"Sexual severity: {sexual_result.severity}")
    if violence_result:
        print(f"Violence severity: {violence_result.severity}")

텍스트 차단 목록 관리

텍스트 차단 목록 만들기 또는 업데이트


    import os
    from azure.ai.contentsafety import BlocklistClient
    from azure.ai.contentsafety.models import TextBlocklist
    from azure.core.credentials import AzureKeyCredential
    from azure.core.exceptions import HttpResponseError

    key = os.environ["CONTENT_SAFETY_KEY"]
    endpoint = os.environ["CONTENT_SAFETY_ENDPOINT"]

    # Create a Blocklist client
    client = BlocklistClient(endpoint, AzureKeyCredential(key))

    blocklist_name = "TestBlocklist"
    blocklist_description = "Test blocklist management."

    try:
        blocklist = client.create_or_update_text_blocklist(
            blocklist_name=blocklist_name,
            options=TextBlocklist(blocklist_name=blocklist_name, description=blocklist_description),
        )
        if blocklist:
            print("\nBlocklist created or updated: ")
            print(f"Name: {blocklist.blocklist_name}, Description: {blocklist.description}")
    except HttpResponseError as e:
        print("\nCreate or update text blocklist failed: ")
        if e.error:
            print(f"Error code: {e.error.code}")
            print(f"Error message: {e.error.message}")
            raise
        print(e)
        raise

텍스트 차단 목록 나열


    import os
    from azure.ai.contentsafety import BlocklistClient
    from azure.core.credentials import AzureKeyCredential
    from azure.core.exceptions import HttpResponseError

    key = os.environ["CONTENT_SAFETY_KEY"]
    endpoint = os.environ["CONTENT_SAFETY_ENDPOINT"]

    # Create a Blocklist client
    client = BlocklistClient(endpoint, AzureKeyCredential(key))

    try:
        blocklists = client.list_text_blocklists()
        if blocklists:
            print("\nList blocklists: ")
            for blocklist in blocklists:
                print(f"Name: {blocklist.blocklist_name}, Description: {blocklist.description}")
    except HttpResponseError as e:
        print("\nList text blocklists failed: ")
        if e.error:
            print(f"Error code: {e.error.code}")
            print(f"Error message: {e.error.message}")
            raise
        print(e)
        raise

텍스트 차단 목록 가져오기


    import os
    from azure.ai.contentsafety import BlocklistClient
    from azure.core.credentials import AzureKeyCredential
    from azure.core.exceptions import HttpResponseError

    key = os.environ["CONTENT_SAFETY_KEY"]
    endpoint = os.environ["CONTENT_SAFETY_ENDPOINT"]

    # Create a Blocklist client
    client = BlocklistClient(endpoint, AzureKeyCredential(key))

    blocklist_name = "TestBlocklist"

    try:
        blocklist = client.get_text_blocklist(blocklist_name=blocklist_name)
        if blocklist:
            print("\nGet blocklist: ")
            print(f"Name: {blocklist.blocklist_name}, Description: {blocklist.description}")
    except HttpResponseError as e:
        print("\nGet text blocklist failed: ")
        if e.error:
            print(f"Error code: {e.error.code}")
            print(f"Error message: {e.error.message}")
            raise
        print(e)
        raise

텍스트 차단 목록 삭제


    import os
    from azure.ai.contentsafety import BlocklistClient
    from azure.core.credentials import AzureKeyCredential
    from azure.core.exceptions import HttpResponseError

    key = os.environ["CONTENT_SAFETY_KEY"]
    endpoint = os.environ["CONTENT_SAFETY_ENDPOINT"]

    # Create a Blocklist client
    client = BlocklistClient(endpoint, AzureKeyCredential(key))

    blocklist_name = "TestBlocklist"

    try:
        client.delete_text_blocklist(blocklist_name=blocklist_name)
        print(f"\nDeleted blocklist: {blocklist_name}")
    except HttpResponseError as e:
        print("\nDelete blocklist failed:")
        if e.error:
            print(f"Error code: {e.error.code}")
            print(f"Error message: {e.error.message}")
            raise
        print(e)
        raise

blockItems 추가


    import os
    from azure.ai.contentsafety import BlocklistClient
    from azure.ai.contentsafety.models import AddOrUpdateTextBlocklistItemsOptions, TextBlocklistItem
    from azure.core.credentials import AzureKeyCredential
    from azure.core.exceptions import HttpResponseError

    key = os.environ["CONTENT_SAFETY_KEY"]
    endpoint = os.environ["CONTENT_SAFETY_ENDPOINT"]

    # Create a Blocklist client
    client = BlocklistClient(endpoint, AzureKeyCredential(key))

    blocklist_name = "TestBlocklist"
    block_item_text_1 = "k*ll"
    block_item_text_2 = "h*te"

    block_items = [TextBlocklistItem(text=block_item_text_1), TextBlocklistItem(text=block_item_text_2)]
    try:
        result = client.add_or_update_blocklist_items(
            blocklist_name=blocklist_name, options=AddOrUpdateTextBlocklistItemsOptions(blocklist_items=block_items)
        )
        for block_item in result.blocklist_items:
            print(
                f"BlockItemId: {block_item.blocklist_item_id}, Text: {block_item.text}, Description: {block_item.description}"
            )
    except HttpResponseError as e:
        print("\nAdd block items failed: ")
        if e.error:
            print(f"Error code: {e.error.code}")
            print(f"Error message: {e.error.message}")
            raise
        print(e)
        raise

blockItems 나열


    import os
    from azure.ai.contentsafety import BlocklistClient
    from azure.core.credentials import AzureKeyCredential
    from azure.core.exceptions import HttpResponseError

    key = os.environ["CONTENT_SAFETY_KEY"]
    endpoint = os.environ["CONTENT_SAFETY_ENDPOINT"]

    # Create a Blocklist client
    client = BlocklistClient(endpoint, AzureKeyCredential(key))

    blocklist_name = "TestBlocklist"

    try:
        block_items = client.list_text_blocklist_items(blocklist_name=blocklist_name)
        if block_items:
            print("\nList block items: ")
            for block_item in block_items:
                print(
                    f"BlockItemId: {block_item.blocklist_item_id}, Text: {block_item.text}, "
                    f"Description: {block_item.description}"
                )
    except HttpResponseError as e:
        print("\nList block items failed: ")
        if e.error:
            print(f"Error code: {e.error.code}")
            print(f"Error message: {e.error.message}")
            raise
        print(e)
        raise

blockItem 가져오기


    import os
    from azure.ai.contentsafety import BlocklistClient
    from azure.core.credentials import AzureKeyCredential
    from azure.ai.contentsafety.models import TextBlocklistItem, AddOrUpdateTextBlocklistItemsOptions
    from azure.core.exceptions import HttpResponseError

    key = os.environ["CONTENT_SAFETY_KEY"]
    endpoint = os.environ["CONTENT_SAFETY_ENDPOINT"]

    # Create a Blocklist client
    client = BlocklistClient(endpoint, AzureKeyCredential(key))

    blocklist_name = "TestBlocklist"
    block_item_text_1 = "k*ll"

    try:
        # Add a blockItem
        add_result = client.add_or_update_blocklist_items(
            blocklist_name=blocklist_name,
            options=AddOrUpdateTextBlocklistItemsOptions(blocklist_items=[TextBlocklistItem(text=block_item_text_1)]),
        )
        if not add_result or not add_result.blocklist_items or len(add_result.blocklist_items) <= 0:
            raise RuntimeError("BlockItem not created.")
        block_item_id = add_result.blocklist_items[0].blocklist_item_id

        # Get this blockItem by blockItemId
        block_item = client.get_text_blocklist_item(blocklist_name=blocklist_name, blocklist_item_id=block_item_id)
        print("\nGet blockitem: ")
        print(
            f"BlockItemId: {block_item.blocklist_item_id}, Text: {block_item.text}, Description: {block_item.description}"
        )
    except HttpResponseError as e:
        print("\nGet block item failed: ")
        if e.error:
            print(f"Error code: {e.error.code}")
            print(f"Error message: {e.error.message}")
            raise
        print(e)
        raise

blockItems 제거


    import os
    from azure.ai.contentsafety import BlocklistClient
    from azure.core.credentials import AzureKeyCredential
    from azure.ai.contentsafety.models import (
        TextBlocklistItem,
        AddOrUpdateTextBlocklistItemsOptions,
        RemoveTextBlocklistItemsOptions,
    )
    from azure.core.exceptions import HttpResponseError

    key = os.environ["CONTENT_SAFETY_KEY"]
    endpoint = os.environ["CONTENT_SAFETY_ENDPOINT"]

    # Create a Blocklist client
    client = BlocklistClient(endpoint, AzureKeyCredential(key))

    blocklist_name = "TestBlocklist"
    block_item_text_1 = "k*ll"

    try:
        # Add a blockItem
        add_result = client.add_or_update_blocklist_items(
            blocklist_name=blocklist_name,
            options=AddOrUpdateTextBlocklistItemsOptions(blocklist_items=[TextBlocklistItem(text=block_item_text_1)]),
        )
        if not add_result or not add_result.blocklist_items or len(add_result.blocklist_items) <= 0:
            raise RuntimeError("BlockItem not created.")
        block_item_id = add_result.blocklist_items[0].blocklist_item_id

        # Remove this blockItem by blockItemId
        client.remove_blocklist_items(
            blocklist_name=blocklist_name, options=RemoveTextBlocklistItemsOptions(blocklist_item_ids=[block_item_id])
        )
        print(f"\nRemoved blockItem: {add_result.blocklist_items[0].blocklist_item_id}")
    except HttpResponseError as e:
        print("\nRemove block item failed: ")
        if e.error:
            print(f"Error code: {e.error.code}")
            print(f"Error message: {e.error.message}")
            raise
        print(e)
        raise

문제 해결

일반

Azure AI 콘텐츠 보안 클라이언트 라이브러리는 Azure Core에 정의된 예외를 발생합니다. 오류 코드는 다음과 같이 정의됩니다.

오류 코드 가능한 이유 제안
InvalidRequestBody 요청 본문에 있는 하나 이상의 필드가 API 정의와 일치하지 않습니다. 1. API 호출에서 지정한 API 버전을 확인하세요.
2. 선택한 API 버전에 해당하는 API 정의를 확인하세요.
InvalidResourceName URL에 지정한 리소스 이름이 차단 목록 이름, 차단 목록 용어 ID 등과 같은 요구 사항을 충족하지 않습니다. 1. API 호출에서 지정한 API 버전을 확인하세요.
2. API 정의에 따라 해당 이름에 잘못된 문자가 있는지 확인하세요.
ResourceNotFound 차단 목록 이름처럼 URL에 지정한 리소스가 존재하지 않을 수 있습니다. 1. API 호출에서 지정한 API 버전을 확인하세요.
2. URL에 지정된 리소스가 있는지 다시 확인하세요.
InternalError 서버 측에서 예상치 못한 상황이 발생했습니다. 1. 잠시 후 몇 번 다시 시도하여 문제가 다시 발생하는지 확인할 수 있습니다.
2. 이 문제가 지속되면 Azure 지원에 문의하세요.
ServerBusy 서버 측에서 일시적으로 요청을 처리할 수 없습니다. 1. 잠시 후 몇 번 다시 시도하여 문제가 다시 발생하는지 확인할 수 있습니다.
2. 이 문제가 지속되면 Azure 지원에 문의하세요.
TooManyRequests 현재 RPS가 현재 SKU에 대한 할당량을 초과했습니다. 1. RPS 할당량을 이해하려면 가격 책정 표를 확인하세요.
2. QPS가 더 필요한 경우 Azure 지원에 문의하세요.

로깅

이 라이브러리는 로깅에 표준 로깅 라이브러리를 사용합니다.

HTTP 세션(URL, 헤더 등)에 대한 기본 정보는 수준에서 기록됩니다 INFO .

DEBUG 요청/응답 본문 및 수정되지 않은 헤더를 포함한 자세한 수준 로깅은 클라이언트 또는 키워드(keyword) 인수를 logging_enable 사용하여 작업별로 사용하도록 설정할 수 있습니다.

여기에 예제가 있는 전체 SDK 로깅 설명서를 참조 하세요.

선택적 구성

선택적 키워드(keyword) 인수는 클라이언트 및 작업별 수준에서 전달할 수 있습니다. azure-core 참조 설명서 에서는 재시도, 로깅, 전송 프로토콜 등에 사용할 수 있는 구성에 대해 설명합니다.

다음 단계

추가 설명서

Azure Content Safety에 대한 보다 광범위한 설명서는 docs.microsoft.com Azure AI 콘텐츠 보안 참조하세요.

참여

이 프로젝트에 대한 기여와 제안을 환영합니다. 대부분의 경우 기여하려면 권한을 부여하며 실제로 기여를 사용할 권한을 당사에 부여한다고 선언하는 CLA(기여자 라이선스 계약)에 동의해야 합니다. 자세한 내용은 https://cla.microsoft.com 을 참조하세요.

끌어오기 요청을 제출하면 CLA-bot은 CLA를 제공하고 PR을 적절하게 데코레이팅해야 하는지 여부를 자동으로 결정합니다(예: 레이블, 설명). 봇에서 제공하는 지침을 따르기만 하면 됩니다. 이 작업은 CLA를 사용하여 모든 리포지토리에서 한 번만 수행하면 됩니다.

이 프로젝트에는 Microsoft Open Source Code of Conduct(Microsoft 오픈 소스 준수 사항)가 적용됩니다. 자세한 내용은 행동 강령 FAQ를 참조하거나 추가 질문 또는 의견을 문의 opencode@microsoft.com 하세요.