com.pulumi.gcp.vertex.kotlin.AiIndexArgs.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-gcp-kotlin Show documentation
Show all versions of pulumi-gcp-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.vertex.kotlin
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.gcp.vertex.AiIndexArgs.builder
import com.pulumi.gcp.vertex.kotlin.inputs.AiIndexMetadataArgs
import com.pulumi.gcp.vertex.kotlin.inputs.AiIndexMetadataArgsBuilder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.Map
import kotlin.jvm.JvmName
/**
* A representation of a collection of database items organized in a way that allows for approximate nearest neighbor (a.k.a ANN) algorithms search.
* To get more information about Index, see:
* * [API documentation](https://cloud.google.com/vertex-ai/docs/reference/rest/v1/projects.locations.indexes/)
* ## Example Usage
* ### Vertex Ai Index
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const bucket = new gcp.storage.Bucket("bucket", {
* name: "vertex-ai-index-test",
* location: "us-central1",
* uniformBucketLevelAccess: true,
* });
* // The sample data comes from the following link:
* // https://cloud.google.com/vertex-ai/docs/matching-engine/filtering#specify-namespaces-tokens
* const data = new gcp.storage.BucketObject("data", {
* name: "contents/data.json",
* bucket: bucket.name,
* content: `{"id": "42", "embedding": [0.5, 1.0], "restricts": [{"namespace": "class", "allow": ["cat", "pet"]},{"namespace": "category", "allow": ["feline"]}]}
* {"id": "43", "embedding": [0.6, 1.0], "restricts": [{"namespace": "class", "allow": ["dog", "pet"]},{"namespace": "category", "allow": ["canine"]}]}
* `,
* });
* const index = new gcp.vertex.AiIndex("index", {
* labels: {
* foo: "bar",
* },
* region: "us-central1",
* displayName: "test-index",
* description: "index for test",
* metadata: {
* contentsDeltaUri: pulumi.interpolate`gs://${bucket.name}/contents`,
* config: {
* dimensions: 2,
* approximateNeighborsCount: 150,
* shardSize: "SHARD_SIZE_SMALL",
* distanceMeasureType: "DOT_PRODUCT_DISTANCE",
* algorithmConfig: {
* treeAhConfig: {
* leafNodeEmbeddingCount: 500,
* leafNodesToSearchPercent: 7,
* },
* },
* },
* },
* indexUpdateMethod: "BATCH_UPDATE",
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* bucket = gcp.storage.Bucket("bucket",
* name="vertex-ai-index-test",
* location="us-central1",
* uniform_bucket_level_access=True)
* # The sample data comes from the following link:
* # https://cloud.google.com/vertex-ai/docs/matching-engine/filtering#specify-namespaces-tokens
* data = gcp.storage.BucketObject("data",
* name="contents/data.json",
* bucket=bucket.name,
* content="""{"id": "42", "embedding": [0.5, 1.0], "restricts": [{"namespace": "class", "allow": ["cat", "pet"]},{"namespace": "category", "allow": ["feline"]}]}
* {"id": "43", "embedding": [0.6, 1.0], "restricts": [{"namespace": "class", "allow": ["dog", "pet"]},{"namespace": "category", "allow": ["canine"]}]}
* """)
* index = gcp.vertex.AiIndex("index",
* labels={
* "foo": "bar",
* },
* region="us-central1",
* display_name="test-index",
* description="index for test",
* metadata=gcp.vertex.AiIndexMetadataArgs(
* contents_delta_uri=bucket.name.apply(lambda name: f"gs://{name}/contents"),
* config=gcp.vertex.AiIndexMetadataConfigArgs(
* dimensions=2,
* approximate_neighbors_count=150,
* shard_size="SHARD_SIZE_SMALL",
* distance_measure_type="DOT_PRODUCT_DISTANCE",
* algorithm_config=gcp.vertex.AiIndexMetadataConfigAlgorithmConfigArgs(
* tree_ah_config=gcp.vertex.AiIndexMetadataConfigAlgorithmConfigTreeAhConfigArgs(
* leaf_node_embedding_count=500,
* leaf_nodes_to_search_percent=7,
* ),
* ),
* ),
* ),
* index_update_method="BATCH_UPDATE")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var bucket = new Gcp.Storage.Bucket("bucket", new()
* {
* Name = "vertex-ai-index-test",
* Location = "us-central1",
* UniformBucketLevelAccess = true,
* });
* // The sample data comes from the following link:
* // https://cloud.google.com/vertex-ai/docs/matching-engine/filtering#specify-namespaces-tokens
* var data = new Gcp.Storage.BucketObject("data", new()
* {
* Name = "contents/data.json",
* Bucket = bucket.Name,
* Content = @"{""id"": ""42"", ""embedding"": [0.5, 1.0], ""restricts"": [{""namespace"": ""class"", ""allow"": [""cat"", ""pet""]},{""namespace"": ""category"", ""allow"": [""feline""]}]}
* {""id"": ""43"", ""embedding"": [0.6, 1.0], ""restricts"": [{""namespace"": ""class"", ""allow"": [""dog"", ""pet""]},{""namespace"": ""category"", ""allow"": [""canine""]}]}
* ",
* });
* var index = new Gcp.Vertex.AiIndex("index", new()
* {
* Labels =
* {
* { "foo", "bar" },
* },
* Region = "us-central1",
* DisplayName = "test-index",
* Description = "index for test",
* Metadata = new Gcp.Vertex.Inputs.AiIndexMetadataArgs
* {
* ContentsDeltaUri = bucket.Name.Apply(name => $"gs://{name}/contents"),
* Config = new Gcp.Vertex.Inputs.AiIndexMetadataConfigArgs
* {
* Dimensions = 2,
* ApproximateNeighborsCount = 150,
* ShardSize = "SHARD_SIZE_SMALL",
* DistanceMeasureType = "DOT_PRODUCT_DISTANCE",
* AlgorithmConfig = new Gcp.Vertex.Inputs.AiIndexMetadataConfigAlgorithmConfigArgs
* {
* TreeAhConfig = new Gcp.Vertex.Inputs.AiIndexMetadataConfigAlgorithmConfigTreeAhConfigArgs
* {
* LeafNodeEmbeddingCount = 500,
* LeafNodesToSearchPercent = 7,
* },
* },
* },
* },
* IndexUpdateMethod = "BATCH_UPDATE",
* });
* });
* ```
* ```go
* package main
* import (
* "fmt"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/storage"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/vertex"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* bucket, err := storage.NewBucket(ctx, "bucket", &storage.BucketArgs{
* Name: pulumi.String("vertex-ai-index-test"),
* Location: pulumi.String("us-central1"),
* UniformBucketLevelAccess: pulumi.Bool(true),
* })
* if err != nil {
* return err
* }
* // The sample data comes from the following link:
* // https://cloud.google.com/vertex-ai/docs/matching-engine/filtering#specify-namespaces-tokens
* _, err = storage.NewBucketObject(ctx, "data", &storage.BucketObjectArgs{
* Name: pulumi.String("contents/data.json"),
* Bucket: bucket.Name,
* Content: pulumi.String("{\"id\": \"42\", \"embedding\": [0.5, 1.0], \"restricts\": [{\"namespace\": \"class\", \"allow\": [\"cat\", \"pet\"]},{\"namespace\": \"category\", \"allow\": [\"feline\"]}]}\n{\"id\": \"43\", \"embedding\": [0.6, 1.0], \"restricts\": [{\"namespace\": \"class\", \"allow\": [\"dog\", \"pet\"]},{\"namespace\": \"category\", \"allow\": [\"canine\"]}]}\n"),
* })
* if err != nil {
* return err
* }
* _, err = vertex.NewAiIndex(ctx, "index", &vertex.AiIndexArgs{
* Labels: pulumi.StringMap{
* "foo": pulumi.String("bar"),
* },
* Region: pulumi.String("us-central1"),
* DisplayName: pulumi.String("test-index"),
* Description: pulumi.String("index for test"),
* Metadata: &vertex.AiIndexMetadataArgs{
* ContentsDeltaUri: bucket.Name.ApplyT(func(name string) (string, error) {
* return fmt.Sprintf("gs://%v/contents", name), nil
* }).(pulumi.StringOutput),
* Config: &vertex.AiIndexMetadataConfigArgs{
* Dimensions: pulumi.Int(2),
* ApproximateNeighborsCount: pulumi.Int(150),
* ShardSize: pulumi.String("SHARD_SIZE_SMALL"),
* DistanceMeasureType: pulumi.String("DOT_PRODUCT_DISTANCE"),
* AlgorithmConfig: &vertex.AiIndexMetadataConfigAlgorithmConfigArgs{
* TreeAhConfig: &vertex.AiIndexMetadataConfigAlgorithmConfigTreeAhConfigArgs{
* LeafNodeEmbeddingCount: pulumi.Int(500),
* LeafNodesToSearchPercent: pulumi.Int(7),
* },
* },
* },
* },
* IndexUpdateMethod: pulumi.String("BATCH_UPDATE"),
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.storage.Bucket;
* import com.pulumi.gcp.storage.BucketArgs;
* import com.pulumi.gcp.storage.BucketObject;
* import com.pulumi.gcp.storage.BucketObjectArgs;
* import com.pulumi.gcp.vertex.AiIndex;
* import com.pulumi.gcp.vertex.AiIndexArgs;
* import com.pulumi.gcp.vertex.inputs.AiIndexMetadataArgs;
* import com.pulumi.gcp.vertex.inputs.AiIndexMetadataConfigArgs;
* import com.pulumi.gcp.vertex.inputs.AiIndexMetadataConfigAlgorithmConfigArgs;
* import com.pulumi.gcp.vertex.inputs.AiIndexMetadataConfigAlgorithmConfigTreeAhConfigArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var bucket = new Bucket("bucket", BucketArgs.builder()
* .name("vertex-ai-index-test")
* .location("us-central1")
* .uniformBucketLevelAccess(true)
* .build());
* // The sample data comes from the following link:
* // https://cloud.google.com/vertex-ai/docs/matching-engine/filtering#specify-namespaces-tokens
* var data = new BucketObject("data", BucketObjectArgs.builder()
* .name("contents/data.json")
* .bucket(bucket.name())
* .content("""
* {"id": "42", "embedding": [0.5, 1.0], "restricts": [{"namespace": "class", "allow": ["cat", "pet"]},{"namespace": "category", "allow": ["feline"]}]}
* {"id": "43", "embedding": [0.6, 1.0], "restricts": [{"namespace": "class", "allow": ["dog", "pet"]},{"namespace": "category", "allow": ["canine"]}]}
* """)
* .build());
* var index = new AiIndex("index", AiIndexArgs.builder()
* .labels(Map.of("foo", "bar"))
* .region("us-central1")
* .displayName("test-index")
* .description("index for test")
* .metadata(AiIndexMetadataArgs.builder()
* .contentsDeltaUri(bucket.name().applyValue(name -> String.format("gs://%s/contents", name)))
* .config(AiIndexMetadataConfigArgs.builder()
* .dimensions(2)
* .approximateNeighborsCount(150)
* .shardSize("SHARD_SIZE_SMALL")
* .distanceMeasureType("DOT_PRODUCT_DISTANCE")
* .algorithmConfig(AiIndexMetadataConfigAlgorithmConfigArgs.builder()
* .treeAhConfig(AiIndexMetadataConfigAlgorithmConfigTreeAhConfigArgs.builder()
* .leafNodeEmbeddingCount(500)
* .leafNodesToSearchPercent(7)
* .build())
* .build())
* .build())
* .build())
* .indexUpdateMethod("BATCH_UPDATE")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* bucket:
* type: gcp:storage:Bucket
* properties:
* name: vertex-ai-index-test
* location: us-central1
* uniformBucketLevelAccess: true
* # The sample data comes from the following link:
* # https://cloud.google.com/vertex-ai/docs/matching-engine/filtering#specify-namespaces-tokens
* data:
* type: gcp:storage:BucketObject
* properties:
* name: contents/data.json
* bucket: ${bucket.name}
* content: |
* {"id": "42", "embedding": [0.5, 1.0], "restricts": [{"namespace": "class", "allow": ["cat", "pet"]},{"namespace": "category", "allow": ["feline"]}]}
* {"id": "43", "embedding": [0.6, 1.0], "restricts": [{"namespace": "class", "allow": ["dog", "pet"]},{"namespace": "category", "allow": ["canine"]}]}
* index:
* type: gcp:vertex:AiIndex
* properties:
* labels:
* foo: bar
* region: us-central1
* displayName: test-index
* description: index for test
* metadata:
* contentsDeltaUri: gs://${bucket.name}/contents
* config:
* dimensions: 2
* approximateNeighborsCount: 150
* shardSize: SHARD_SIZE_SMALL
* distanceMeasureType: DOT_PRODUCT_DISTANCE
* algorithmConfig:
* treeAhConfig:
* leafNodeEmbeddingCount: 500
* leafNodesToSearchPercent: 7
* indexUpdateMethod: BATCH_UPDATE
* ```
*
* ### Vertex Ai Index Streaming
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const bucket = new gcp.storage.Bucket("bucket", {
* name: "vertex-ai-index-test",
* location: "us-central1",
* uniformBucketLevelAccess: true,
* });
* // The sample data comes from the following link:
* // https://cloud.google.com/vertex-ai/docs/matching-engine/filtering#specify-namespaces-tokens
* const data = new gcp.storage.BucketObject("data", {
* name: "contents/data.json",
* bucket: bucket.name,
* content: `{"id": "42", "embedding": [0.5, 1.0], "restricts": [{"namespace": "class", "allow": ["cat", "pet"]},{"namespace": "category", "allow": ["feline"]}]}
* {"id": "43", "embedding": [0.6, 1.0], "restricts": [{"namespace": "class", "allow": ["dog", "pet"]},{"namespace": "category", "allow": ["canine"]}]}
* `,
* });
* const index = new gcp.vertex.AiIndex("index", {
* labels: {
* foo: "bar",
* },
* region: "us-central1",
* displayName: "test-index",
* description: "index for test",
* metadata: {
* contentsDeltaUri: pulumi.interpolate`gs://${bucket.name}/contents`,
* config: {
* dimensions: 2,
* shardSize: "SHARD_SIZE_LARGE",
* distanceMeasureType: "COSINE_DISTANCE",
* featureNormType: "UNIT_L2_NORM",
* algorithmConfig: {
* bruteForceConfig: {},
* },
* },
* },
* indexUpdateMethod: "STREAM_UPDATE",
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* bucket = gcp.storage.Bucket("bucket",
* name="vertex-ai-index-test",
* location="us-central1",
* uniform_bucket_level_access=True)
* # The sample data comes from the following link:
* # https://cloud.google.com/vertex-ai/docs/matching-engine/filtering#specify-namespaces-tokens
* data = gcp.storage.BucketObject("data",
* name="contents/data.json",
* bucket=bucket.name,
* content="""{"id": "42", "embedding": [0.5, 1.0], "restricts": [{"namespace": "class", "allow": ["cat", "pet"]},{"namespace": "category", "allow": ["feline"]}]}
* {"id": "43", "embedding": [0.6, 1.0], "restricts": [{"namespace": "class", "allow": ["dog", "pet"]},{"namespace": "category", "allow": ["canine"]}]}
* """)
* index = gcp.vertex.AiIndex("index",
* labels={
* "foo": "bar",
* },
* region="us-central1",
* display_name="test-index",
* description="index for test",
* metadata=gcp.vertex.AiIndexMetadataArgs(
* contents_delta_uri=bucket.name.apply(lambda name: f"gs://{name}/contents"),
* config=gcp.vertex.AiIndexMetadataConfigArgs(
* dimensions=2,
* shard_size="SHARD_SIZE_LARGE",
* distance_measure_type="COSINE_DISTANCE",
* feature_norm_type="UNIT_L2_NORM",
* algorithm_config=gcp.vertex.AiIndexMetadataConfigAlgorithmConfigArgs(
* brute_force_config=gcp.vertex.AiIndexMetadataConfigAlgorithmConfigBruteForceConfigArgs(),
* ),
* ),
* ),
* index_update_method="STREAM_UPDATE")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var bucket = new Gcp.Storage.Bucket("bucket", new()
* {
* Name = "vertex-ai-index-test",
* Location = "us-central1",
* UniformBucketLevelAccess = true,
* });
* // The sample data comes from the following link:
* // https://cloud.google.com/vertex-ai/docs/matching-engine/filtering#specify-namespaces-tokens
* var data = new Gcp.Storage.BucketObject("data", new()
* {
* Name = "contents/data.json",
* Bucket = bucket.Name,
* Content = @"{""id"": ""42"", ""embedding"": [0.5, 1.0], ""restricts"": [{""namespace"": ""class"", ""allow"": [""cat"", ""pet""]},{""namespace"": ""category"", ""allow"": [""feline""]}]}
* {""id"": ""43"", ""embedding"": [0.6, 1.0], ""restricts"": [{""namespace"": ""class"", ""allow"": [""dog"", ""pet""]},{""namespace"": ""category"", ""allow"": [""canine""]}]}
* ",
* });
* var index = new Gcp.Vertex.AiIndex("index", new()
* {
* Labels =
* {
* { "foo", "bar" },
* },
* Region = "us-central1",
* DisplayName = "test-index",
* Description = "index for test",
* Metadata = new Gcp.Vertex.Inputs.AiIndexMetadataArgs
* {
* ContentsDeltaUri = bucket.Name.Apply(name => $"gs://{name}/contents"),
* Config = new Gcp.Vertex.Inputs.AiIndexMetadataConfigArgs
* {
* Dimensions = 2,
* ShardSize = "SHARD_SIZE_LARGE",
* DistanceMeasureType = "COSINE_DISTANCE",
* FeatureNormType = "UNIT_L2_NORM",
* AlgorithmConfig = new Gcp.Vertex.Inputs.AiIndexMetadataConfigAlgorithmConfigArgs
* {
* BruteForceConfig = null,
* },
* },
* },
* IndexUpdateMethod = "STREAM_UPDATE",
* });
* });
* ```
* ```go
* package main
* import (
* "fmt"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/storage"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/vertex"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* bucket, err := storage.NewBucket(ctx, "bucket", &storage.BucketArgs{
* Name: pulumi.String("vertex-ai-index-test"),
* Location: pulumi.String("us-central1"),
* UniformBucketLevelAccess: pulumi.Bool(true),
* })
* if err != nil {
* return err
* }
* // The sample data comes from the following link:
* // https://cloud.google.com/vertex-ai/docs/matching-engine/filtering#specify-namespaces-tokens
* _, err = storage.NewBucketObject(ctx, "data", &storage.BucketObjectArgs{
* Name: pulumi.String("contents/data.json"),
* Bucket: bucket.Name,
* Content: pulumi.String("{\"id\": \"42\", \"embedding\": [0.5, 1.0], \"restricts\": [{\"namespace\": \"class\", \"allow\": [\"cat\", \"pet\"]},{\"namespace\": \"category\", \"allow\": [\"feline\"]}]}\n{\"id\": \"43\", \"embedding\": [0.6, 1.0], \"restricts\": [{\"namespace\": \"class\", \"allow\": [\"dog\", \"pet\"]},{\"namespace\": \"category\", \"allow\": [\"canine\"]}]}\n"),
* })
* if err != nil {
* return err
* }
* _, err = vertex.NewAiIndex(ctx, "index", &vertex.AiIndexArgs{
* Labels: pulumi.StringMap{
* "foo": pulumi.String("bar"),
* },
* Region: pulumi.String("us-central1"),
* DisplayName: pulumi.String("test-index"),
* Description: pulumi.String("index for test"),
* Metadata: &vertex.AiIndexMetadataArgs{
* ContentsDeltaUri: bucket.Name.ApplyT(func(name string) (string, error) {
* return fmt.Sprintf("gs://%v/contents", name), nil
* }).(pulumi.StringOutput),
* Config: &vertex.AiIndexMetadataConfigArgs{
* Dimensions: pulumi.Int(2),
* ShardSize: pulumi.String("SHARD_SIZE_LARGE"),
* DistanceMeasureType: pulumi.String("COSINE_DISTANCE"),
* FeatureNormType: pulumi.String("UNIT_L2_NORM"),
* AlgorithmConfig: &vertex.AiIndexMetadataConfigAlgorithmConfigArgs{
* BruteForceConfig: nil,
* },
* },
* },
* IndexUpdateMethod: pulumi.String("STREAM_UPDATE"),
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.storage.Bucket;
* import com.pulumi.gcp.storage.BucketArgs;
* import com.pulumi.gcp.storage.BucketObject;
* import com.pulumi.gcp.storage.BucketObjectArgs;
* import com.pulumi.gcp.vertex.AiIndex;
* import com.pulumi.gcp.vertex.AiIndexArgs;
* import com.pulumi.gcp.vertex.inputs.AiIndexMetadataArgs;
* import com.pulumi.gcp.vertex.inputs.AiIndexMetadataConfigArgs;
* import com.pulumi.gcp.vertex.inputs.AiIndexMetadataConfigAlgorithmConfigArgs;
* import com.pulumi.gcp.vertex.inputs.AiIndexMetadataConfigAlgorithmConfigBruteForceConfigArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var bucket = new Bucket("bucket", BucketArgs.builder()
* .name("vertex-ai-index-test")
* .location("us-central1")
* .uniformBucketLevelAccess(true)
* .build());
* // The sample data comes from the following link:
* // https://cloud.google.com/vertex-ai/docs/matching-engine/filtering#specify-namespaces-tokens
* var data = new BucketObject("data", BucketObjectArgs.builder()
* .name("contents/data.json")
* .bucket(bucket.name())
* .content("""
* {"id": "42", "embedding": [0.5, 1.0], "restricts": [{"namespace": "class", "allow": ["cat", "pet"]},{"namespace": "category", "allow": ["feline"]}]}
* {"id": "43", "embedding": [0.6, 1.0], "restricts": [{"namespace": "class", "allow": ["dog", "pet"]},{"namespace": "category", "allow": ["canine"]}]}
* """)
* .build());
* var index = new AiIndex("index", AiIndexArgs.builder()
* .labels(Map.of("foo", "bar"))
* .region("us-central1")
* .displayName("test-index")
* .description("index for test")
* .metadata(AiIndexMetadataArgs.builder()
* .contentsDeltaUri(bucket.name().applyValue(name -> String.format("gs://%s/contents", name)))
* .config(AiIndexMetadataConfigArgs.builder()
* .dimensions(2)
* .shardSize("SHARD_SIZE_LARGE")
* .distanceMeasureType("COSINE_DISTANCE")
* .featureNormType("UNIT_L2_NORM")
* .algorithmConfig(AiIndexMetadataConfigAlgorithmConfigArgs.builder()
* .bruteForceConfig()
* .build())
* .build())
* .build())
* .indexUpdateMethod("STREAM_UPDATE")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* bucket:
* type: gcp:storage:Bucket
* properties:
* name: vertex-ai-index-test
* location: us-central1
* uniformBucketLevelAccess: true
* # The sample data comes from the following link:
* # https://cloud.google.com/vertex-ai/docs/matching-engine/filtering#specify-namespaces-tokens
* data:
* type: gcp:storage:BucketObject
* properties:
* name: contents/data.json
* bucket: ${bucket.name}
* content: |
* {"id": "42", "embedding": [0.5, 1.0], "restricts": [{"namespace": "class", "allow": ["cat", "pet"]},{"namespace": "category", "allow": ["feline"]}]}
* {"id": "43", "embedding": [0.6, 1.0], "restricts": [{"namespace": "class", "allow": ["dog", "pet"]},{"namespace": "category", "allow": ["canine"]}]}
* index:
* type: gcp:vertex:AiIndex
* properties:
* labels:
* foo: bar
* region: us-central1
* displayName: test-index
* description: index for test
* metadata:
* contentsDeltaUri: gs://${bucket.name}/contents
* config:
* dimensions: 2
* shardSize: SHARD_SIZE_LARGE
* distanceMeasureType: COSINE_DISTANCE
* featureNormType: UNIT_L2_NORM
* algorithmConfig:
* bruteForceConfig: {}
* indexUpdateMethod: STREAM_UPDATE
* ```
*
* ## Import
* Index can be imported using any of these accepted formats:
* * `projects/{{project}}/locations/{{region}}/indexes/{{name}}`
* * `{{project}}/{{region}}/{{name}}`
* * `{{region}}/{{name}}`
* * `{{name}}`
* When using the `pulumi import` command, Index can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:vertex/aiIndex:AiIndex default projects/{{project}}/locations/{{region}}/indexes/{{name}}
* ```
* ```sh
* $ pulumi import gcp:vertex/aiIndex:AiIndex default {{project}}/{{region}}/{{name}}
* ```
* ```sh
* $ pulumi import gcp:vertex/aiIndex:AiIndex default {{region}}/{{name}}
* ```
* ```sh
* $ pulumi import gcp:vertex/aiIndex:AiIndex default {{name}}
* ```
* @property description The description of the Index.
* @property displayName The display name of the Index. The name can be up to 128 characters long and can consist of any UTF-8 characters.
* - - -
* @property indexUpdateMethod The update method to use with this Index. The value must be the followings. If not set, BATCH_UPDATE will be used by default.
* * BATCH_UPDATE: user can call indexes.patch with files on Cloud Storage of datapoints to update.
* * STREAM_UPDATE: user can call indexes.upsertDatapoints/DeleteDatapoints to update the Index and the updates will be applied in corresponding DeployedIndexes in nearly real-time.
* @property labels The labels with user-defined metadata to organize your Indexes.
* **Note**: This field is non-authoritative, and will only manage the labels present in your configuration.
* Please refer to the field `effective_labels` for all of the labels present on the resource.
* @property metadata An additional information about the Index
* Structure is documented below.
* @property project The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
* @property region The region of the index. eg us-central1
*/
public data class AiIndexArgs(
public val description: Output? = null,
public val displayName: Output? = null,
public val indexUpdateMethod: Output? = null,
public val labels: Output
© 2015 - 2024 Weber Informatics LLC | Privacy Policy