-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add support for mistral api * update docs to show support for Mistral * add default temp to all providers, suggest different results per provider --------- Co-authored-by: timothycarambat <[email protected]>
- Loading branch information
1 parent
90df375
commit c2c8fe9
Showing
25 changed files
with
412 additions
and
22 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
103 changes: 103 additions & 0 deletions
103
frontend/src/components/LLMSelection/MistralOptions/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,103 @@ | ||
import { useState, useEffect } from "react"; | ||
import System from "@/models/system"; | ||
|
||
export default function MistralOptions({ settings }) { | ||
const [inputValue, setInputValue] = useState(settings?.MistralApiKey); | ||
const [mistralKey, setMistralKey] = useState(settings?.MistralApiKey); | ||
|
||
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"> | ||
Mistral API Key | ||
</label> | ||
<input | ||
type="password" | ||
name="MistralApiKey" | ||
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="Mistral API Key" | ||
defaultValue={settings?.MistralApiKey ? "*".repeat(20) : ""} | ||
required={true} | ||
autoComplete="off" | ||
spellCheck={false} | ||
onChange={(e) => setInputValue(e.target.value)} | ||
onBlur={() => setMistralKey(inputValue)} | ||
/> | ||
</div> | ||
<MistralModelSelection settings={settings} apiKey={mistralKey} /> | ||
</div> | ||
); | ||
} | ||
|
||
function MistralModelSelection({ apiKey, settings }) { | ||
const [customModels, setCustomModels] = useState([]); | ||
const [loading, setLoading] = useState(true); | ||
|
||
useEffect(() => { | ||
async function findCustomModels() { | ||
if (!apiKey) { | ||
setCustomModels([]); | ||
setLoading(false); | ||
return; | ||
} | ||
setLoading(true); | ||
const { models } = await System.customModels( | ||
"mistral", | ||
typeof apiKey === "boolean" ? null : apiKey | ||
); | ||
setCustomModels(models || []); | ||
setLoading(false); | ||
} | ||
findCustomModels(); | ||
}, [apiKey]); | ||
|
||
if (loading || customModels.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="MistralModelPref" | ||
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}> | ||
{!!apiKey | ||
? "-- loading available models --" | ||
: "-- waiting for API key --"} | ||
</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="MistralModelPref" | ||
required={true} | ||
className="bg-zinc-900 border border-gray-500 text-white text-sm rounded-lg block w-full p-2.5" | ||
> | ||
{customModels.length > 0 && ( | ||
<optgroup label="Available Mistral Models"> | ||
{customModels.map((model) => { | ||
return ( | ||
<option | ||
key={model.id} | ||
value={model.id} | ||
selected={settings?.MistralModelPref === model.id} | ||
> | ||
{model.id} | ||
</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
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.