Compare commits
3 Commits
show-heade
...
empty-scen
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
03a8d094fc | ||
|
|
2b990622f5 | ||
|
|
d079eba557 |
@@ -8,7 +8,7 @@ import {
|
|||||||
useHandledAsyncCallback,
|
useHandledAsyncCallback,
|
||||||
useVisibleScenarioIds,
|
useVisibleScenarioIds,
|
||||||
} from "~/utils/hooks";
|
} from "~/utils/hooks";
|
||||||
import { cellPadding } from "./constants";
|
import { cellPadding } from "../constants";
|
||||||
import { ActionButton } from "./ScenariosHeader";
|
import { ActionButton } from "./ScenariosHeader";
|
||||||
|
|
||||||
export default function AddVariantButton() {
|
export default function AddVariantButton() {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import {
|
|||||||
VStack,
|
VStack,
|
||||||
} from "@chakra-ui/react";
|
} from "@chakra-ui/react";
|
||||||
import { BsArrowsAngleExpand, BsX } from "react-icons/bs";
|
import { BsArrowsAngleExpand, BsX } from "react-icons/bs";
|
||||||
import { cellPadding } from "./constants";
|
import { cellPadding } from "../constants";
|
||||||
import { FloatingLabelInput } from "./FloatingLabelInput";
|
import { FloatingLabelInput } from "./FloatingLabelInput";
|
||||||
import { ScenarioEditorModal } from "./ScenarioEditorModal";
|
import { ScenarioEditorModal } from "./ScenarioEditorModal";
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import {
|
|||||||
IconButton,
|
IconButton,
|
||||||
Spinner,
|
Spinner,
|
||||||
} from "@chakra-ui/react";
|
} from "@chakra-ui/react";
|
||||||
import { cellPadding } from "./constants";
|
import { cellPadding } from "../constants";
|
||||||
import {
|
import {
|
||||||
useExperiment,
|
useExperiment,
|
||||||
useExperimentAccess,
|
useExperimentAccess,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { HStack, Icon, Text, useToken } from "@chakra-ui/react";
|
import { HStack, Icon, Text, useToken } from "@chakra-ui/react";
|
||||||
import { type PromptVariant } from "./types";
|
import { type PromptVariant } from "./types";
|
||||||
import { cellPadding } from "./constants";
|
import { cellPadding } from "../constants";
|
||||||
import { api } from "~/utils/api";
|
import { api } from "~/utils/api";
|
||||||
import chroma from "chroma-js";
|
import chroma from "chroma-js";
|
||||||
import { BsCurrencyDollar } from "react-icons/bs";
|
import { BsCurrencyDollar } from "react-icons/bs";
|
||||||
|
|||||||
@@ -3,14 +3,13 @@ import { api } from "~/utils/api";
|
|||||||
import AddVariantButton from "./AddVariantButton";
|
import AddVariantButton from "./AddVariantButton";
|
||||||
import ScenarioRow from "./ScenarioRow";
|
import ScenarioRow from "./ScenarioRow";
|
||||||
import VariantEditor from "./VariantEditor";
|
import VariantEditor from "./VariantEditor";
|
||||||
import VariantHeader from "./VariantHeader/VariantHeader";
|
import VariantHeader from "../VariantHeader/VariantHeader";
|
||||||
import VariantStats from "./VariantStats";
|
import VariantStats from "./VariantStats";
|
||||||
import { ScenariosHeader } from "./ScenariosHeader";
|
import { ScenariosHeader } from "./ScenariosHeader";
|
||||||
import { borders } from "./styles";
|
import { borders } from "./styles";
|
||||||
import { useScenarios } from "~/utils/hooks";
|
import { useScenarios } from "~/utils/hooks";
|
||||||
import ScenarioPaginator from "./ScenarioPaginator";
|
import ScenarioPaginator from "./ScenarioPaginator";
|
||||||
import { Fragment } from "react";
|
import { Fragment } from "react";
|
||||||
import useScrolledPast from "./useHasScrolledPast";
|
|
||||||
|
|
||||||
export default function OutputsTable({ experimentId }: { experimentId: string | undefined }) {
|
export default function OutputsTable({ experimentId }: { experimentId: string | undefined }) {
|
||||||
const variants = api.promptVariants.list.useQuery(
|
const variants = api.promptVariants.list.useQuery(
|
||||||
@@ -19,7 +18,6 @@ export default function OutputsTable({ experimentId }: { experimentId: string |
|
|||||||
);
|
);
|
||||||
|
|
||||||
const scenarios = useScenarios();
|
const scenarios = useScenarios();
|
||||||
const shouldFlattenHeader = useScrolledPast(50);
|
|
||||||
|
|
||||||
if (!variants.data || !scenarios.data) return null;
|
if (!variants.data || !scenarios.data) return null;
|
||||||
|
|
||||||
@@ -65,8 +63,8 @@ export default function OutputsTable({ experimentId }: { experimentId: string |
|
|||||||
variant={variant}
|
variant={variant}
|
||||||
canHide={variants.data.length > 1}
|
canHide={variants.data.length > 1}
|
||||||
rowStart={1}
|
rowStart={1}
|
||||||
borderTopLeftRadius={isFirst && !shouldFlattenHeader ? 8 : 0}
|
borderTopLeftRadius={isFirst ? 8 : 0}
|
||||||
borderTopRightRadius={isLast && !shouldFlattenHeader ? 8 : 0}
|
borderTopRightRadius={isLast ? 8 : 0}
|
||||||
{...sharedProps}
|
{...sharedProps}
|
||||||
/>
|
/>
|
||||||
<GridItem rowStart={2} {...sharedProps}>
|
<GridItem rowStart={2} {...sharedProps}>
|
||||||
|
|||||||
@@ -1,34 +0,0 @@
|
|||||||
import { useState, useEffect } from "react";
|
|
||||||
|
|
||||||
const useScrolledPast = (scrollThreshold: number) => {
|
|
||||||
const [hasScrolledPast, setHasScrolledPast] = useState(true);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const container = document.getElementById("output-container");
|
|
||||||
|
|
||||||
if (!container) {
|
|
||||||
console.warn('Element with id "outputs-container" not found.');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const checkScroll = () => {
|
|
||||||
const { scrollTop } = container;
|
|
||||||
|
|
||||||
// Check if scrollTop is greater than or equal to scrollThreshold
|
|
||||||
setHasScrolledPast(scrollTop > scrollThreshold);
|
|
||||||
};
|
|
||||||
|
|
||||||
checkScroll();
|
|
||||||
|
|
||||||
container.addEventListener("scroll", checkScroll);
|
|
||||||
|
|
||||||
// Cleanup
|
|
||||||
return () => {
|
|
||||||
container.removeEventListener("scroll", checkScroll);
|
|
||||||
};
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return hasScrolledPast;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default useScrolledPast;
|
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
import { useState, type DragEvent } from "react";
|
import { useState, type DragEvent } from "react";
|
||||||
import { type PromptVariant } from "../types";
|
import { type PromptVariant } from "../OutputsTable/types";
|
||||||
import { api } from "~/utils/api";
|
import { api } from "~/utils/api";
|
||||||
import { RiDraggable } from "react-icons/ri";
|
import { RiDraggable } from "react-icons/ri";
|
||||||
import { useExperimentAccess, useHandledAsyncCallback } from "~/utils/hooks";
|
import { useExperimentAccess, useHandledAsyncCallback } from "~/utils/hooks";
|
||||||
import { HStack, Icon, Text, GridItem, type GridItemProps } from "@chakra-ui/react"; // Changed here
|
import { HStack, Icon, Text, GridItem, type GridItemProps } from "@chakra-ui/react"; // Changed here
|
||||||
import { cellPadding, headerMinHeight } from "../constants";
|
import { cellPadding, headerMinHeight } from "../constants";
|
||||||
import AutoResizeTextArea from "../../AutoResizeTextArea";
|
import AutoResizeTextArea from "../AutoResizeTextArea";
|
||||||
import VariantHeaderMenuButton from "./VariantHeaderMenuButton";
|
import VariantHeaderMenuButton from "./VariantHeaderMenuButton";
|
||||||
|
|
||||||
export default function VariantHeader(
|
export default function VariantHeader(
|
||||||
@@ -75,7 +75,7 @@ export default function VariantHeader(
|
|||||||
padding={0}
|
padding={0}
|
||||||
sx={{
|
sx={{
|
||||||
position: "sticky",
|
position: "sticky",
|
||||||
top: "0",
|
top: "-2",
|
||||||
// Ensure that the menu always appears above the sticky header of other variants
|
// Ensure that the menu always appears above the sticky header of other variants
|
||||||
zIndex: menuOpen ? "dropdown" : 10,
|
zIndex: menuOpen ? "dropdown" : 10,
|
||||||
}}
|
}}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
import { useState } from "react";
|
import { type PromptVariant } from "../OutputsTable/types";
|
||||||
|
import { api } from "~/utils/api";
|
||||||
|
import { useHandledAsyncCallback, useVisibleScenarioIds } from "~/utils/hooks";
|
||||||
import {
|
import {
|
||||||
Icon,
|
Icon,
|
||||||
Menu,
|
Menu,
|
||||||
@@ -12,13 +14,10 @@ import {
|
|||||||
} from "@chakra-ui/react";
|
} from "@chakra-ui/react";
|
||||||
import { BsFillTrashFill, BsGear, BsStars } from "react-icons/bs";
|
import { BsFillTrashFill, BsGear, BsStars } from "react-icons/bs";
|
||||||
import { FaRegClone } from "react-icons/fa";
|
import { FaRegClone } from "react-icons/fa";
|
||||||
|
import { useState } from "react";
|
||||||
|
import { RefinePromptModal } from "../RefinePromptModal/RefinePromptModal";
|
||||||
import { RiExchangeFundsFill } from "react-icons/ri";
|
import { RiExchangeFundsFill } from "react-icons/ri";
|
||||||
|
import { ChangeModelModal } from "../ChangeModelModal/ChangeModelModal";
|
||||||
import { api } from "~/utils/api";
|
|
||||||
import { useHandledAsyncCallback, useVisibleScenarioIds } from "~/utils/hooks";
|
|
||||||
import { type PromptVariant } from "../types";
|
|
||||||
import { RefinePromptModal } from "../../RefinePromptModal/RefinePromptModal";
|
|
||||||
import { ChangeModelModal } from "../../ChangeModelModal/ChangeModelModal";
|
|
||||||
|
|
||||||
export default function VariantHeaderMenuButton({
|
export default function VariantHeaderMenuButton({
|
||||||
variant,
|
variant,
|
||||||
@@ -67,13 +67,7 @@ export default function ProjectMenu() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<VStack
|
<VStack w="full" alignItems="flex-start" spacing={0} py={1}>
|
||||||
w="full"
|
|
||||||
alignItems="flex-start"
|
|
||||||
spacing={0}
|
|
||||||
py={1}
|
|
||||||
zIndex={popover.isOpen ? "dropdown" : undefined}
|
|
||||||
>
|
|
||||||
<Popover
|
<Popover
|
||||||
placement="bottom"
|
placement="bottom"
|
||||||
isOpen={popover.isOpen}
|
isOpen={popover.isOpen}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import {
|
|||||||
// templateSystemUserAssistantPrompt,
|
// templateSystemUserAssistantPrompt,
|
||||||
templateInstructionInputResponsePrompt,
|
templateInstructionInputResponsePrompt,
|
||||||
templateAiroborosPrompt,
|
templateAiroborosPrompt,
|
||||||
templateGryphePrompt,
|
|
||||||
templateVicunaPrompt,
|
templateVicunaPrompt,
|
||||||
} from "./templatePrompt";
|
} from "./templatePrompt";
|
||||||
|
|
||||||
@@ -70,15 +69,6 @@ const frontendModelProvider: FrontendModelProvider<SupportedModel, OpenpipeChatO
|
|||||||
learnMoreUrl: "https://huggingface.co/lmsys/vicuna-13b-v1.5",
|
learnMoreUrl: "https://huggingface.co/lmsys/vicuna-13b-v1.5",
|
||||||
templatePrompt: templateVicunaPrompt,
|
templatePrompt: templateVicunaPrompt,
|
||||||
},
|
},
|
||||||
"Gryphe/MythoMax-L2-13b": {
|
|
||||||
name: "MythoMax-L2-13b",
|
|
||||||
contextWindow: 4096,
|
|
||||||
pricePerSecond: 0.0003,
|
|
||||||
speed: "medium",
|
|
||||||
provider: "openpipe/Chat",
|
|
||||||
learnMoreUrl: "https://huggingface.co/Gryphe/MythoMax-L2-13b",
|
|
||||||
templatePrompt: templateGryphePrompt,
|
|
||||||
},
|
|
||||||
"NousResearch/Nous-Hermes-llama-2-7b": {
|
"NousResearch/Nous-Hermes-llama-2-7b": {
|
||||||
name: "Nous-Hermes-llama-2-7b",
|
name: "Nous-Hermes-llama-2-7b",
|
||||||
contextWindow: 4096,
|
contextWindow: 4096,
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ const modelEndpoints: Record<OpenpipeChatInput["model"], string> = {
|
|||||||
"NousResearch/Nous-Hermes-Llama2-13b": "https://ncv8pw3u0vb8j2-8000.proxy.runpod.net/v1",
|
"NousResearch/Nous-Hermes-Llama2-13b": "https://ncv8pw3u0vb8j2-8000.proxy.runpod.net/v1",
|
||||||
"jondurbin/airoboros-l2-13b-gpt4-2.0": "https://9nrbx7oph4btou-8000.proxy.runpod.net/v1",
|
"jondurbin/airoboros-l2-13b-gpt4-2.0": "https://9nrbx7oph4btou-8000.proxy.runpod.net/v1",
|
||||||
"lmsys/vicuna-13b-v1.5": "https://h88hkt3ux73rb7-8000.proxy.runpod.net/v1",
|
"lmsys/vicuna-13b-v1.5": "https://h88hkt3ux73rb7-8000.proxy.runpod.net/v1",
|
||||||
"Gryphe/MythoMax-L2-13b": "https://3l5jvhnxdgky3v-8000.proxy.runpod.net/v1",
|
|
||||||
"NousResearch/Nous-Hermes-llama-2-7b": "https://ua1bpc6kv3dgge-8000.proxy.runpod.net/v1",
|
"NousResearch/Nous-Hermes-llama-2-7b": "https://ua1bpc6kv3dgge-8000.proxy.runpod.net/v1",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ const supportedModels = [
|
|||||||
"NousResearch/Nous-Hermes-Llama2-13b",
|
"NousResearch/Nous-Hermes-Llama2-13b",
|
||||||
"jondurbin/airoboros-l2-13b-gpt4-2.0",
|
"jondurbin/airoboros-l2-13b-gpt4-2.0",
|
||||||
"lmsys/vicuna-13b-v1.5",
|
"lmsys/vicuna-13b-v1.5",
|
||||||
"Gryphe/MythoMax-L2-13b",
|
|
||||||
"NousResearch/Nous-Hermes-llama-2-7b",
|
"NousResearch/Nous-Hermes-llama-2-7b",
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
"NousResearch/Nous-Hermes-Llama2-13b",
|
"NousResearch/Nous-Hermes-Llama2-13b",
|
||||||
"jondurbin/airoboros-l2-13b-gpt4-2.0",
|
"jondurbin/airoboros-l2-13b-gpt4-2.0",
|
||||||
"lmsys/vicuna-13b-v1.5",
|
"lmsys/vicuna-13b-v1.5",
|
||||||
"Gryphe/MythoMax-L2-13b",
|
|
||||||
"NousResearch/Nous-Hermes-llama-2-7b"
|
"NousResearch/Nous-Hermes-llama-2-7b"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -223,52 +223,3 @@ export const templateVicunaPrompt = (messages: OpenpipeChatInput["messages"]) =>
|
|||||||
|
|
||||||
return prompt.trim();
|
return prompt.trim();
|
||||||
};
|
};
|
||||||
|
|
||||||
// <System prompt/Character Card>
|
|
||||||
|
|
||||||
// ### Instruction:
|
|
||||||
// Your instruction or question here.
|
|
||||||
// For roleplay purposes, I suggest the following - Write <CHAR NAME>'s next reply in a chat between <YOUR NAME> and <CHAR NAME>. Write a single reply only.
|
|
||||||
|
|
||||||
// ### Response:
|
|
||||||
export const templateGryphePrompt = (messages: OpenpipeChatInput["messages"]) => {
|
|
||||||
const splitter = "\n\n";
|
|
||||||
|
|
||||||
const instructionTag = "### Instruction:\n";
|
|
||||||
const responseTag = "### Response:\n";
|
|
||||||
|
|
||||||
let combinedSystemMessage = "";
|
|
||||||
const conversationMessages = [];
|
|
||||||
|
|
||||||
for (const message of messages) {
|
|
||||||
if (message.role === "system") {
|
|
||||||
combinedSystemMessage += message.content;
|
|
||||||
} else if (message.role === "user") {
|
|
||||||
conversationMessages.push(instructionTag + message.content);
|
|
||||||
} else {
|
|
||||||
conversationMessages.push(responseTag + message.content);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let systemMessage = "";
|
|
||||||
|
|
||||||
if (combinedSystemMessage) {
|
|
||||||
// If there is no user message, add a user tag to the system message
|
|
||||||
if (conversationMessages.find((message) => message.startsWith(instructionTag))) {
|
|
||||||
systemMessage = `${combinedSystemMessage}\n\n`;
|
|
||||||
} else {
|
|
||||||
conversationMessages.unshift(instructionTag + combinedSystemMessage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let prompt = `${systemMessage}${conversationMessages.join(splitter)}`;
|
|
||||||
|
|
||||||
// Ensure that the prompt ends with an assistant message
|
|
||||||
const lastInstructionIndex = prompt.lastIndexOf(instructionTag);
|
|
||||||
const lastAssistantIndex = prompt.lastIndexOf(responseTag);
|
|
||||||
if (lastInstructionIndex > lastAssistantIndex) {
|
|
||||||
prompt += splitter + responseTag;
|
|
||||||
}
|
|
||||||
|
|
||||||
return prompt;
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ export default function Experiment() {
|
|||||||
<ExperimentHeaderButtons />
|
<ExperimentHeaderButtons />
|
||||||
</PageHeaderContainer>
|
</PageHeaderContainer>
|
||||||
<ExperimentSettingsDrawer />
|
<ExperimentSettingsDrawer />
|
||||||
<Box w="100%" overflowX="auto" flex={1} id="output-container">
|
<Box w="100%" overflowX="auto" flex={1}>
|
||||||
<OutputsTable experimentId={experiment.data?.id} />
|
<OutputsTable experimentId={experiment.data?.id} />
|
||||||
</Box>
|
</Box>
|
||||||
</VStack>
|
</VStack>
|
||||||
|
|||||||
Reference in New Issue
Block a user