-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathCarinaConfig.java
30 lines (24 loc) · 965 Bytes
/
CarinaConfig.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package com.example.carina.config;
import org.springframework.ai.embedding.EmbeddingClient;
import org.springframework.ai.vectorstore.PgVectorStore;
import org.springframework.ai.vectorstore.SearchRequest;
import org.springframework.ai.vectorstore.VectorStore;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.retry.annotation.EnableRetry;
@Configuration
@EnableRetry
public class CarinaConfig {
@Bean
public VectorStore vectorStore(EmbeddingClient embeddingClient, JdbcTemplate jdbcTemplate) {
return new PgVectorStore(jdbcTemplate, embeddingClient);
}
@Bean
public SearchRequest searchRequest() {
SearchRequest searchRequest = SearchRequest.defaults();
searchRequest.withTopK(4);
searchRequest.withSimilarityThreshold(0.75);
return searchRequest;
}
}