({
input,
}: {
input: {
messages: DatasetEntryInput["messages"];
tool_choice?: DatasetEntryInput["tool_choice"];
tools?: DatasetEntryInput["tools"];
};
})
| 4 | import { typedDatasetEntryInput } from "~/types/dbColumns.types"; |
| 5 | |
| 6 | const FormattedInput = ({ |
| 7 | input, |
| 8 | }: { |
| 9 | input: { |
| 10 | messages: DatasetEntryInput["messages"]; |
| 11 | tool_choice?: DatasetEntryInput["tool_choice"]; |
| 12 | tools?: DatasetEntryInput["tools"]; |
| 13 | }; |
| 14 | }) => { |
| 15 | const { messages, tool_choice, tools } = typedDatasetEntryInput(input); |
| 16 | |
| 17 | return ( |
| 18 | <VStack spacing={8} maxW="full"> |
| 19 | {messages.map((message, index) => ( |
| 20 | <VStack key={index} alignItems="flex-start" w="full"> |
| 21 | <Text fontWeight="bold" color="gray.500"> |
| 22 | {message.role} |
| 23 | </Text> |
| 24 | <Text whiteSpace="pre-wrap" maxW="full"> |
| 25 | {typeof message.content === "string" |
| 26 | ? message.content |
| 27 | : JSON.stringify(message.content, null, 2)} |
| 28 | </Text> |
| 29 | </VStack> |
| 30 | ))} |
| 31 | {tool_choice && ( |
| 32 | <VStack alignItems="flex-start" w="full"> |
| 33 | <Text fontWeight="bold" color="gray.500"> |
| 34 | tool_choice |
| 35 | </Text> |
| 36 | <FormattedJson json={tool_choice} copiable={false} borderWidth={0} /> |
| 37 | </VStack> |
| 38 | )} |
| 39 | {tools && ( |
| 40 | <VStack alignItems="flex-start" w="full"> |
| 41 | <Text fontWeight="bold" color="gray.500"> |
| 42 | tools |
| 43 | </Text> |
| 44 | <FormattedJson copiable={false} json={tools} borderWidth={0} /> |
| 45 | </VStack> |
| 46 | )} |
| 47 | </VStack> |
| 48 | ); |
| 49 | }; |
| 50 | |
| 51 | export default FormattedInput; |
nothing calls this directly
no test coverage detected