The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
refactor(ui): pick the vector store id placeholder from a map
Yuneng Jiang5d7bf187a413
diff --git a/ui/litellm-dashboard/eslint-suppressions.json b/ui/litellm-dashboard/eslint-suppressions.jsonindex 7de7373b20b..c2bc823ea1f 100644--- a/ui/litellm-dashboard/eslint-suppressions.json+++ b/ui/litellm-dashboard/eslint-suppressions.json@@ -1208,11 +1208,6 @@"count": 1}},- "src/app/(dashboard)/vector-stores/_components/VectorStoreForm.tsx": {- "no-nested-ternary": {- "count": 2- }- },"src/app/(dashboard)/vector-stores/_components/index.tsx": {"local/filename-pascal-case": {"count": 1diff --git a/ui/litellm-dashboard/src/app/(dashboard)/vector-stores/_components/VectorStoreForm.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/vector-stores/_components/VectorStoreForm.test.tsxindex 94aa6cc99a0..84a9314ecce 100644--- a/ui/litellm-dashboard/src/app/(dashboard)/vector-stores/_components/VectorStoreForm.test.tsx+++ b/ui/litellm-dashboard/src/app/(dashboard)/vector-stores/_components/VectorStoreForm.test.tsx@@ -69,6 +69,15 @@ describe("VectorStoreForm", () => {});});+const MONGODB_URI = "mongodb+srv://user:[email protected]";++const MONGODB_REQUIRED_FORM_VALUES = {+ mongodb_connection_string: MONGODB_URI,+ mongodb_database: "sample_mflix",+ mongodb_collection: "embedded_movies",+ embedding_model: "text-embedding-ada-002",+};+describe("buildVectorStoreLitellmParams", () => {it("renames embedding_model to litellm_embedding_model for valkey", () => {const valkeyFormValues = {@@ -111,51 +120,43 @@ describe("buildVectorStoreLitellmParams", () => {});it("renames embedding_model to litellm_embedding_model for mongodb", () => {- const params = buildVectorStoreLitellmParams("mongodb", {- mongodb_connection_string: "mongodb+srv://user:[email protected]",- mongodb_database: "sample_mflix",- mongodb_collection: "embedded_movies",+ const formValues = {+ ...MONGODB_REQUIRED_FORM_VALUES,mongodb_embedding_field: "plot_embedding",mongodb_text_field: "plot",mongodb_num_candidates: "200",- embedding_model: "text-embedding-ada-002",- });-- expect(params).toEqual({- mongodb_connection_string: "mongodb+srv://user:[email protected]",+ };+ const expected = {+ mongodb_connection_string: MONGODB_URI,mongodb_database: "sample_mflix",mongodb_collection: "embedded_movies",mongodb_embedding_field: "plot_embedding",mongodb_text_field: "plot",mongodb_num_candidates: "200",litellm_embedding_model: "text-embedding-ada-002",- });+ };++ expect(buildVectorStoreLitellmParams("mongodb", formValues)).toEqual(expected);});it("sends only mongodb fields when an earlier provider left values in the form", () => {- const params = buildVectorStoreLitellmParams("mongodb", {- mongodb_connection_string: "mongodb+srv://user:[email protected]",- mongodb_database: "sample_mflix",- mongodb_collection: "embedded_movies",- embedding_model: "text-embedding-ada-002",+ const formValues = {+ ...MONGODB_REQUIRED_FORM_VALUES,valkey_host: "left-over-from-valkey.example.com",valkey_port: "6379",aws_region_name: "us-west-2",- });+ };++ const params = buildVectorStoreLitellmParams("mongodb", formValues);expect(params).not.toHaveProperty("valkey_host");expect(params).not.toHaveProperty("valkey_port");expect(params).not.toHaveProperty("aws_region_name");- expect(params.mongodb_connection_string).toBe("mongodb+srv://user:[email protected]");+ expect(params.mongodb_connection_string).toBe(MONGODB_URI);});it("omits a blank mongodb_num_candidates so litellm picks its own candidate count", () => {- const params = buildVectorStoreLitellmParams("mongodb", {- mongodb_connection_string: "mongodb+srv://user:[email protected]",- mongodb_database: "sample_mflix",- mongodb_collection: "embedded_movies",- embedding_model: "text-embedding-ada-002",- });+ const params = buildVectorStoreLitellmParams("mongodb", MONGODB_REQUIRED_FORM_VALUES);expect(params.mongodb_num_candidates).toBeUndefined();expect(JSON.parse(JSON.stringify(params))).not.toHaveProperty("mongodb_num_candidates");diff --git a/ui/litellm-dashboard/src/app/(dashboard)/vector-stores/_components/VectorStoreForm.tsx b/ui/litellm-dashboard/src/app/(dashboard)/vector-stores/_components/VectorStoreForm.tsxindex e25dbe30005..61da25874a5 100644--- a/ui/litellm-dashboard/src/app/(dashboard)/vector-stores/_components/VectorStoreForm.tsx+++ b/ui/litellm-dashboard/src/app/(dashboard)/vector-stores/_components/VectorStoreForm.tsx@@ -138,6 +138,17 @@ const vectorStoreSchema = z.object(vectorStoreShape).superRefine((values, ctx) =type VectorStoreFormValues = z.output<typeof vectorStoreSchema>;+const VECTOR_STORE_ID_PLACEHOLDERS: Record<string, string> = {+ vertex_rag_engine: '6917529027641081856 (corpus ID from Vertex AI / "RAG Engine" console)',+ "vertex_ai/search_api": 'my-datastore_1234567890 (data store ID from Vertex AI / "Agent Search" console)',+ valkey: "my-search-index (FT index name in Valkey)",+ mongodb: "my-vector-index (Atlas Vector Search index name)",+};++const VERTEX_SEARCH_API_WITH_ENGINE_PLACEHOLDER = "Any identifier you'll use to reference this in LiteLLM";++const DEFAULT_VECTOR_STORE_ID_PLACEHOLDER = "Enter vector store ID from your provider";+const EMPTY_VALUES: VectorStoreFormValues = {custom_llm_provider: "bedrock",vector_store_id: "",@@ -268,17 +279,9 @@ const VectorStoreForm: React.FC<VectorStoreFormProps> = ({};const vectorStoreIdPlaceholder =- selectedProvider === "vertex_rag_engine"- ? '6917529027641081856 (corpus ID from Vertex AI / "RAG Engine" console)'- : selectedProvider === "vertex_ai/search_api"- ? vertexEngineId- ? "Any identifier you'll use to reference this in LiteLLM"- : 'my-datastore_1234567890 (data store ID from Vertex AI / "Agent Search" console)'- : selectedProvider === "valkey"- ? "my-search-index (FT index name in Valkey)"- : selectedProvider === "mongodb"- ? "my-vector-index (Atlas Vector Search index name)"- : "Enter vector store ID from your provider";+ selectedProvider === "vertex_ai/search_api" && vertexEngineId+ ? VERTEX_SEARCH_API_WITH_ENGINE_PLACEHOLDER+ : VECTOR_STORE_ID_PLACEHOLDERS[selectedProvider] ?? DEFAULT_VECTOR_STORE_ID_PLACEHOLDER;return (<Dialog open={isVisible} onOpenChange={(open) => !open && handleCancel()}>