From 0bc878260031f7b94ce0652503dd87f741ed867f Mon Sep 17 00:00:00 2001 From: Roger Date: Wed, 8 Mar 2023 12:59:17 -0800 Subject: [PATCH] Add moderation to readme --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.md b/README.md index 1f20f52..3a6dd7c 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ Console.WriteLine(result); * [Completions API](#completions) * [Streaming completion results](#streaming) * [Embeddings API](#embeddings) + * [Moderation API](#moderation) * [Files API](#files-for-fine-tuning) * [Additonal Documentation](#documentation) * [License](#license) @@ -129,6 +130,24 @@ The embedding result contains a lot of metadata, the actual vector of floats is For simplicity, you can directly ask for the vector of floats and disgard the extra metadata with `api.Embeddings.GetEmbeddingsAsync("test text here")` + +### Moderation +The Moderation API is accessed via `OpenAIAPI.Moderation`: + +```csharp +async Task CreateEmbeddingAsync(ModerationRequest request); + +// for example +var result = await api.Moderation.CallModerationAsync(new ModerationRequest("A test text for moderating", Model.TextModerationLatest)); +// or +var result = await api.Moderation.CallModerationAsync("A test text for moderating"); + +Console.WriteLine(result.results[0].MainContentFlag); +``` + +The results are in `.results[0]` and have nice helper methods like `FlaggedCategories` and `MainContentFlag`. + + ### Files (for fine-tuning) The Files API endpoint is accessed via `OpenAIAPI.Files`: