spring-projects / spring-ai

An Application Framework for AI Engineering
https://docs.spring.io/spring-ai/reference/index.html
Apache License 2.0
3.27k stars 837 forks source link

Add advanced RAG (Hybrid Search and Semantic Hybrid Search) with Azure AI Search #517

Open iAMSagar44 opened 7 months ago

iAMSagar44 commented 7 months ago

Azure AI Search has the following feature along with Vector Similarity Search (which is already present in Spring AI).

In the JavaScript Langchain project they basically have the 3 search models in 3 functions next to each other:

  1. similaritySearchVectorWithScore - this is the current vector search Spring AI already has
  2. hybridSearchVectorWithScore - this is vector search + text search
  3. semanticHybridSearchVectorWithScore - this is hybrid search + reranking

I see something similar was recently introduced in the Langchain4j project too. Would be good to have this feature in Spring AI as well.

markpollack commented 3 months ago

Hi. Yes, this is a good idea.

markpollack commented 3 months ago

related issue - https://github.com/spring-projects/spring-ai/issues/579

alessiobertazzo88 commented 3 months ago

Hello everyone, I have developed this feature to enable users to choose their preferred search mode. Within the SearchRequest, it is possible to use similarity search in line with what is currently available (vector-based, enabled by default), full-text search, or both (hybrid search). Additionally, it provides the option to use reranking approaches as well.

This implementation is applied to Azure SearchAI as first vector store, but new methods defaults can be overridden to enhance the feature for all the others compatible.

This is the PR #1227