Skip to content

Specifiying UtteranceSplit parameter with a fractional value causes HttpException #177

@dhymik

Description

@dhymik

What is the current behavior?

When calling DeepgramClient.Transcription.Prerecorded.GetTranscriptionAsync() with a PrerecordedTranscriptionOptions parameter that contains a PrerecordedTranscriptionOptions.UtteranceSplit value which has a fractiuonal value (i.e. 1.2, 2.5) causes HttpException. Values like 2.0, 1.0 do not cause exception.

This seems to be an issue in how the value is being serialized in Deepgram.Utilities.QueryParameterUtil.GetParameters()

Steps to reproduce

call DeepgramClient.Transcription.Prerecorded.GetTranscriptionAsync() with a PrerecordedTranscriptionOptions parameter that contains a PrerecordedTranscriptionOptions.UtteranceSplit value which has a fractiuonal value (i.e. 1.2, 2.5).

Expected behavior

No exception is being thrown and the API call succeeds.

Please tell us about your environment

  • Operating System/Version: Windows 11
  • Language: C#

Error call stack:

Unhandled exception. System.Net.Http.HttpRequestException: Error while copying content to a stream.
 ---> System.IO.IOException: Unable to write data to the transport connection: Eine vorhandene Verbindung wurde vom Remotehost geschlossen..
 ---> System.Net.Sockets.SocketException (10054): Eine vorhandene Verbindung wurde vom Remotehost geschlossen.
   --- End of inner exception stack trace ---
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
   at System.Net.Security.SslStream.<WriteSingleChunk>g__CompleteWriteAsync|153_1[TIOAdapter](ValueTask writeTask, Byte[] bufferToReturn)
   at System.Net.Security.SslStream.WriteAsyncChunked[TIOAdapter](ReadOnlyMemory`1 buffer, CancellationToken cancellationToken)
   at System.Net.Security.SslStream.WriteAsyncInternal[TIOAdapter](ReadOnlyMemory`1 buffer, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnection.WriteAsync(ReadOnlyMemory`1 source, Boolean async)
   at System.IO.Stream.<CopyToAsync>g__Core|27_0(Stream source, Stream destination, Int32 bufferSize, CancellationToken cancellationToken)
   at System.IO.Strategies.BufferedFileStreamStrategy.CopyToAsyncCore(Stream destination, Int32 bufferSize, CancellationToken cancellationToken)
   at System.Net.Http.HttpContent.<CopyToAsync>g__WaitAsync|56_0(ValueTask copyTask)
   --- End of inner exception stack trace ---
   at System.Net.Http.HttpContent.<CopyToAsync>g__WaitAsync|56_0(ValueTask copyTask)
   at System.Net.Http.HttpConnection.SendRequestContentAsync(HttpRequestMessage request, HttpContentWriteStream stream, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   at Deepgram.Request.ApiRequest.SendHttpRequestAsync[T](HttpRequestMessage request)
   at Deepgram.Clients.PrerecordedTranscriptionClient.GetTranscriptionAsync(StreamSource source, PrerecordedTranscriptionOptions options)
   at Program.<Main>$(String[] args) in C:\Users\Mikael\Source\Projects\DeepgramConsole\DeepgramConsole\Program.cs:line 59
   at Program.<Main>(String[] args)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions