diff --git a/src/Libraries/Microsoft.Extensions.AI.Evaluation.Reporting/TypeScript/components/EvalTypes.d.ts b/src/Libraries/Microsoft.Extensions.AI.Evaluation.Reporting/TypeScript/components/EvalTypes.d.ts index 20a3df81b21..1055df330df 100644 --- a/src/Libraries/Microsoft.Extensions.AI.Evaluation.Reporting/TypeScript/components/EvalTypes.d.ts +++ b/src/Libraries/Microsoft.Extensions.AI.Evaluation.Reporting/TypeScript/components/EvalTypes.d.ts @@ -13,10 +13,14 @@ type ScenarioRunResult = { executionName: string; creationTime?: string; messages: ChatMessage[]; - modelResponse: ChatMessage; + modelResponse: ChatResponse; evaluationResult: EvaluationResult; }; +type ChatResponse = { + messages: ChatMessage[]; +} + type ChatMessage = { authorName?: string; role: string; diff --git a/src/Libraries/Microsoft.Extensions.AI.Evaluation.Reporting/TypeScript/components/Summary.ts b/src/Libraries/Microsoft.Extensions.AI.Evaluation.Reporting/TypeScript/components/Summary.ts index a6df92b36da..8cef12ce4f1 100644 --- a/src/Libraries/Microsoft.Extensions.AI.Evaluation.Reporting/TypeScript/components/Summary.ts +++ b/src/Libraries/Microsoft.Extensions.AI.Evaluation.Reporting/TypeScript/components/Summary.ts @@ -145,7 +145,7 @@ const isTextContent = (content: AIContent): content is TextContent => { return (content as TextContent).text !== undefined; }; -export const getPromptDetails = (messages: ChatMessage[], modelResponse?: ChatMessage): {history:string, response: string}=> { +export const getPromptDetails = (messages: ChatMessage[], modelResponse?: ChatResponse): {history:string, response: string}=> { let history: string = ""; if (messages.length === 1) { history = messages[0].contents.map(c => (c as TextContent).text).join("\n"); @@ -163,7 +163,7 @@ export const getPromptDetails = (messages: ChatMessage[], modelResponse?: ChatMe history = historyItems.join("\n\n"); } - const response: string = modelResponse?.contents.map(c => (c as TextContent).text).join("\n") ?? ""; + const response: string = modelResponse?.messages.map(m => m.contents.map(c => (c as TextContent).text).join("\n") ?? "").join("\n") ?? ""; return { history, response }; }; \ No newline at end of file