typesense-java icon indicating copy to clipboard operation
typesense-java copied to clipboard

Vertex AI integration configuration

Open asorian0 opened this issue 7 months ago • 1 comments

Description

While configuring Typesense to use Vertex AI it seems the property refreshToken is missing on FieldEmbedModelConfig class, so we cannot setup properly it, so it cannot connect to GCP Vertex AI API, throwing a 400 with the message: Property embed.model_config.refresh_token is missing or is not a string.

Actually, in the documentation it shows the refreshToken property being configured:

CollectionSchema collectionSchema = new CollectionSchema();
ArrayList<String> embedFrom = new ArrayList<>();
embedFrom.add("product_name");
embedFrom.add("categories");

collectionschema.name("products")
                .addFieldsItem(new Field().name("product_name").type(FieldTypes.STRING))
                .addFieldsItem(new Field().name("categories").type(FieldTypes.STRING_ARRAY))
                .addFieldsItem(new Field().name("embedding").type(FieldTypes.FLOAT_ARRAY).embed(
                  new FieldEmbed().from(embedFrom).modelConfig(new FieldEmbedModelConfig().modelName("gcp/embedding-gecko-001")
                      .accessToken("your_gcp_access_token")
                      .refreshToken("your_gcp_refresh_token") <-- this one is missing!
                      .clientId("your_gcp_app_client_id")
                      .clientSecret("your_gcp_client_secret").projectId("your_gcp_project_id")))
                ));
CollectionResponse collectionResponse = client.collections().create(collectionSchema);

Guess the OpenAPI model is not fully synced with the one used in this library.

Steps to reproduce

Follow the steps from the documentation

Expected Behavior

Typesense library is able to connect to Vertex AI to generate embeddings

Actual Behavior

Typesense library is not able to connect to Vertex AI, throwing a 400 with the message: Property embed.model_config.refresh_token is missing or is not a string.

Metadata

Typesense Version: 0.8.1

OS: MacOS Sonoma 14.5

asorian0 avatar Jul 17 '24 10:07 asorian0