You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/ai-services/openai/concepts/content-filter.md
+69Lines changed: 69 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -294,6 +294,9 @@ When annotations are enabled as shown in the code snippet below, the following i
294
294
295
295
Annotations are currently in preview for Completions and Chat Completions (GPT models); the following code snippet shows how to use annotations in preview:
296
296
297
+
# [Python](#tab/python)
298
+
299
+
297
300
```python
298
301
# Note: The openai-python library support for Azure OpenAI is in preview.
299
302
# os.getenv() for the endpoint and key assumes that you are using environment variables.
@@ -413,6 +416,72 @@ except openai.error.InvalidRequestError as e:
`Hate category is filtered: ${hate?.filtered} with ${hate?.severity} severity`
464
+
);
465
+
console.log(
466
+
`Sexual category is filtered: ${sexual?.filtered} with ${sexual?.severity} severity`
467
+
);
468
+
console.log(
469
+
`Self-harm category is filtered: ${selfHarm?.filtered} with ${selfHarm?.severity} severity`
470
+
);
471
+
console.log(
472
+
`Violence category is filtered: ${violence?.filtered} with ${violence?.severity} severity`
473
+
);
474
+
}
475
+
}
476
+
}
477
+
}
478
+
479
+
main().catch((err) => {
480
+
console.error("The sample encountered an error:", err);
481
+
});
482
+
```
483
+
---
484
+
416
485
For details on the inference RESTAPI endpoints for Azure OpenAI and how to create Chat and Completions please follow [Azure OpenAI Service RESTAPI reference guidance](../reference.md). Annotations are returned for all scenarios when using `2023-06-01-preview`.
417
486
418
487
### Example scenario: An input prompt containing content that is classified at a filtered category and severity level is sent to the completions API
0 commit comments