openai/openai-dotnet
Publicmirrored from https://github.com/openai/openai-dotnetAvailable
OpenAI/src/Custom/Audio/AudioTranscriptionChunkingStrategy.cs
37lines · modecode
| 1 | using Microsoft.TypeSpec.Generator.Customizations; |
| 2 | |
| 3 | namespace OpenAI.Audio; |
| 4 | |
| 5 | // CUSTOM: Added to represent a non-discriminated union. |
| 6 | [CodeGenType("DotNetTranscriptionChunkingStrategy")] |
| 7 | [CodeGenVisibility(nameof(AudioTranscriptionChunkingStrategy), CodeGenVisibility.Internal)] |
| 8 | public partial class AudioTranscriptionChunkingStrategy |
| 9 | { |
| 10 | // CUSTOM: Added to support the corresponding component of the union. |
| 11 | public AudioTranscriptionChunkingStrategy(AudioTranscriptionDefaultChunkingStrategy defaultChunkingStrategy) |
| 12 | { |
| 13 | DefaultChunkingStrategy = defaultChunkingStrategy; |
| 14 | } |
| 15 | |
| 16 | // CUSTOM: Added to support the corresponding component of the union. |
| 17 | public AudioTranscriptionChunkingStrategy(AudioTranscriptionCustomChunkingStrategy customChunkingStrategy) |
| 18 | { |
| 19 | Argument.AssertNotNull(customChunkingStrategy, nameof(customChunkingStrategy)); |
| 20 | |
| 21 | CustomChunkingStrategy = customChunkingStrategy; |
| 22 | } |
| 23 | |
| 24 | // CUSTOM: Removed setter. |
| 25 | [CodeGenMember("DefaultChunkingStrategy")] |
| 26 | public AudioTranscriptionDefaultChunkingStrategy? DefaultChunkingStrategy { get; } |
| 27 | |
| 28 | // CUSTOM: Removed setter. |
| 29 | [CodeGenMember("CustomChunkingStrategy")] |
| 30 | public AudioTranscriptionCustomChunkingStrategy CustomChunkingStrategy { get; } |
| 31 | |
| 32 | // CUSTOM: Added for convenience. |
| 33 | public static implicit operator AudioTranscriptionChunkingStrategy(AudioTranscriptionDefaultChunkingStrategy defaultChunkingStrategy) => new(defaultChunkingStrategy); |
| 34 | |
| 35 | // CUSTOM: Added for convenience. |
| 36 | public static implicit operator AudioTranscriptionChunkingStrategy(AudioTranscriptionCustomChunkingStrategy customChunkingStrategy) => customChunkingStrategy is null ? null : new(customChunkingStrategy); |
| 37 | } |
| 38 | |