Comments (7)
It would be great to have this! It'll unblock some of our use cases that require item lookups (with Python API, on VPC)
from python-aiplatform.
+1 - the docs include an example of querying by document ID with the grpc cli, but the python client seems like it might be missing this.
from python-aiplatform.
Getting the same error just following the default Python example at https://cloud.google.com/vertex-ai/docs/vector-search/quickstart :
PROJECT_ID="my_project_id"
PROJECT_NUMBER="811111111111"
LOCATION="europe-west3"
INDEX_ENDPOINT_NAME="test-index-endpoint"
INDEX_ENDPOINT_ID="4444444444444444444"
DEPLOYED_INDEX_ID="my_deployed_test_index"
aiplatform.init(project=PROJECT_ID, location=LOCATION)
my_index_endpoint = aiplatform.MatchingEngineIndexEndpoint(
index_endpoint_name = INDEX_ENDPOINT_ID,
project = PROJECT_NUMBER,
location = LOCATION
)
product_names = {}
product_embs = {}
with open('product-embs.json') as f:
for l in f.readlines():
p = json.loads(l)
id = p['id']
product_names[id] = p['name']
product_embs[id] = p['embedding']
query_emb = product_embs['6523']
response = my_index_endpoint.find_neighbors(
deployed_index_id = DEPLOYED_INDEX_ID,
queries = [query_emb],
num_neighbors = 10
)
for idx, neighbor in enumerate(response[0]):
print(f"{neighbor.distance:.2f} {product_names[neighbor.id]}")
from python-aiplatform.
@matthewsparr is your workbench instance also within the same VPC?
from python-aiplatform.
@sshcherbakov The example works with a public endpoint, not with a VPC. We will add a note to the sample code.
from python-aiplatform.
+1
The query example page provided for a VPC endpoint context are using low level grpc calls: https://cloud.google.com/vertex-ai/docs/vector-search/query-index-vpc
The query example page for a public endpoint is using python:
https://cloud.google.com/vertex-ai/docs/vector-search/query-index-public-endpoint
Would someone have a working example in a VPC context in python in Cloud Run ?
We have tried to do it but could not achieve it so far.
from python-aiplatform.
read_index_datapoints() now support private service access endpoints, please update to or later https://pypi.org/project/google-cloud-aiplatform/1.38.0/.
from python-aiplatform.
Related Issues (20)
- Error stream=True freeze screen and not response no error nothing in logs
- tests.system.aiplatform.test_language_models.TestLanguageModels: test_text_generation[grpc] failed HOT 1
- tests.system.aiplatform.test_language_models.TestLanguageModels: test_text_generation_model_predict_async[grpc] failed HOT 1
- tests.system.aiplatform.test_language_models.TestLanguageModels: test_text_generation_streaming[grpc] failed HOT 1
- tests.system.aiplatform.test_language_models.TestLanguageModels: test_text_generation_streaming[rest] failed HOT 1
- tests.system.aiplatform.test_language_models.TestLanguageModels: test_text_embedding_async[grpc] failed HOT 1
- tests.system.aiplatform.test_language_models.TestLanguageModels: test_code_generation_streaming[grpc] failed HOT 1
- tests.system.aiplatform.test_language_models.TestLanguageModels: test_code_generation_streaming[rest] failed HOT 1
- tests.system.vertexai.test_generative_models.TestGenerativeModels: test_generate_content_async failed HOT 1
- tests.system.aiplatform.test_experiments.TestExperiments: test_get_experiments_df failed HOT 1
- tests.system.aiplatform.test_experiments.TestExperiments: test_get_experiments_df_include_time_series_false failed HOT 1
- tests.system.vertexai.test_generative_models.TestGenerativeModels: test_generate_content_from_text_and_remote_image failed HOT 1
- Extend Type Hint for the content Parameter of send_message Functions Generative Models HOT 1
- tests.unit.aiplatform.test_model_evaluation.TestModelEvaluationJob: test_model_evaluation_job_submit[{"pipelineInfo": {"name": "evaluation-default-pipeline"}, "root": {"dag": {"tasks": {}}, "inputDefinitions": {"parameters": {"batch_predict_gcs_source_uris": {"type": "STRING"}, "dataflow_service_account": {"type": "STRING"}, "batch_predict_instances_format": {"type": "STRING"}, "batch_predict_machine_type": {"type": "STRING"}, "evaluation_class_labels": {"type": "STRING"}, "location": {"type": "STRING"}, "model_name": {"type": "STRING"}, "project": {"type": "STRING"}, "batch_predict_gcs_destination_output_uri": {"type": "STRING"}, "target_field_name": {"type": "STRING"}}}}, "schemaVersion": "2.0.0", "sdkVersion": "kfp-1.8.12", "components": {}}] failed HOT 5
- tests.unit.aiplatform.test_model_evaluation.TestModelEvaluationJob: test_model_evaluation_job_submit_with_experiment[{"pipelineInfo": {"name": "evaluation-default-pipeline"}, "root": {"dag": {"tasks": {}}, "inputDefinitions": {"parameters": {"batch_predict_gcs_source_uris": {"type": "STRING"}, "dataflow_service_account": {"type": "STRING"}, "batch_predict_instances_format": {"type": "STRING"}, "batch_predict_machine_type": {"type": "STRING"}, "evaluation_class_labels": {"type": "STRING"}, "location": {"type": "STRING"}, "model_name": {"type": "STRING"}, "project": {"type": "STRING"}, "batch_predict_gcs_destination_output_uri": {"type": "STRING"}, "target_field_name": {"type": "STRING"}}}}, "schemaVersion": "2.0.0", "sdkVersion": "kfp-1.8.12", "components": {}}] failed HOT 5
- ResourceExhausted: 429 received metadata size exceeds soft limit
- tests.system.aiplatform.test_featurestore.TestFeaturestore: test_online_reads failed HOT 1
- [BUG] Can't use seed parameter with TextGenerationModel.predict_async HOT 2
- tests.system.aiplatform.test_e2e_tabular.TestEndToEndTabular: test_end_to_end_tabular failed HOT 1
- tests.system.aiplatform.test_prediction_cpr.TestPredictionCpr: test_build_cpr_model_upload_and_deploy failed HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-aiplatform.