Skip to content

Commit

Permalink
Add moderation to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
OkGoDoIt committed Mar 8, 2023
1 parent e728620 commit 0bc8782
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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<ModerationResult> 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`:

Expand Down

0 comments on commit 0bc8782

Please sign in to comment.