ui - pass extra litellm params

This commit is contained in:
Ishaan Jaff 2024-04-08 13:20:28 -07:00
parent 28e4706bfd
commit 1bb07e54d4

View file

@ -33,6 +33,7 @@ import {
import { Badge, BadgeDelta, Button } from "@tremor/react"; import { Badge, BadgeDelta, Button } from "@tremor/react";
import RequestAccess from "./request_model_access"; import RequestAccess from "./request_model_access";
import { Typography } from "antd"; import { Typography } from "antd";
import TextArea from "antd/es/input/TextArea";
const { Title: Title2, Link } = Typography; const { Title: Title2, Link } = Typography;
@ -183,6 +184,22 @@ const ModelDashboard: React.FC<ModelDashboardProps> = ({
// Add key-value pair to model_info dictionary // Add key-value pair to model_info dictionary
modelInfoObj[key] = value; modelInfoObj[key] = value;
} }
if (key == "litellm_extra_params") {
console.log("litellm_extra_params:", value);
let litellmExtraParams = {};
try {
litellmExtraParams = JSON.parse(value);
}
catch (error) {
message.error("Failed to parse LiteLLM Extra Paras: " + error);
throw new Error("Failed to parse litellm_extra_params: " + error);
}
for (const [key, value] of Object.entries(litellmExtraParams)) {
litellmParamsObj[key] = value;
}
}
} }
const new_model: Model = { const new_model: Model = {
@ -420,6 +437,22 @@ const ModelDashboard: React.FC<ModelDashboardProps> = ({
<TextInput placeholder="us-east-1"/> <TextInput placeholder="us-east-1"/>
</Form.Item> </Form.Item>
} }
<Form.Item label="LiteLLM Params" name="litellm_extra_params" tooltip="Actual model name used for making litellm.completion() call." className="mb-0">
<TextArea
rows={4}
placeholder='{
"rpm": 100,
"timeout": 0,
"stream_timeout": 0
}'
/>
</Form.Item>
<Row>
<Col span={10}></Col>
<Col span={10}><Text className="mb-3 mt-1">Pass JSON of litellm supported params <Link href="https://docs.litellm.ai/docs/completion/input" target="_blank">litellm.completion() call</Link></Text></Col>
</Row>
</> </>
<div style={{ textAlign: "center", marginTop: "10px" }}> <div style={{ textAlign: "center", marginTop: "10px" }}>
<Button2 htmlType="submit">Add Model</Button2> <Button2 htmlType="submit">Add Model</Button2>