Added support for google vector search - (matching engine) (#2177)

This commit is contained in:
anchit-nishant
2025-03-05 11:45:47 +05:30
committed by GitHub
parent 7c8628eadc
commit 23dbce4f59
10 changed files with 1382 additions and 269 deletions

View File

@@ -0,0 +1,29 @@
from typing import Optional
from pydantic import BaseModel, Field
class GoogleMatchingEngineConfig(BaseModel):
project_id: str = Field(description="Google Cloud project ID")
project_number: str = Field(description="Google Cloud project number")
region: str = Field(description="Google Cloud region")
endpoint_id: str = Field(description="Vertex AI Vector Search endpoint ID")
index_id: str = Field(description="Vertex AI Vector Search index ID")
deployment_index_id: str = Field(description="Deployment-specific index ID")
collection_name: Optional[str] = Field(None, description="Collection name, defaults to index_id")
credentials_path: Optional[str] = Field(None, description="Path to service account credentials file")
vector_search_api_endpoint: Optional[str] = Field(None, description="Vector search API endpoint")
model_config = {
"extra": "forbid"
}
def __init__(self, **kwargs):
super().__init__(**kwargs)
if not self.collection_name:
self.collection_name = self.index_id
def model_post_init(self, _context) -> None:
"""Set collection_name to index_id if not provided"""
if self.collection_name is None:
self.collection_name = self.index_id