🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
import { type ScoreDomain } from "@langfuse/shared";
import { type WithStringifiedMetadata } from "@/src/utils/clientSideDomainTypes";
import {
AnnotationFormContent,
usePreparedAnnotationFormTarget,
} from "@/src/features/scores/components/AnnotationForm";
import { Skeleton } from "@/src/components/ui/skeleton";
import { prepareCombinedAnnotationTargets } from "@/src/features/scores/lib/prepareAnnotationFormData";
import { type AnnotationRefreshHandle } from "../types";
interface DualAnnotationContentProps {
projectId: string;
isV4: boolean;
traceId: string;
observationId: string;
traceEnvironment: string;
observationEnvironment: string;
observationScores: WithStringifiedMetadata<ScoreDomain>[];
traceScores: WithStringifiedMetadata<ScoreDomain>[];
actionButtons?: React.ReactNode;
isActive?: boolean;
refreshRef?: React.Ref<AnnotationRefreshHandle>;
}
export function DualAnnotationContent({
projectId,
isV4,
traceId,
observationId,
traceEnvironment,
observationEnvironment,
observationScores,
traceScores,
actionButtons,
isActive = true,
refreshRef,
}: DualAnnotationContentProps) {
const observation = usePreparedAnnotationFormTarget({
serverScores: observationScores,
scoreTarget: { type: "trace", traceId, observationId },
scoreMetadata: { projectId, environment: observationEnvironment },
analyticsData: { type: "trace", source: "TraceDetail", isV4 },
});
const trace = usePreparedAnnotationFormTarget({
serverScores: traceScores,
scoreTarget: { type: "trace", traceId },
scoreMetadata: { projectId, environment: traceEnvironment },
analyticsData: { type: "trace", source: "TraceDetail", isV4 },
});
return (
<div className="flex max-h-[95vh] flex-col overflow-y-auto">
{observation.isLoading || trace.isLoading ? (
<Skeleton className="h-full w-full" />
) : (
<AnnotationFormContent
key={JSON.stringify([observation.target.key, trace.target.key])}
targets={prepareCombinedAnnotationTargets([
observation.target,
trace.target,
])}
actionButtons={actionButtons}
isActive={isActive}
refreshRef={refreshRef}
/>
)}
</div>
);
}