Skip to content

Commit

Permalink
reorder citations so it doesnt conflict with tools
Browse files Browse the repository at this point in the history
  • Loading branch information
lilydu committed Dec 27, 2024
1 parent 3c9e4fb commit d8a185d
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,12 @@ public async Task<PromptResponse> CompletePromptAsync(
return;
}

IList<Citation>? citations = args.Chunk.delta?.Context?.Citations ?? null;

if (citations != null)
{
streamer.SetCitations(citations);
}

// Ignore content without text
// - The chunk is likely for a Tool Call.
Expand All @@ -210,13 +216,6 @@ public async Task<PromptResponse> CompletePromptAsync(

// Send chunk to client
string text = args.Chunk.delta?.GetContent<string>() ?? "";
IList<Citation>? citations = args.Chunk.delta?.Context?.Citations ?? null;

if (citations != null)
{
streamer.SetCitations(citations);
}


if (text.Length > 0)
{
Expand Down

0 comments on commit d8a185d

Please sign in to comment.