Codeblaze.SemanticKernel
Codeblaze.SemanticKernel copied to clipboard
GetStreamingChatMessageContentsAsync not working
Hi there,
Thanks so much for the connector. Please could you describe how to get message streaming working?
I have set up the project accordingly and when attempting to stream i receive an error:
result = chatCompletionService.GetStreamingChatMessageContentsAsync( history, executionSettings: _openAIPromptExecutionSettings, kernel: kernel);
System.Text.Json.JsonException
HResult=0x80131500
Message='{' is invalid after a single JSON value. Expected end of data. Path: $ | LineNumber: 1 | BytePositionInLine: 0.
Source=System.Text.Json
StackTrace:
at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, JsonReaderException ex)
at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan
1 utf8Json, JsonTypeInfo1 jsonTypeInfo, Nullable
1 actualByteCount)
at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan1 json, JsonTypeInfo
1 jsonTypeInfo)
at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonSerializerOptions options)
at Codeblaze.SemanticKernel.Connectors.Ollama.OllamaChatCompletionService.<GetStreamingChatMessageContentsAsync>d__2.MoveNext()
at Codeblaze.SemanticKernel.Connectors.Ollama.OllamaChatCompletionService.<GetStreamingChatMessageContentsAsync>d__2.System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult(Int16 token)
at xxx.<Execute>d__2.MoveNext() in xxx
at xxx.<Execute>d__2.MoveNext() in xxx
at Program.<<Main>$>d__0.MoveNext() in xxxx
This exception was originally thrown at this call stack: [External Code]
Inner Exception 1: JsonReaderException: '{' is invalid after a single JSON value. Expected end of data. LineNumber: 1 | BytePositionInLine: 0.