-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add Together AI LLM support * update readme to support together ai * Patch togetherAI implementation * add model sorting/option labels by organization for model selection * linting + add data handling for TogetherAI * change truthy statement patch validLLMSelection method --------- Co-authored-by: timothycarambat <[email protected]>
- Loading branch information
1 parent
8cd3a92
commit 1d39b8a
Showing
18 changed files
with
808 additions
and
13 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
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
95 changes: 95 additions & 0 deletions
95
frontend/src/components/LLMSelection/TogetherAiOptions/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,95 @@ | ||
import System from "@/models/system"; | ||
import { useState, useEffect } from "react"; | ||
|
||
export default function TogetherAiOptions({ settings }) { | ||
return ( | ||
<div className="flex gap-x-4"> | ||
<div className="flex flex-col w-60"> | ||
<label className="text-white text-sm font-semibold block mb-4"> | ||
Together AI API Key | ||
</label> | ||
<input | ||
type="password" | ||
name="TogetherAiApiKey" | ||
className="bg-zinc-900 text-white placeholder-white placeholder-opacity-60 text-sm rounded-lg focus:border-white block w-full p-2.5" | ||
placeholder="Together AI API Key" | ||
defaultValue={settings?.TogetherAiApiKey ? "*".repeat(20) : ""} | ||
required={true} | ||
autoComplete="off" | ||
spellCheck={false} | ||
/> | ||
</div> | ||
<TogetherAiModelSelection settings={settings} /> | ||
</div> | ||
); | ||
} | ||
function TogetherAiModelSelection({ settings }) { | ||
const [groupedModels, setGroupedModels] = useState({}); | ||
const [loading, setLoading] = useState(true); | ||
|
||
useEffect(() => { | ||
async function findCustomModels() { | ||
setLoading(true); | ||
const { models } = await System.customModels("togetherai"); | ||
|
||
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-4"> | ||
Chat Model Selection | ||
</label> | ||
<select | ||
name="TogetherAiModelPref" | ||
disabled={true} | ||
className="bg-zinc-900 border 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-4"> | ||
Chat Model Selection | ||
</label> | ||
<select | ||
name="TogetherAiModelPref" | ||
required={true} | ||
className="bg-zinc-900 border border-gray-500 text-white text-sm rounded-lg block w-full p-2.5" | ||
> | ||
{Object.entries(groupedModels).map(([organization, models]) => ( | ||
<optgroup key={organization} label={organization}> | ||
{models.map((model) => ( | ||
<option | ||
key={model.id} | ||
value={model.id} | ||
selected={settings.TogetherAiModelPref === model.id} | ||
> | ||
{model.name} | ||
</option> | ||
))} | ||
</optgroup> | ||
))} | ||
</select> | ||
</div> | ||
); | ||
} |
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
Oops, something went wrong.