openai / openai-dotnet

The official .NET library for the OpenAI API
https://www.nuget.org/packages/OpenAI
MIT License
1.15k stars 113 forks source link

Allow multiple granularities in AudioTranscriptionOptions #104

Closed RogerBarreto closed 3 months ago

RogerBarreto commented 3 months ago

As per API definition, the granularities are multiple, but in current design we can only have one or another.

https://platform.openai.com/docs/api-reference/audio/createTranscription#audio-createtranscription-timestamp_granularities

image

joseharriaga commented 3 months ago

Thank you for reaching out, @RogerBarreto ! You can set both options like this:

AudioTranscriptionOptions options = new()
{
    ResponseFormat = AudioTranscriptionFormat.Verbose,
    Granularities = AudioTimestampGranularities.Word | AudioTimestampGranularities.Segment,
};
RogerBarreto commented 3 months ago

That's great, missed that, thanks