Rahul Yadav
11/29/2024, 1:48 PMCollectionSchema 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("openai/text-embedding-ada-002").apiKey(apiKey).url(apiUrl)
)));
CollectionResponse collectionResponse = client.collections().create(collectionSchema);
this is the example in documentation, ive just replaced with my api key and url, this produces an error:
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.typesense.api.Client]: Factory method 'typesenseClient' threw exception with message: OpenAI API error: Resource not found
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:178) ~[spring-beans-6.1.14.jar:6.1.14]
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:644) ~[spring-beans-6.1.14.jar:6.1.14]
... 22 common frames omitted
Caused by: org.typesense.api.exceptions.RequestMalformed: OpenAI API error: Resource not found
not sure what's wrong here, any suggestions would be appreciated