@@ -438,7 +438,7 @@ partial void ProcessAudioTranscriptionsResponseContent(
438438 retryReason : global ::System . String . Empty ,
439439 cancellationToken : __effectiveCancellationToken ) ) . ConfigureAwait ( false ) ;
440440 }
441- // BadRequest
441+ // BadRequest. Possible error codes include `audio_too_long` (audio duration exceeds the 4 hour cap), `file_too_large` (URL-fetched audio exceeds the 1 GB server-side cap), `unsupported_format` (codec or container could not be decoded), and `invalid_params` (request parameters failed validation).
442442 if ( ( int ) __response . StatusCode == 400 )
443443 {
444444 string ? __content_400 = null ;
@@ -463,18 +463,17 @@ partial void ProcessAudioTranscriptionsResponseContent(
463463 __exception_400 = __ex ;
464464 }
465465
466- throw new global ::Together . ApiException < global ::Together . ErrorData > (
466+
467+ throw global ::Together . ApiException < global ::Together . ErrorData > . Create (
468+ statusCode : __response . StatusCode ,
467469 message : __content_400 ?? __response . ReasonPhrase ?? string . Empty ,
468470 innerException : __exception_400 ,
469- statusCode : __response . StatusCode )
470- {
471- ResponseBody = __content_400 ,
472- ResponseObject = __value_400 ,
473- ResponseHeaders = global ::System . Linq . Enumerable . ToDictionary (
471+ responseBody : __content_400 ,
472+ responseObject : __value_400 ,
473+ responseHeaders : global ::System . Linq . Enumerable . ToDictionary (
474474 __response . Headers ,
475475 h => h . Key ,
476- h => h . Value ) ,
477- } ;
476+ h => h . Value ) ) ;
478477 }
479478 // Unauthorized
480479 if ( ( int ) __response . StatusCode == 401 )
@@ -501,18 +500,54 @@ partial void ProcessAudioTranscriptionsResponseContent(
501500 __exception_401 = __ex ;
502501 }
503502
504- throw new global ::Together . ApiException < global ::Together . ErrorData > (
503+
504+ throw global ::Together . ApiException < global ::Together . ErrorData > . Create (
505+ statusCode : __response . StatusCode ,
505506 message : __content_401 ?? __response . ReasonPhrase ?? string . Empty ,
506507 innerException : __exception_401 ,
507- statusCode : __response . StatusCode )
508+ responseBody : __content_401 ,
509+ responseObject : __value_401 ,
510+ responseHeaders : global ::System . Linq . Enumerable . ToDictionary (
511+ __response . Headers ,
512+ h => h . Key ,
513+ h => h . Value ) ) ;
514+ }
515+ // Payload Too Large. The request body exceeded the 500 MB edge limit. For larger payloads, host the file and submit an HTTPS URL via the `file` field (URL-fetched audio is capped at 1 GB server-side).
516+ if ( ( int ) __response . StatusCode == 413 )
517+ {
518+ string ? __content_413 = null ;
519+ global ::System . Exception ? __exception_413 = null ;
520+ string ? __value_413 = null ;
521+ try
508522 {
509- ResponseBody = __content_401 ,
510- ResponseObject = __value_401 ,
511- ResponseHeaders = global ::System . Linq . Enumerable . ToDictionary (
523+ if ( __effectiveReadResponseAsString )
524+ {
525+ __content_413 = await __response . Content . ReadAsStringAsync ( __effectiveCancellationToken ) . ConfigureAwait ( false ) ;
526+ __value_413 = ( string ? ) global ::System . Text . Json . JsonSerializer . Deserialize ( __content_413 , typeof ( string ) , JsonSerializerContext ) ;
527+ }
528+ else
529+ {
530+ __content_413 = await __response . Content . ReadAsStringAsync ( __effectiveCancellationToken ) . ConfigureAwait ( false ) ;
531+
532+ __value_413 = ( string ? ) global ::System . Text . Json . JsonSerializer . Deserialize ( __content_413 , typeof ( string ) , JsonSerializerContext ) ;
533+ }
534+ }
535+ catch ( global ::System . Exception __ex )
536+ {
537+ __exception_413 = __ex ;
538+ }
539+
540+
541+ throw global ::Together . ApiException < string > . Create (
542+ statusCode : __response . StatusCode ,
543+ message : __content_413 ?? __response . ReasonPhrase ?? string . Empty ,
544+ innerException : __exception_413 ,
545+ responseBody : __content_413 ,
546+ responseObject : __value_413 ,
547+ responseHeaders : global ::System . Linq . Enumerable . ToDictionary (
512548 __response . Headers ,
513549 h => h . Key ,
514- h => h . Value ) ,
515- } ;
550+ h => h . Value ) ) ;
516551 }
517552 // RateLimit
518553 if ( ( int ) __response . StatusCode == 429 )
@@ -539,18 +574,17 @@ partial void ProcessAudioTranscriptionsResponseContent(
539574 __exception_429 = __ex ;
540575 }
541576
542- throw new global ::Together . ApiException < global ::Together . ErrorData > (
577+
578+ throw global ::Together . ApiException < global ::Together . ErrorData > . Create (
579+ statusCode : __response . StatusCode ,
543580 message : __content_429 ?? __response . ReasonPhrase ?? string . Empty ,
544581 innerException : __exception_429 ,
545- statusCode : __response . StatusCode )
546- {
547- ResponseBody = __content_429 ,
548- ResponseObject = __value_429 ,
549- ResponseHeaders = global ::System . Linq . Enumerable . ToDictionary (
582+ responseBody : __content_429 ,
583+ responseObject : __value_429 ,
584+ responseHeaders : global ::System . Linq . Enumerable . ToDictionary (
550585 __response . Headers ,
551586 h => h . Key ,
552- h => h . Value ) ,
553- } ;
587+ h => h . Value ) ) ;
554588 }
555589
556590 if ( __effectiveReadResponseAsString )
@@ -584,17 +618,15 @@ partial void ProcessAudioTranscriptionsResponseContent(
584618 }
585619 catch ( global ::System . Exception __ex )
586620 {
587- throw new global ::Together . ApiException (
621+ throw global ::Together . ApiException . Create (
622+ statusCode : __response . StatusCode ,
588623 message : __content ?? __response . ReasonPhrase ?? string . Empty ,
589624 innerException : __ex ,
590- statusCode : __response . StatusCode )
591- {
592- ResponseBody = __content ,
593- ResponseHeaders = global ::System . Linq . Enumerable . ToDictionary (
625+ responseBody : __content ,
626+ responseHeaders : global ::System . Linq . Enumerable . ToDictionary (
594627 __response . Headers ,
595628 h => h . Key ,
596- h => h . Value ) ,
597- } ;
629+ h => h . Value ) ) ;
598630 }
599631 }
600632 else
@@ -631,17 +663,15 @@ partial void ProcessAudioTranscriptionsResponseContent(
631663 {
632664 }
633665
634- throw new global ::Together . ApiException (
666+ throw global ::Together . ApiException . Create (
667+ statusCode : __response . StatusCode ,
635668 message : __content ?? __response . ReasonPhrase ?? string . Empty ,
636669 innerException : __ex ,
637- statusCode : __response . StatusCode )
638- {
639- ResponseBody = __content ,
640- ResponseHeaders = global ::System . Linq . Enumerable . ToDictionary (
670+ responseBody : __content ,
671+ responseHeaders : global ::System . Linq . Enumerable . ToDictionary (
641672 __response . Headers ,
642673 h => h . Key ,
643- h => h . Value ) ,
644- } ;
674+ h => h . Value ) ) ;
645675 }
646676 }
647677
@@ -657,7 +687,7 @@ partial void ProcessAudioTranscriptionsResponseContent(
657687 /// Transcribes audio into text
658688 /// </summary>
659689 /// <param name="file">
660- /// Audio file upload or public HTTP/HTTPS URL. Supported formats .wav, .mp3, .m4a, .webm, .flac, .ogg, .opus, .aac.
690+ /// Audio file upload or public HTTP/HTTPS URL. Supported formats: .wav, .mp3, .m4a, .webm, .flac, .ogg, .opus, .aac. Maximum duration 4 hours; longer audio is rejected with `audio_too_long`. Binary uploads are additionally capped at 500 MB (HTTP 413); URL-fetched audio is capped at 1 GB .
661691 /// </param>
662692 /// <param name="model">
663693 /// Model to use for transcription<br/>
0 commit comments