-
Notifications
You must be signed in to change notification settings - Fork 0
/
XAI.tsx
42 lines (39 loc) · 933 Bytes
/
XAI.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
"use client";
import EvalCard from "@/components/EvalCard";
import type { evaluateXAI, STREAMS } from "@/trigger/batch";
import { useRealtimeRunWithStreams } from "@trigger.dev/react-hooks";
import type { RealtimeRun } from "@trigger.dev/sdk/v3";
export default function XAIEval({
run,
accessToken,
isSelected,
tag,
}: {
run: RealtimeRun<typeof evaluateXAI>;
accessToken: string;
isSelected: boolean;
tag?: string;
}) {
const { streams } = useRealtimeRunWithStreams<typeof evaluateXAI, STREAMS>(
run.id,
{
accessToken,
baseURL: process.env.NEXT_PUBLIC_TRIGGER_API_URL,
}
);
const response =
streams.llm
?.filter((part) => part.type === "text-delta")
.map((part) => part.textDelta)
.join("") ?? "";
return (
<EvalCard
id={run.id}
response={response}
isSelected={isSelected}
name="XAI"
value="xai"
tag={tag}
/>
);
}