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
[Feat] UI Vector Stores - Allow adding Vertex RAG Engine, OpenAI, Azure (#12752)
Ishaan Jaff81eb2fdd30a1
diff --git a/litellm/llms/base_llm/vector_store/transformation.py b/litellm/llms/base_llm/vector_store/transformation.pyindex e2edc75013f..b50fd957587 100644--- a/litellm/llms/base_llm/vector_store/transformation.py+++ b/litellm/llms/base_llm/vector_store/transformation.py@@ -31,6 +31,7 @@ class BaseVectorStoreConfig:vector_store_search_optional_params: VectorStoreSearchOptionalRequestParams,api_base: str,litellm_logging_obj: LiteLLMLoggingObj,+ litellm_params: dict,) -> Tuple[str, Dict]:passdiff --git a/litellm/llms/bedrock/vector_stores/transformation.py b/litellm/llms/bedrock/vector_stores/transformation.pyindex e8a9131e769..c05b6ba3fb1 100644--- a/litellm/llms/bedrock/vector_stores/transformation.py+++ b/litellm/llms/bedrock/vector_stores/transformation.py@@ -60,6 +60,7 @@ class BedrockVectorStoreConfig(BaseVectorStoreConfig, BaseAWSLLM):vector_store_search_optional_params: VectorStoreSearchOptionalRequestParams,api_base: str,litellm_logging_obj: LiteLLMLoggingObj,+ litellm_params: dict,) -> Tuple[str, Dict]:if isinstance(query, list):query = " ".join(query)diff --git a/litellm/llms/custom_httpx/llm_http_handler.py b/litellm/llms/custom_httpx/llm_http_handler.pyindex c623c0dcde5..f77f87507ea 100644--- a/litellm/llms/custom_httpx/llm_http_handler.py+++ b/litellm/llms/custom_httpx/llm_http_handler.py@@ -2700,6 +2700,7 @@ class BaseLLMHTTPHandler:vector_store_search_optional_params=vector_store_search_optional_params,api_base=api_base,litellm_logging_obj=logging_obj,+ litellm_params=dict(litellm_params),))all_optional_params: Dict[str, Any] = dict(litellm_params)@@ -2796,6 +2797,7 @@ class BaseLLMHTTPHandler:vector_store_search_optional_params=vector_store_search_optional_params,api_base=api_base,litellm_logging_obj=logging_obj,+ litellm_params=dict(litellm_params),))diff --git a/litellm/llms/openai/vector_stores/transformation.py b/litellm/llms/openai/vector_stores/transformation.pyindex 8f89f53c639..0e890f0fd51 100644--- a/litellm/llms/openai/vector_stores/transformation.py+++ b/litellm/llms/openai/vector_stores/transformation.py@@ -39,6 +39,7 @@ class OpenAIVectorStoreConfig(BaseVectorStoreConfig):headers.update({"Authorization": f"Bearer {api_key}",+ "Content-Type": "application/json",})@@ -83,6 +84,7 @@ class OpenAIVectorStoreConfig(BaseVectorStoreConfig):vector_store_search_optional_params: VectorStoreSearchOptionalRequestParams,api_base: str,litellm_logging_obj: LiteLLMLoggingObj,+ litellm_params: dict,) -> Tuple[str, Dict]:url = f"{api_base}/{vector_store_id}/search"typed_request_body = VectorStoreSearchRequest(diff --git a/litellm/llms/pg_vector/vector_stores/transformation.py b/litellm/llms/pg_vector/vector_stores/transformation.pyindex 6553a85ad9b..5d10faeba50 100644--- a/litellm/llms/pg_vector/vector_stores/transformation.py+++ b/litellm/llms/pg_vector/vector_stores/transformation.py@@ -81,6 +81,7 @@ class PGVectorStoreConfig(OpenAIVectorStoreConfig):vector_store_search_optional_params: VectorStoreSearchOptionalRequestParams,api_base: str,litellm_logging_obj: LiteLLMLoggingObj,+ litellm_params: dict,) -> Tuple[str, Dict]:url = f"{api_base}/{vector_store_id}/search"_, request_body = super().transform_search_vector_store_request(@@ -89,5 +90,6 @@ class PGVectorStoreConfig(OpenAIVectorStoreConfig):vector_store_search_optional_params=vector_store_search_optional_params,api_base=api_base,litellm_logging_obj=litellm_logging_obj,+ litellm_params=litellm_params,)return url, request_body\ No newline at end of filediff --git a/litellm/llms/vertex_ai/vector_stores/transformation.py b/litellm/llms/vertex_ai/vector_stores/transformation.pyindex ca374728c03..80e76fd71a8 100644--- a/litellm/llms/vertex_ai/vector_stores/transformation.py+++ b/litellm/llms/vertex_ai/vector_stores/transformation.py@@ -42,16 +42,8 @@ class VertexVectorStoreConfig(BaseVectorStoreConfig, VertexBase):litellm_params = litellm_params or GenericLiteLLMParams()# Get credentials and project info- vertex_credentials = (- litellm_params.vertex_credentials- or get_secret_str("VERTEXAI_CREDENTIALS")- or get_secret_str("VERTEX_AI_CREDENTIALS")- )- vertex_project = (- litellm_params.vertex_project- or get_secret_str("VERTEXAI_PROJECT")- or get_secret_str("VERTEX_AI_PROJECT")- )+ vertex_credentials = self.get_vertex_ai_credentials(dict(litellm_params))+ vertex_project = self.get_vertex_ai_project(dict(litellm_params))# Get access token using the base class methodaccess_token, project_id = self._ensure_access_token(@@ -75,17 +67,8 @@ class VertexVectorStoreConfig(BaseVectorStoreConfig, VertexBase):"""Get the Base endpoint for Vertex AI RAG API"""- vertex_location = (- litellm_params.get("vertex_location")- or get_secret_str("VERTEXAI_LOCATION")- or get_secret_str("VERTEX_AI_LOCATION")- or "us-central1"- )- vertex_project = (- litellm_params.get("vertex_project")- or get_secret_str("VERTEXAI_PROJECT")- or get_secret_str("VERTEX_AI_PROJECT")- )+ vertex_location = self.get_vertex_ai_location(litellm_params)+ vertex_project = self.get_vertex_ai_project(litellm_params)if api_base:return api_base.rstrip("/")@@ -100,6 +83,7 @@ class VertexVectorStoreConfig(BaseVectorStoreConfig, VertexBase):vector_store_search_optional_params: VectorStoreSearchOptionalRequestParams,api_base: str,litellm_logging_obj: LiteLLMLoggingObj,+ litellm_params: dict,) -> Tuple[str, Dict[str, Any]]:"""Transform search request for Vertex AI RAG API@@ -111,12 +95,19 @@ class VertexVectorStoreConfig(BaseVectorStoreConfig, VertexBase):# Vertex AI RAG API endpoint for retrieving contextsurl = f"{api_base}:retrieveContexts"+ # Use helper methods to get project and location, then construct full rag corpus path+ vertex_project = self.get_vertex_ai_project(litellm_params)+ vertex_location = self.get_vertex_ai_location(litellm_params)++ # Construct full rag corpus path+ full_rag_corpus = f"projects/{vertex_project}/locations/{vertex_location}/ragCorpora/{vector_store_id}"+# Build the request body for Vertex AI RAG APIrequest_body: Dict[str, Any] = {"vertex_rag_store": {"rag_resources": [{- "rag_corpus": vector_store_id+ "rag_corpus": full_rag_corpus}]},diff --git a/tests/test_litellm/llms/bedrock/vector_stores/test_bedrock_vector_store_transformation.py b/tests/test_litellm/llms/bedrock/vector_stores/test_bedrock_vector_store_transformation.pyindex e924fe83bb8..28b60e5e75f 100644--- a/tests/test_litellm/llms/bedrock/vector_stores/test_bedrock_vector_store_transformation.py+++ b/tests/test_litellm/llms/bedrock/vector_stores/test_bedrock_vector_store_transformation.py@@ -20,6 +20,7 @@ def test_transform_search_request():vector_store_search_optional_params={},api_base="https://bedrock-agent-runtime.us-west-2.amazonaws.com/knowledgebases",litellm_logging_obj=mock_log,+ litellm_params={},)assert url.endswith("/kb123/retrieve")diff --git a/tests/vector_store_tests/test_vertex_ai_vector_store.py b/tests/vector_store_tests/test_vertex_ai_vector_store.pyindex e9dee407917..94371601075 100644--- a/tests/vector_store_tests/test_vertex_ai_vector_store.py+++ b/tests/vector_store_tests/test_vertex_ai_vector_store.py@@ -19,7 +19,7 @@ class TestVertexAIVectorStore(BaseVectorStoreTest):def get_base_request_args(self):return {- "vector_store_id": "projects/reliablekeys/locations/us-central1/ragCorpora/6917529027641081856",+ "vector_store_id": "6917529027641081856","custom_llm_provider": "vertex_ai","vertex_project": "reliablekeys","vertex_location": "us-central1",diff --git a/ui/litellm-dashboard/src/components/vector_store_management/VectorStoreForm.tsx b/ui/litellm-dashboard/src/components/vector_store_management/VectorStoreForm.tsxindex c36cc4ed6cd..99acccf3d3b 100644--- a/ui/litellm-dashboard/src/components/vector_store_management/VectorStoreForm.tsx+++ b/ui/litellm-dashboard/src/components/vector_store_management/VectorStoreForm.tsx@@ -164,6 +164,27 @@ const VectorStoreForm: React.FC<VectorStoreFormProps> = ({/>)}+ {/* Vertex RAG Engine Setup Instructions */}+ {selectedProvider === "vertex_rag_engine" && (+ <Alert+ message="Vertex AI RAG Engine Setup"+ description={+ <div>+ <p>To use Vertex AI RAG Engine:</p>+ <ol style={{ marginLeft: '16px', marginTop: '8px' }}>+ <li>Set up your Vertex AI RAG Engine corpus following the guide: <a href="https://cloud.google.com/vertex-ai/generative-ai/docs/rag-engine/rag-overview" target="_blank" rel="noopener noreferrer">Vertex AI RAG Engine Overview</a></li>+ <li>Create a corpus in your Google Cloud project</li>+ <li>Note the corpus ID from the Vertex AI console</li>+ <li>Enter the corpus ID in the Vector Store ID field below</li>+ </ol>+ </div>+ }+ type="info"+ showIcon+ style={{ marginBottom: '16px' }}+ />+ )}+<Form.Itemlabel={<span>@@ -176,7 +197,13 @@ const VectorStoreForm: React.FC<VectorStoreFormProps> = ({name="vector_store_id"rules={[{ required: true, message: "Please input the vector store ID from your api provider" }]}>- <TextInput />+ <TextInput+ placeholder={+ selectedProvider === "vertex_rag_engine"+ ? "6917529027641081856 (Get corpus ID from Vertex AI console)"+ : "Enter vector store ID from your provider"+ }+ /></Form.Item>{/* Provider-specific fields */}diff --git a/ui/litellm-dashboard/src/components/vector_store_providers.tsx b/ui/litellm-dashboard/src/components/vector_store_providers.tsxindex 9cc97b99478..a188d6fba6f 100644--- a/ui/litellm-dashboard/src/components/vector_store_providers.tsx+++ b/ui/litellm-dashboard/src/components/vector_store_providers.tsx@@ -1,11 +1,17 @@export enum VectorStoreProviders {Bedrock = "Amazon Bedrock",- PgVector = "PostgreSQL pgvector (LiteLLM Connector)"+ PgVector = "PostgreSQL pgvector (LiteLLM Connector)",+ VertexRagEngine = "Vertex AI RAG Engine",+ OpenAI = "OpenAI",+ Azure = "Azure OpenAI"}export const vectorStoreProviderMap: Record<string, string> = {Bedrock: "bedrock",- PgVector: "pg_vector"+ PgVector: "pg_vector",+ VertexRagEngine: "vertex_ai",+ OpenAI: "openai",+ Azure: "azure"};const asset_logos_folder = '/assets/logos/';@@ -13,6 +19,9 @@ const asset_logos_folder = '/assets/logos/';export const vectorStoreProviderLogoMap: Record<string, string> = {[VectorStoreProviders.Bedrock]: `${asset_logos_folder}bedrock.svg`,[VectorStoreProviders.PgVector]: `${asset_logos_folder}postgresql.svg`, // Fallback to a generic database icon if needed+ [VectorStoreProviders.VertexRagEngine]: `${asset_logos_folder}google.svg`,+ [VectorStoreProviders.OpenAI]: `${asset_logos_folder}openai_small.svg`,+ [VectorStoreProviders.Azure]: `${asset_logos_folder}microsoft_azure.svg`,};// Define field types for provider-specific configurations@@ -45,6 +54,35 @@ export const vectorStoreProviderFields: Record<string, VectorStoreFieldConfig[]>required: true,type: "password"}+ ],+ vertex_rag_engine: [],+ openai: [+ {+ name: "api_key",+ label: "API Key",+ tooltip: "Enter your OpenAI API key",+ placeholder: "sk-...",+ required: true,+ type: "password"+ }+ ],+ azure: [+ {+ name: "api_key",+ label: "API Key",+ tooltip: "Enter your Azure OpenAI API key",+ placeholder: "your-azure-api-key",+ required: true,+ type: "password"+ },+ {+ name: "api_base",+ label: "API Base",+ tooltip: "Enter your Azure OpenAI endpoint (e.g., https://your-resource.openai.azure.com/)",+ placeholder: "https://your-resource.openai.azure.com/",+ required: true,+ type: "text"+ }]};