! gcloud compute firewall-rules create {VPC_NETWORK}-allow-rdp --network {VPC_NETWORK} --priority 65534 --project {PROJECT_ID} --allow tcp:3389
    ! gcloud compute firewall-rules create {VPC_NETWORK}-allow-ssh --network {VPC_NETWORK} --priority 65534 --project {PROJECT_ID} --allow tcp:22
    # Reserve IP range
    ! gcloud compute addresses create {PEERING_RANGE_NAME} --global --prefix-length=16 --network={VPC_NETWORK} --purpose=VPC_PEERING --project={PROJECT_ID} --description="peering range"
    # Set up peering with service networking
    # Your account must have the "Compute Network Admin" role to run the following.
    ! gcloud services vpc-peerings connect --service=servicenetworking.googleapis.com --network={VPC_NETWORK} --ranges={PEERING_RANGE_NAME} --project={PROJECT_ID}
# Creating bucket.
! gsutil mb -l $REGION -p $PROJECT_ID $BUCKET_URI
Using Tensorflow Universal Sentence Encoder as an Embedder#
# Load the Universal Sentence Encoder module
module_url = "https://tfhub.dev/google/universal-sentence-encoder-multilingual/3"
model = hub.load(module_url)
# Generate embeddings for each word
embeddings = model(['banana'])
Inserting a test embedding#
initial_config = {"id": "banana_id", "embedding": [float(x) for x in list(embeddings.numpy()[0])]}
with open("data.json", "w") as f:
    json.dump(initial_config, f)
!gsutil cp data.json {EMBEDDING_DIR}/file.json
aiplatform.init(project=PROJECT_ID, location=REGION, staging_bucket=BUCKET_URI)
Creating Index#
rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/matchingengine.html