-
Notifications
You must be signed in to change notification settings - Fork 324
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[OPIK-711]: playground Anthropic integration (#1098)
* [OPIK-711] [OPIK-712]: add integrations to gemini and anthropic on the FE; * [OPIK-711] [OPIK-712]: support the last picked model; * [OPIK-711] [OPIK-712]: eslint issues; * [OPIK-711] [OPIK-712]: rename models; * [NA]: remove gemini; --------- Co-authored-by: Sasha <[email protected]>
- Loading branch information
Showing
14 changed files
with
274 additions
and
42 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
64 changes: 64 additions & 0 deletions
64
...components/pages-shared/llm/PromptModelSettings/providerConfigs/AnthropicModelConfigs.tsx
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,64 @@ | ||
import React from "react"; | ||
|
||
import SliderInputControl from "@/components/shared/SliderInputControl/SliderInputControl"; | ||
import { LLMAnthropicConfigsType } from "@/types/providers"; | ||
import { DEFAULT_ANTHROPIC_CONFIGS } from "@/constants/llm"; | ||
import PromptModelConfigsTooltipContent from "@/components/pages-shared/llm/PromptModelSettings/providerConfigs/PromptModelConfigsTooltipContent"; | ||
|
||
interface AnthropicModelConfigsProps { | ||
configs: LLMAnthropicConfigsType; | ||
onChange: (configs: Partial<LLMAnthropicConfigsType>) => void; | ||
} | ||
|
||
const AnthropicModelConfigs = ({ | ||
configs, | ||
onChange, | ||
}: AnthropicModelConfigsProps) => { | ||
return ( | ||
<div className="flex w-72 flex-col gap-6"> | ||
<SliderInputControl | ||
value={configs.temperature} | ||
onChange={(v) => onChange({ temperature: v })} | ||
id="temperature" | ||
min={0} | ||
max={1} | ||
step={0.01} | ||
defaultValue={DEFAULT_ANTHROPIC_CONFIGS.TEMPERATURE} | ||
label="Temperature" | ||
tooltip={ | ||
<PromptModelConfigsTooltipContent text="Controls randomness: Lowering results in less random completions. As the temperature approaches zero, the model will become deterministic and repetitive." /> | ||
} | ||
/> | ||
|
||
<SliderInputControl | ||
value={configs.maxCompletionTokens} | ||
onChange={(v) => onChange({ maxCompletionTokens: v })} | ||
id="maxCompletionTokens" | ||
min={0} | ||
max={10000} | ||
step={1} | ||
defaultValue={DEFAULT_ANTHROPIC_CONFIGS.MAX_COMPLETION_TOKENS} | ||
label="Max output tokens" | ||
tooltip={ | ||
<PromptModelConfigsTooltipContent text="The maximum number of tokens to generate shared between the prompt and completion. The exact limit varies by model. (One token is roughly 4 characters for standard English text)." /> | ||
} | ||
/> | ||
|
||
<SliderInputControl | ||
value={configs.topP} | ||
onChange={(v) => onChange({ topP: v })} | ||
id="topP" | ||
min={0} | ||
max={1} | ||
step={0.01} | ||
defaultValue={DEFAULT_ANTHROPIC_CONFIGS.TOP_P} | ||
label="Top P" | ||
tooltip={ | ||
<PromptModelConfigsTooltipContent text="Controls diversity via nucleus sampling: 0.5 means half of all likelihood-weighted options are considered" /> | ||
} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default AnthropicModelConfigs; |
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
15 changes: 15 additions & 0 deletions
15
...pik-frontend/src/components/pages/PlaygroundPage/PlaygroundPrompts/useLastPickedModel.tsx
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,15 @@ | ||
import useLocalStorageState from "use-local-storage-state"; | ||
import { PROVIDER_MODEL_TYPE } from "@/types/providers"; | ||
|
||
const PLAYGROUND_LAST_PICKED_MODEL = "playground-last-picked-model"; | ||
|
||
const useLastPickedModel = () => { | ||
return useLocalStorageState<PROVIDER_MODEL_TYPE | "">( | ||
PLAYGROUND_LAST_PICKED_MODEL, | ||
{ | ||
defaultValue: "", | ||
}, | ||
); | ||
}; | ||
|
||
export default useLastPickedModel; |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.