diff --git a/packages/search/src/lib/approaches/chat-read-retrieve-read.ts b/packages/search/src/lib/approaches/chat-read-retrieve-read.ts index a8e395d2..ca694338 100644 --- a/packages/search/src/lib/approaches/chat-read-retrieve-read.ts +++ b/packages/search/src/lib/approaches/chat-read-retrieve-read.ts @@ -107,14 +107,14 @@ export class ChatReadRetrieveRead extends ApproachBase implements ChatApproach { { index: 0, delta: { - content: chunk.choices[0].delta.content ?? '', + content: chunk.choices[0]?.delta.content ?? '', role: 'assistant' as const, context: { data_points: id === 0 ? { text: dataPoints } : undefined, thoughts: id === 0 ? thoughts : undefined, }, }, - finish_reason: chunk.choices[0].finish_reason, + finish_reason: chunk.choices[0]?.finish_reason, }, ], object: 'chat.completion.chunk' as const,