-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2488 novita ai llm integration (#2582)
* feat: add new model provider: Novita AI * feat: finished novita AI * fix: code lint * remove unneeded logging * add back log for novita stream not self closing * Clarify ENV vars for LLM/embedder seperation for future Patch ENV check for workspace/agent provider --------- Co-authored-by: Jason <[email protected]> Co-authored-by: shatfield4 <[email protected]>
- Loading branch information
1 parent
0bb4761
commit 80565d7
Showing
24 changed files
with
748 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,7 @@ | |
"Mintplex", | ||
"mixtral", | ||
"moderations", | ||
"novita", | ||
"numpages", | ||
"Ollama", | ||
"Oobabooga", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
142 changes: 142 additions & 0 deletions
142
frontend/src/components/LLMSelection/NovitaLLMOptions/index.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
import System from "@/models/system"; | ||
import { CaretDown, CaretUp } from "@phosphor-icons/react"; | ||
import { useState, useEffect } from "react"; | ||
|
||
export default function NovitaLLMOptions({ settings }) { | ||
return ( | ||
<div className="flex flex-col gap-y-4 mt-1.5"> | ||
<div className="flex gap-[36px]"> | ||
<div className="flex flex-col w-60"> | ||
<label className="text-white text-sm font-semibold block mb-3"> | ||
Novita API Key | ||
</label> | ||
<input | ||
type="password" | ||
name="NovitaLLMApiKey" | ||
className="bg-zinc-900 text-white placeholder:text-white/20 text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5" | ||
placeholder="Novita API Key" | ||
defaultValue={settings?.NovitaLLMApiKey ? "*".repeat(20) : ""} | ||
required={true} | ||
autoComplete="off" | ||
spellCheck={false} | ||
/> | ||
</div> | ||
{!settings?.credentialsOnly && ( | ||
<NovitaModelSelection settings={settings} /> | ||
)} | ||
</div> | ||
<AdvancedControls settings={settings} /> | ||
</div> | ||
); | ||
} | ||
|
||
function AdvancedControls({ settings }) { | ||
const [showAdvancedControls, setShowAdvancedControls] = useState(false); | ||
|
||
return ( | ||
<div className="flex flex-col gap-y-4"> | ||
<button | ||
type="button" | ||
onClick={() => setShowAdvancedControls(!showAdvancedControls)} | ||
className="text-white hover:text-white/70 flex items-center text-sm" | ||
> | ||
{showAdvancedControls ? "Hide" : "Show"} advanced controls | ||
{showAdvancedControls ? ( | ||
<CaretUp size={14} className="ml-1" /> | ||
) : ( | ||
<CaretDown size={14} className="ml-1" /> | ||
)} | ||
</button> | ||
<div hidden={!showAdvancedControls}> | ||
<div className="flex flex-col w-60"> | ||
<label className="text-white text-sm font-semibold block mb-3"> | ||
Stream Timeout (ms) | ||
</label> | ||
<input | ||
type="number" | ||
name="NovitaLLMTimeout" | ||
className="bg-zinc-900 text-white placeholder:text-white/20 text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5" | ||
placeholder="Timeout value between token responses to auto-timeout the stream" | ||
defaultValue={settings?.NovitaLLMTimeout ?? 500} | ||
autoComplete="off" | ||
onScroll={(e) => e.target.blur()} | ||
min={500} | ||
step={1} | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
function NovitaModelSelection({ settings }) { | ||
const [groupedModels, setGroupedModels] = useState({}); | ||
const [loading, setLoading] = useState(true); | ||
|
||
useEffect(() => { | ||
async function findCustomModels() { | ||
setLoading(true); | ||
const { models } = await System.customModels("novita"); | ||
if (models?.length > 0) { | ||
const modelsByOrganization = models.reduce((acc, model) => { | ||
acc[model.organization] = acc[model.organization] || []; | ||
acc[model.organization].push(model); | ||
return acc; | ||
}, {}); | ||
|
||
setGroupedModels(modelsByOrganization); | ||
} | ||
|
||
setLoading(false); | ||
} | ||
findCustomModels(); | ||
}, []); | ||
|
||
if (loading || Object.keys(groupedModels).length === 0) { | ||
return ( | ||
<div className="flex flex-col w-60"> | ||
<label className="text-white text-sm font-semibold block mb-3"> | ||
Chat Model Selection | ||
</label> | ||
<select | ||
name="NovitaLLMModelPref" | ||
disabled={true} | ||
className="bg-zinc-900 border-gray-500 text-white text-sm rounded-lg block w-full p-2.5" | ||
> | ||
<option disabled={true} selected={true}> | ||
-- loading available models -- | ||
</option> | ||
</select> | ||
</div> | ||
); | ||
} | ||
|
||
return ( | ||
<div className="flex flex-col w-60"> | ||
<label className="text-white text-sm font-semibold block mb-3"> | ||
Chat Model Selection | ||
</label> | ||
<select | ||
name="NovitaLLMModelPref" | ||
required={true} | ||
className="bg-zinc-900 border-gray-500 text-white text-sm rounded-lg block w-full p-2.5" | ||
> | ||
{Object.keys(groupedModels) | ||
.sort() | ||
.map((organization) => ( | ||
<optgroup key={organization} label={organization}> | ||
{groupedModels[organization].map((model) => ( | ||
<option | ||
key={model.id} | ||
value={model.id} | ||
selected={settings?.NovitaLLMModelPref === model.id} | ||
> | ||
{model.name} | ||
</option> | ||
))} | ||
</optgroup> | ||
))} | ||
</select> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ Xenova | |
downloaded/* | ||
!downloaded/.placeholder | ||
openrouter | ||
apipie | ||
apipie | ||
novita |
Oops, something went wrong.