Skip to content

Commit

Permalink
fix: explicit return to mark stream done
Browse files Browse the repository at this point in the history
  • Loading branch information
thucpn committed Oct 10, 2024
1 parent 828859a commit 9530db4
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,15 @@ export class FunctionCallingAgent extends Workflow {
fullResponse = chunk;
}

if (fullResponse) {
if (fullResponse?.options && Object.keys(fullResponse.options).length) {
memory.put({
role: "assistant",
content: "",
options: fullResponse.options,
});
yield fullResponse;
} else {
return; // Explicitly mark generator as done
}
};

Expand Down

0 comments on commit 9530db4

Please sign in to comment.