Closed shannonantony closed 6 months ago
The example already does that... In Product
you have a sentenceEmbedding
:
In the controller we do a similarity search using the value of that sentence embedding to find similar items:
To use your own input query, rather than then pre-computed embedding for the text of another product you would take you natural language query, create an embedding and use that for the similarity search.
RomsVSS
Product->Description->Embedding->Search for Products with similar embeddings for Description
What you are asking:
Input Query->Embedding->Search for Products with similar embeddings for Description
Hope that helps
@bsbodden Thanks. I am specifically trying to figure out which Java API method I should use to convert the natural language query input to vector embeddings. Can you please provide sample code for that?
Should I use something like this?
float[] sentenceEmbed = featureExtractor.getSentenceEmbeddingAsFloatArrayFor(query);
thanks again
Jay
@bsbodden , Finally I could make the application running. However the quality of similarity is not meeting the expectation. Is there any way I could tune the parameters to get better results. If I define 2 vectorize fields- field1 & field2, How do I implement the method where input query matches with either field1 or field2
thanks Jay
Jay, glad you got it work. The similarity perceive accuracy depends on the model that's being used and the data being vectorized. Right now we have 1 model set as the default for each for the vectorization types. But if you find a model that works via DJL you can set a different model in a properties file. I plan to integrate more tightly with Spring AI soon.
Thanks @bsbodden . Integration with Spring AI would be great. can you give me the property syntax to reference other models. thanks Jay
@bsbodden Thanks again for all your help.
I am trying to implement vector search based on a natural language input. How can I extend the ROMS-VSS sample to accept 'natural language' input for the 'productText' field and retrieve matching products based on sentenceEmbedding vector search? Basically I need to convert the natural language input to a vector and search against sentenceEmbedding vector and retrieve matching products.
Any guidance will be highly appreciated.
thanks
Jay