Skip to content

Commit

Permalink
Merge pull request #302 from rzubek/master
Browse files Browse the repository at this point in the history
A couple of small fixes for the 7.1 beta
  • Loading branch information
kayhantolga authored Jun 22, 2023
2 parents 895f4b3 + a5de25d commit 987089e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion OpenAI.SDK/Managers/OpenAIChatCompletions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ public void Process(ChatCompletionCreateResponse block)
if (firstChoice == null) { return; } // not a valid state? nothing to do

var isStreamingFnCall = IsStreamingFunctionCall();
var justStarted = false;

// If we're not yet assembling, and we just got a streaming block that has a function_call segment,
// this is the beginning of a function call assembly.
Expand All @@ -116,10 +117,12 @@ public void Process(ChatCompletionCreateResponse block)
{
FnCall = firstChoice.Message.FunctionCall;
firstChoice.Message.FunctionCall = null;
justStarted = true;
}

// As long as we're assembling, keep on appending those args
if (IsFnAssemblyActive)
// (Skip the first one, because it was already processed in the block above)
if (IsFnAssemblyActive && !justStarted)
{
FnCall.Arguments += ExtractArgsSoFar();
}
Expand Down
1 change: 1 addition & 0 deletions OpenAI.SDK/ObjectModels/RequestModels/ChatMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ public class FunctionParameterPropertyValue
/// <summary>
/// Optional. List of allowed values for this argument.
/// </summary>
[JsonPropertyName("enum")]
public IList<string>? Enum { get; set; }
}

Expand Down

0 comments on commit 987089e

Please sign in to comment.