-
Notifications
You must be signed in to change notification settings - Fork 0
privatemode ai for ac #80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
79 changes: 79 additions & 0 deletions
79
src/components/projects/projectId/attributes/attributeId/LLM/models/PrivatemodeAi.tsx
This file contains hidden or 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,79 @@ | ||
| import { useEffect } from "react"; | ||
| import KernDropdown from "@/submodules/react-components/components/KernDropdown"; | ||
| import { InfoButton } from "@/submodules/react-components/components/InfoButton"; | ||
| import { InputWithSlider } from "@/submodules/react-components/components/InputWithSlider"; | ||
| import { LLmPropsPrivatemodeAI } from "../types"; | ||
|
|
||
|
|
||
| export const MODEL_MAP_FULL_NAME = { | ||
| 'Meta-Llama-3.3-70B': "ibnzterrell/Meta-Llama-3.3-70B-Instruct-AWQ-INT4", | ||
| 'gemma-3-27b': "leon-se/gemma-3-27b-it-fp8-dynamic", | ||
| } | ||
| const REVERSE_MAP_FULL_NAME = Object.fromEntries(Object.entries(MODEL_MAP_FULL_NAME).map(([key, value]) => [value, key])); | ||
| export const MODEL_OPTIONS = Object.keys(MODEL_MAP_FULL_NAME); | ||
| const MODEL_MAP_FULL_NAME_OPTIONS = Object.keys(REVERSE_MAP_FULL_NAME); | ||
| export default function PrivatemodeAi(props: LLmPropsPrivatemodeAI) { | ||
| useEffect(() => { | ||
| if (props.llmConfig.model && !MODEL_MAP_FULL_NAME_OPTIONS.includes(props.llmConfig.model)) { | ||
| props.setLlmConfig({ ...props.llmConfig, model: MODEL_MAP_FULL_NAME[MODEL_OPTIONS[0]] }) | ||
| } | ||
| }, []); | ||
| return ( | ||
| <div className='flex flex-col'> | ||
| {props.onlyEssential ? | ||
| null : <div className="mb-2 flex items-center"> | ||
| <span className="text-sm font-medium text-gray-900 line-through">API Key </span> | ||
| <InfoButton content="Set in backend" divPosition="right" infoButtonSize="sm" /> | ||
| </div>} | ||
| <div> | ||
| <label className="block mb-2 text-sm font-medium text-gray-900">Model</label> | ||
| <KernDropdown | ||
| buttonName={props.llmConfig.model ? REVERSE_MAP_FULL_NAME[props.llmConfig.model] : 'Select model'} | ||
| options={MODEL_OPTIONS} | ||
| selectedOption={(option) => props.setLlmConfig({ ...props.llmConfig, model: MODEL_MAP_FULL_NAME[option] })} | ||
| disabled={props.disabled} | ||
| /> | ||
| </div> | ||
| {props.onlyEssential ? null : <> | ||
| <InputWithSlider | ||
| label="Temperature" | ||
| value={props.llmConfig.temperature} | ||
| min={0} | ||
| max={2} | ||
| step={0.01} | ||
| onChange={(value) => props.setLlmConfig({ ...props.llmConfig, temperature: value })} | ||
| disabled={props.disabled} | ||
| /> | ||
|
|
||
| <InputWithSlider | ||
| label="Top P" | ||
| value={props.llmConfig.topP} | ||
| min={0} | ||
| max={1} | ||
| step={0.01} | ||
| onChange={(value) => props.setLlmConfig({ ...props.llmConfig, topP: value })} | ||
| disabled={props.disabled} | ||
| /> | ||
| <InputWithSlider | ||
| label='Frequency penalty' | ||
| value={props.llmConfig.frequencyPenalty} | ||
| min={-2} | ||
| max={2} | ||
| step={0.01} | ||
| onChange={(value) => props.setLlmConfig({ ...props.llmConfig, frequencyPenalty: value })} | ||
| disabled={props.disabled} | ||
| /> | ||
| <InputWithSlider | ||
| label='Presence penalty' | ||
| value={props.llmConfig.presencePenalty} | ||
| min={-2} | ||
| max={2} | ||
| step={0.01} | ||
| onChange={(value) => props.setLlmConfig({ ...props.llmConfig, presencePenalty: value })} | ||
| disabled={props.disabled} | ||
| /> | ||
| </>} | ||
|
|
||
| </div> | ||
| ) | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.