mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-09-19 20:24:32 +02:00
Catch LLM Eval Failures (#2272)
This commit is contained in:
@@ -19,6 +19,7 @@ import { FiTag } from "react-icons/fi";
|
||||
import { DISABLE_LLM_DOC_RELEVANCE } from "@/lib/constants";
|
||||
import { SettingsContext } from "../settings/SettingsProvider";
|
||||
import { CustomTooltip, TooltipGroup } from "../tooltip/CustomTooltip";
|
||||
import { WarningCircle } from "@phosphor-icons/react";
|
||||
|
||||
export const buildDocumentSummaryDisplay = (
|
||||
matchHighlights: string[],
|
||||
@@ -230,7 +231,7 @@ export const DocumentDisplay = ({
|
||||
{document.semantic_identifier || document.document_id}
|
||||
</p>
|
||||
</a>
|
||||
<div className="ml-auto flex gap-x-2">
|
||||
<div className="ml-auto flex items-center">
|
||||
<TooltipGroup>
|
||||
{isHovered && messageId && (
|
||||
<DocumentFeedbackBlock
|
||||
@@ -252,7 +253,7 @@ export const DocumentDisplay = ({
|
||||
>
|
||||
<CustomTooltip showTick line content="Toggle content">
|
||||
<LightBulbIcon
|
||||
className={`${settings?.isMobile && alternativeToggled ? "text-green-600" : "text-blue-600"} h-4 w-4 cursor-pointer`}
|
||||
className={`${settings?.isMobile && alternativeToggled ? "text-green-600" : "text-blue-600"} my-auto ml-2 h-4 w-4 cursor-pointer`}
|
||||
/>
|
||||
</CustomTooltip>
|
||||
</button>
|
||||
@@ -326,31 +327,32 @@ export const AgenticDocumentDisplay = ({
|
||||
</p>
|
||||
</a>
|
||||
|
||||
<div className="ml-auto flex gap-x-2">
|
||||
{isHovered && messageId && (
|
||||
<DocumentFeedbackBlock
|
||||
documentId={document.document_id}
|
||||
messageId={messageId}
|
||||
documentRank={documentRank}
|
||||
setPopup={setPopup}
|
||||
/>
|
||||
)}
|
||||
|
||||
{(contentEnriched || additional_relevance) &&
|
||||
relevance_explanation &&
|
||||
(isHovered || alternativeToggled) && (
|
||||
<button
|
||||
onClick={() =>
|
||||
setAlternativeToggled(
|
||||
(alternativeToggled) => !alternativeToggled
|
||||
)
|
||||
}
|
||||
>
|
||||
<CustomTooltip showTick line content="Toggle content">
|
||||
<BookIcon className="text-blue-400" />
|
||||
</CustomTooltip>
|
||||
</button>
|
||||
<div className="ml-auto items-center flex">
|
||||
<TooltipGroup>
|
||||
{isHovered && messageId && (
|
||||
<DocumentFeedbackBlock
|
||||
documentId={document.document_id}
|
||||
messageId={messageId}
|
||||
documentRank={documentRank}
|
||||
setPopup={setPopup}
|
||||
/>
|
||||
)}
|
||||
|
||||
{(contentEnriched || additional_relevance) &&
|
||||
(isHovered || alternativeToggled) && (
|
||||
<button
|
||||
onClick={() =>
|
||||
setAlternativeToggled(
|
||||
(alternativeToggled) => !alternativeToggled
|
||||
)
|
||||
}
|
||||
>
|
||||
<CustomTooltip showTick line content="Toggle content">
|
||||
<BookIcon className="ml-2 my-auto text-blue-400" />
|
||||
</CustomTooltip>
|
||||
</button>
|
||||
)}
|
||||
</TooltipGroup>
|
||||
</div>
|
||||
</div>
|
||||
<div className="mt-1">
|
||||
@@ -367,7 +369,13 @@ export const AgenticDocumentDisplay = ({
|
||||
document.match_highlights,
|
||||
document.blurb
|
||||
)
|
||||
: relevance_explanation}
|
||||
: relevance_explanation || (
|
||||
<span className="flex gap-x-1 items-center">
|
||||
{" "}
|
||||
<WarningCircle />
|
||||
Model failed to produce an analysis of the document
|
||||
</span>
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -579,6 +579,14 @@ export const SearchSection = ({
|
||||
|
||||
const { popup, setPopup } = usePopup();
|
||||
|
||||
const shouldUseAgenticDisplay =
|
||||
agenticResults &&
|
||||
(searchResponse.documents || []).some(
|
||||
(document) =>
|
||||
searchResponse.additional_relevance &&
|
||||
searchResponse.additional_relevance[document.document_id] !== undefined
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="flex relative pr-[8px] h-full text-default">
|
||||
@@ -756,7 +764,9 @@ export const SearchSection = ({
|
||||
contentEnriched={contentEnriched}
|
||||
comments={comments}
|
||||
sweep={sweep}
|
||||
agenticResults={agenticResults && !disabledAgentic}
|
||||
agenticResults={
|
||||
shouldUseAgenticDisplay && !disabledAgentic
|
||||
}
|
||||
performSweep={performSweep}
|
||||
searchResponse={searchResponse}
|
||||
isFetching={isFetching}
|
||||
|
@@ -98,7 +98,7 @@ export const searchRequestStreamed = async ({
|
||||
}
|
||||
previousPartialChunk = partialChunk as string | null;
|
||||
completedChunks.forEach((chunk) => {
|
||||
// check for answer peice / end of answer
|
||||
// check for answer piece / end of answer
|
||||
|
||||
if (Object.hasOwn(chunk, "relevance_summaries")) {
|
||||
const relevanceChunk = chunk as RelevanceChunk;
|
||||
|
Reference in New Issue
Block a user