Skip to content

Commit

Permalink
feat: hyeprbolic flux
Browse files Browse the repository at this point in the history
  • Loading branch information
transmissions11 committed Jun 11, 2024
1 parent 642fd0b commit c8b27b4
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 33 deletions.
6 changes: 5 additions & 1 deletion src/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,11 @@ function App() {
temperature: temp,
messages: messagesFromLineage(parentNodeLineage, settings),
},
{ apiKey: apiKey!, mode: "raw" }
{
apiKey: apiKey!,
mode: "raw",
apiBase: "https://api.hyperbolic.xyz/v1",
}
);

const DECODER = new TextDecoder();
Expand Down
6 changes: 3 additions & 3 deletions src/components/utils/APIKeyInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ export function APIKeyInput({
return (
<LabeledPasswordInputWithLink
width="80%"
label="OpenAI API Key"
label="Hyperbolic API Key"
linkLabel="Get a key"
placeholder="sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
link="https://platform.openai.com/account/api-keys"
placeholder="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
link="https://app.hyperbolic.xyz/settings"
value={apiKey ?? ""}
setValue={setApiKey}
{...others}
Expand Down
5 changes: 4 additions & 1 deletion src/components/utils/NavigationBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ export function NavigationBar({
width="auto"
>
<Text whiteSpace="nowrap">
<b>Flux</b> by
<b>
<span style={{ color: "#6A5EEB" }}>Hyperbolic</span> Flux
</b>{" "}
by
</Text>

<AvatarGroup ml="4px" size="sm">
Expand Down
2 changes: 1 addition & 1 deletion src/utils/apikey.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export function isValidAPIKey(apiKey: string | null) {
return (apiKey?.length === 51 && apiKey.startsWith("sk-")) || (apiKey?.length === 56 && apiKey.startsWith("sk-proj-"));
return apiKey?.length ?? 0 >= 50; // No idea what Hyperbolic's key spec is, but this is a safe bet.
}
2 changes: 1 addition & 1 deletion src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const DEFAULT_SETTINGS: Settings = {
temp: 1,
n: 3,
autoZoom: true,
model: "gpt-4o",
model: "Qwen/Qwen2-72B-Instruct",
defaultPreamble: `You are a helpful assistant.`,
};

Expand Down
2 changes: 1 addition & 1 deletion src/utils/fluxNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ export function displayNameFromFluxNodeType(
case FluxNodeType.User:
return "User";
case FluxNodeType.GPT:
return isGPT4 === undefined ? "GPT" : isGPT4 ? "GPT-4" : "GPT-3.5";
return "Model";
case FluxNodeType.TweakedGPT:
return displayNameFromFluxNodeType(FluxNodeType.GPT, isGPT4) + " (edited)";
case FluxNodeType.System:
Expand Down
46 changes: 21 additions & 25 deletions src/utils/models.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
export function getAvailableModels(apiKey: string): Promise<string[]> {
return new Promise(async (resolve, reject) => {
try {
const response = await fetch("https://api.openai.com/v1/models", {
method: "GET",
headers: {
Authorization: `Bearer ${apiKey}`,
},
})
const data = await response.json();
resolve(data.data.map((model: any) => model.id).sort());
} catch (err) {
reject(err);
}
});
};
return new Promise(async (resolve, reject) => {
const models = [
"Qwen/Qwen2-72B-Instruct",
// "meta-llama/Meta-Llama-3-70B-Instruct", — N completions is broken, get fragments or no response at all.
// "mistralai/Mixtral-8x22B-Instruct-v0.1", — Keep getting 'network error'
"NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO",
];

resolve(models);
});
}

export function getAvailableChatModels(apiKey: string): Promise<string[]> {
return new Promise((resolve, reject) => {
getAvailableModels(apiKey)
.then((models) => {
resolve(models.filter((model) => model.startsWith("gpt-")));
})
.catch((err) => {
reject(err);
});
});
};
return new Promise((resolve, reject) => {
getAvailableModels(apiKey)
.then((models) => {
resolve(models);
})
.catch((err) => {
reject(err);
});
});
}

0 comments on commit c8b27b4

Please sign in to comment.