(feat) ui - show user key when creating key

This commit is contained in:
ishaan-jaff 2024-02-12 16:55:34 -08:00
parent 151f75b68f
commit 2bdc5a81ec
2 changed files with 35 additions and 60 deletions

View file

@ -9,60 +9,32 @@ model_list:
mode: chat
max_tokens: 4096
base_model: azure/gpt-4-1106-preview
- model_name: openai-gpt-3.5
litellm_params:
model: gpt-3.5-turbo
api_key: os.environ/OPENAI_API_KEY
- model_name: anthropic-claude-v2.1
litellm_params:
aws_region_name: eu-central-1
model: bedrock/anthropic.claude-v2:1
timeout: 300 # sets a 5 minute timeout
input_cost_per_token: 0.00000800
output_cost_per_token: 0.00002400
- model_name: anthropic-claude-v2
litellm_params:
model: bedrock/anthropic.claude-v2
- model_name: bedrock-cohere
litellm_params:
model: bedrock/cohere.command-text-v14
timeout: 0.0001
- model_name: gpt-4
litellm_params:
model: azure/chatgpt-v-2
api_base: https://openai-gpt-4-test-v-1.openai.azure.com/
api_version: "2023-05-15"
api_key: os.environ/AZURE_API_KEY # The `os.environ/` prefix tells litellm to read this from the env. See https://docs.litellm.ai/docs/simple_proxy#load-api-keys-from-vault
- model_name: gpt-vision
litellm_params:
model: azure/gpt-4-vision
base_url: https://gpt-4-vision-resource.openai.azure.com/openai/deployments/gpt-4-vision/extensions
api_key: os.environ/AZURE_VISION_API_KEY
api_version: "2023-09-01-preview"
dataSources:
- type: AzureComputerVision
parameters:
endpoint: os.environ/AZURE_VISION_ENHANCE_ENDPOINT
key: os.environ/AZURE_VISION_ENHANCE_KEY
- model_name: BEDROCK_GROUP
litellm_params:
model: bedrock/cohere.command-text-v14
timeout: 0.0001
- model_name: tg-ai
litellm_params:
model: together_ai/mistralai/Mistral-7B-Instruct-v0.1
- model_name: sagemaker
litellm_params:
model: sagemaker/berri-benchmarking-Llama-2-70b-chat-hf-4
- model_name: openai-gpt-3.5
litellm_params:
model: gpt-3.5-turbo
api_key: os.environ/OPENAI_API_KEY
model_info:
mode: chat
- model_name: azure-cloudflare
litellm_params:
model: azure/chatgpt-v-2
api_base: https://gateway.ai.cloudflare.com/v1/0399b10e77ac6668c80404a5ff49eb37/litellm-test/azure-openai/openai-gpt-4-test-v-1
api_key: os.environ/AZURE_API_KEY
api_version: "2023-07-01-preview"
- model_name: azure-embedding-model
litellm_params:
model: azure/azure-embedding-model
api_base: os.environ/AZURE_API_BASE
api_key: os.environ/AZURE_API_KEY
api_version: "2023-07-01-preview"
model_info:
mode: embedding
base_model: text-embedding-ada-002
- model_name: text-embedding-ada-002
litellm_params:
model: text-embedding-ada-002
api_key: os.environ/OPENAI_API_KEY
model_info:
mode: embedding
base_model: azure/gpt-4
litellm_settings:
fallbacks: [{"openai-gpt-3.5": ["azure-gpt-3.5"]}]
success_callback: ['langfuse']

View file

@ -14,6 +14,7 @@ interface CreateKeyProps {
userRole: string | null;
accessToken: string;
data: any[] | null;
userModels: string[];
setData: React.Dispatch<React.SetStateAction<any[] | null>>;
}
@ -22,6 +23,7 @@ const CreateKey: React.FC<CreateKeyProps> = ({
userRole,
accessToken,
data,
userModels,
setData,
}) => {
const [form] = Form.useForm();
@ -42,14 +44,6 @@ const CreateKey: React.FC<CreateKeyProps> = ({
const handleCreate = async (formValues: Record<string, any>) => {
try {
message.info("Making API Call");
// Check if "models" exists and is not an empty string
if (formValues.models && formValues.models.trim() !== '') {
// Format the "models" field as an array
formValues.models = formValues.models.split(',').map((model: string) => model.trim());
} else {
// If "models" is undefined or an empty string, set it to an empty array
formValues.models = [];
}
setIsModalVisible(true);
const response = await keyCreateCall(accessToken, userID, formValues);
setData((prevData) => (prevData ? [...prevData, response] : [response])); // Check if prevData is null
@ -90,12 +84,21 @@ const CreateKey: React.FC<CreateKeyProps> = ({
>
<Input placeholder="ai_team" />
</Form.Item>
<Form.Item
label="Models (Comma Separated). Eg: gpt-3.5-turbo,gpt-4"
label="Models"
name="models"
>
<Input placeholder="gpt-4,gpt-3.5-turbo" />
<Select
mode="multiple"
placeholder="Select models"
style={{ width: '100%' }}
>
{userModels.map((model) => (
<Option key={model} value={model}>
{model}
</Option>
))}
</Select>
</Form.Item>