Skip to content

Conversation

toshiakit
Copy link
Collaborator

Made changes to
+llms/+internal/callOpenAIChatAPI.m

pat = '{"' + wildcardPattern + '":';
if contains(streamedText,pat)
    s = jsondecode(streamedText);
    if contains(s.function.arguments,pat)
        prompt = jsondecode(s.function.arguments);
        s.function.arguments = prompt;
    end
    message = struct("role", "assistant", ...
         "content",[], ...
         "tool_calls",jsondecode(streamedText));
else
    message = struct("role", "assistant", ...
        "content", streamedText);
end

+llms/+stream/responseStreamer.m

try
    json = jsondecode(str{i});
catch ME
    error("API returned il-formed json: " + str{i})
end

@toshiakit toshiakit requested a review from debymf February 26, 2024 23:55
@debymf debymf merged commit efa591b into main Feb 28, 2024
@debymf debymf deleted the dev-fix-streaming-bug branch February 28, 2024 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants