Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding property to private_service_connect_ip_address to endpoint VectorSearchVectorStore #203

Merged
merged 16 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ def from_components( # Implemented in order to keep the current API
gcs_bucket_name: str,
index_id: str,
endpoint_id: str,
private_service_connect_ip_address: Optional[str] = None,
credentials_path: Optional[str] = None,
embedding: Optional[Embeddings] = None,
stream_update: bool = False,
Expand All @@ -282,6 +283,8 @@ def from_components( # Implemented in order to keep the current API
order for the index to be created.
index_id: The id of the created index.
endpoint_id: The id of the created endpoint.
private_service_connect_ip_address: The IP address of the private
service connect instance.
credentials_path: (Optional) The path of the Google credentials on
the local file system.
embedding: The :class:`Embeddings` that will be used for
Expand All @@ -301,6 +304,11 @@ def from_components( # Implemented in order to keep the current API
index = sdk_manager.get_index(index_id=index_id)
endpoint = sdk_manager.get_endpoint(endpoint_id=endpoint_id)

if private_service_connect_ip_address:
endpoint.private_service_connect_ip_address = (
private_service_connect_ip_address
)

return cls(
document_storage=GCSDocumentStorage(bucket=bucket),
searcher=VectorSearchSearcher(
Expand Down
19 changes: 19 additions & 0 deletions libs/vertexai/tests/integration_tests/test_vectorstores.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,25 @@ def vector_store() -> VectorSearchVectorStore:
return vector_store


@pytest.fixture
def vector_store_private() -> VectorSearchVectorStore:
embeddings = VertexAIEmbeddings(model_name="textembedding-gecko-default")

vector_store_private = VectorSearchVectorStore.from_components(
project_id=os.environ["PROJECT_ID"],
region=os.environ["REGION"],
gcs_bucket_name=os.environ["GCS_BUCKET_NAME"],
index_id=os.environ["INDEX_ID"],
endpoint_id=os.environ["ENDPOINT_ID"],
private_service_connect_ip_address=os.environ[
"PRIVATE_SERVICE_CONNECT_IP_ADDRESS"
],
embedding=embeddings,
)

return vector_store_private


@pytest.fixture
def datastore_vector_store() -> VectorSearchVectorStoreDatastore:
embeddings = VertexAIEmbeddings(model_name="textembedding-gecko-default")
Expand Down
Loading