-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAnthropic.tsx
42 lines (39 loc) · 963 Bytes
/
Anthropic.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 { evaluateAnthropic, STREAMS } from "@/trigger/batch";
import { useRealtimeRunWithStreams } from "@trigger.dev/react-hooks";
import type { RealtimeRun } from "@trigger.dev/sdk/v3";
export default function AnthropicEval({
run,
accessToken,
isSelected,
tag,
}: {
run: RealtimeRun<typeof evaluateAnthropic>;
accessToken: string;
isSelected: boolean;
tag?: string;
}) {
const { streams } = useRealtimeRunWithStreams<
typeof evaluateAnthropic,
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="Anthropic"
value="anthropic"
tag={tag}
/>
);
}