import openaiclient = openai.OpenAI( api_key="AIHUBMIX_API_KEY", base_url="https://aihubmix.com/v1")response = client.moderations.create( model="text-moderation-latest", input="The Yangtze River rolls eastward, its waves washing away heroes. Right and wrong, success and failure, all seem empty; the green hills remain, though the sun sets many times. The white-haired fisherman and woodcutter on the riverbank, accustomed to watching the autumn moon and spring breeze. A pot of turbid wine brings joy in meeting, how many events through time are all laughed off.",)print(response)
출력 결과에는 JSON 응답에 여러 카테고리가 포함되어, 입력에 어떤 유형의 콘텐츠가 있는지(있는 경우) 그리고 모델이 그 존재를 어느 정도로 믿는지를 알려줍니다.
출력 카테고리
설명
flagged
모델이 콘텐츠를 잠재적으로 유해한 것으로 분류한 경우 true로 설정되며, 그렇지 않은 경우 false로 설정됩니다.
categories
카테고리별 위반 플래그 딕셔너리를 포함합니다. 각 카테고리에 대해, 모델이 해당 카테고리를 위반된 것으로 표시하면 값은 true이고, 그렇지 않으면 false입니다.
category_scores
모델이 출력한 카테고리별 점수 딕셔너리를 포함하여, 입력이 해당 카테고리에 대한 OpenAI의 정책을 위반한다는 모델의 신뢰도를 나타냅니다. 값은 0과 1 사이이며, 값이 높을수록 신뢰도가 높음을 나타냅니다.
category_applied_input_types
이 속성은 각 카테고리에 대해 응답에서 어떤 입력 타입이 플래그 처리되었는지에 대한 정보를 포함합니다. 예를 들어, 모델에 대한 이미지와 텍스트 입력이 모두 “violence/graphic”에 대해 플래그가 지정된 경우, violence/graphic 속성은 ["image", "text"]로 설정됩니다. 이는 omni 모델에서만 사용할 수 있습니다.