typesense / typesense-java

Java client for Typesense
https://typesense.org/docs/latest/api/
Apache License 2.0
59 stars 29 forks source link

Vertex AI integration configuration #57

Open asorian0 opened 4 months ago

asorian0 commented 4 months ago

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 commented 2 months ago

hey any update on this?