@RestController
@RequestMapping("/spring/ai/api/v1/rag")
@ConditionalOnBean({org.springframework.ai.chat.model.ChatModel.class,org.springframework.ai.vectorstore.VectorStore.class,org.springframework.ai.embedding.EmbeddingModel.class})
public class SpringAIRagController
extends Object
RAG知识库问答
https://docs.spring.io/spring-ai/reference/api/retrieval-augmented-generation.html
https://mp.weixin.qq.com/s/ETmbEAE7lNligcM_A_GF8A
https://www.xiaohongshu.com/explore/67b422600000000029008c9f?note_flow_source=wechat&xsec_token=CBKBzlIFWDRmY2lKlLXYLivyqzKeFCE-9sd-_DNTLH-rM=
Field Summary
Fields
private static final org.springframework.ai.chat.client.advisor.observation.AdvisorObservationConvention
private static final org.springframework.ai.chat.client.observation.ChatClientObservationConvention
private final org.springframework.ai.embedding.EmbeddingModel
private final io.micrometer.observation.ObservationRegistry
private final org.springframework.ai.chat.model.ChatModel
private final org.springframework.ai.vectorstore.VectorStore
Constructor Summary
Constructors
Method Summary
All Methods Instance Methods Concrete Methods
(package private) org.springframework.http.ResponseEntity<JsonResult <?>>
private org.springframework.ai.chat.client.ChatClient.Builder
(package private) org.springframework.http.ResponseEntity<JsonResult <?>>
(package private) org.springframework.http.ResponseEntity<JsonResult <?>>
(package private) org.springframework.http.ResponseEntity<JsonResult <?>>
(package private) org.springframework.http.ResponseEntity<JsonResult <?>>
(package private) org.springframework.http.ResponseEntity<JsonResult <?>>
(package private) org.springframework.http.ResponseEntity<JsonResult <?>>
(package private) org.springframework.http.ResponseEntity<JsonResult <?>>
(package private) org.springframework.http.ResponseEntity<JsonResult <?>>
(package private) org.springframework.http.ResponseEntity<JsonResult <?>>
(package private) org.springframework.http.ResponseEntity<JsonResult <?>>
(package private) org.springframework.http.ResponseEntity<JsonResult <?>>
(package private) org.springframework.http.ResponseEntity<JsonResult <?>>
(package private) org.springframework.http.ResponseEntity<JsonResult <?>>
Methods inherited from class java.lang.Object
clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait
Field Details
DEFAULT_CHAT_OBSERVATION_CONVENTION
private static final org.springframework.ai.chat.client.observation.ChatClientObservationConvention DEFAULT_CHAT_OBSERVATION_CONVENTION
DEFAULT_ADVISOR_OBSERVATION_CONVENTION
private static final org.springframework.ai.chat.client.advisor.observation.AdvisorObservationConvention DEFAULT_ADVISOR_OBSERVATION_CONVENTION
vectorStore
private final org.springframework.ai.vectorstore.VectorStore vectorStore
embeddingModel
private final org.springframework.ai.embedding.EmbeddingModel embeddingModel
primaryChatModel
private final org.springframework.ai.chat.model.ChatModel primaryChatModel
observationRegistry
private final io.micrometer.observation.ObservationRegistry observationRegistry
Constructor Details
SpringAIRagController
public SpringAIRagController ()
Method Details
rag
@GetMapping("/rag")
org.springframework.http.ResponseEntity<JsonResult <?>> rag (@RequestParam(value="message",defaultValue="\u4ec0\u4e48\u65f6\u95f4\u8003\u8bd5\uff1f")
String message,
@RequestParam(value="kbUid",defaultValue="")
String kbUid)
filter
@GetMapping("/filter")
org.springframework.http.ResponseEntity<JsonResult <?>> filter (@RequestParam(value="message",defaultValue="\u4ec0\u4e48\u65f6\u95f4\u8003\u8bd5\uff1f")
String message,
@RequestParam(value="kbUid",defaultValue="")
String kbUid)
naiveRag
@GetMapping("/naive-rag")
org.springframework.http.ResponseEntity<JsonResult <?>> naiveRag (@RequestParam(value="message",defaultValue="\u4ec0\u4e48\u65f6\u95f4\u8003\u8bd5\uff1f")
String message,
@RequestParam(value="kbUid",defaultValue="")
String kbUid)
advancedRag
@GetMapping("/advanced-rag")
org.springframework.http.ResponseEntity<JsonResult <?>> advancedRag (@RequestParam(value="message",defaultValue="\u4ec0\u4e48\u65f6\u95f4\u8003\u8bd5\uff1f")
String message,
@RequestParam(value="kbUid",defaultValue="")
String kbUid)
multiQueryExpander
@GetMapping("/multi-query-expander")
org.springframework.http.ResponseEntity<JsonResult <?>> multiQueryExpander (@RequestParam(value="message",defaultValue="\u4ec0\u4e48\u65f6\u95f4\u8003\u8bd5\uff1f")
String message,
@RequestParam(value="kbUid",defaultValue="")
String kbUid)
vectorStoreDocumentRetriever
@GetMapping("/vector-store-document-retriever")
org.springframework.http.ResponseEntity<JsonResult <?>> vectorStoreDocumentRetriever (@RequestParam(value="message",defaultValue="\u4ec0\u4e48\u65f6\u95f4\u8003\u8bd5\uff1f")
String message,
@RequestParam(value="kbUid",defaultValue="")
String kbUid)
contextualQueryAugmenter
@GetMapping("/contextual-query-augmenter")
org.springframework.http.ResponseEntity<JsonResult <?>> contextualQueryAugmenter (@RequestParam(value="message",defaultValue="\u4ec0\u4e48\u65f6\u95f4\u8003\u8bd5\uff1f")
String message,
@RequestParam(value="kbUid",defaultValue="")
String kbUid)
search
@GetMapping("/search")
org.springframework.http.ResponseEntity<JsonResult <?>> search (@RequestParam(value="query",defaultValue="\u4ec0\u4e48\u65f6\u95f4\u8003\u8bd5\uff1f")
String query,
@RequestParam(value="kbUid",required=true)
String kbUid)
observedChat
@GetMapping("/observed")
org.springframework.http.ResponseEntity<JsonResult <?>> observedChat (@RequestParam(value="message",defaultValue="\u4ec0\u4e48\u65f6\u95f4\u8003\u8bd5\uff1f")
String message)
getVectorStoreInfo
@GetMapping("/vector-store-info")
org.springframework.http.ResponseEntity<JsonResult <?>> getVectorStoreInfo ()
getEmbeddingModelInfo
@GetMapping("/embedding-model-info")
org.springframework.http.ResponseEntity<JsonResult <?>> getEmbeddingModelInfo ()
chatClientBuilderWithObservation
private org.springframework.ai.chat.client.ChatClient.Builder chatClientBuilderWithObservation ()