Skip to content

Commit

Permalink
polish : upgrade to spring-ai 1.0.0-M1
Browse files Browse the repository at this point in the history
  • Loading branch information
JDA\1039060 committed Jul 6, 2024
1 parent 370e8c4 commit ae4d35e
Show file tree
Hide file tree
Showing 21 changed files with 65 additions and 37 deletions.
22 changes: 11 additions & 11 deletions chatbot/chatbot-openai-springai/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<properties>
<java.version>17</java.version>
<spotless.version>2.43.0</spotless.version>
<spring-ai.version>1.0.0-SNAPSHOT</spring-ai.version>
<spring-ai.version>1.0.0-M1</spring-ai.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -122,22 +122,22 @@

<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<releases>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</releases>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<releases>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</releases>
</snapshots>
</pluginRepository>
</pluginRepositories>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ spring.ai.openai.base-url=http://langchain4j.dev/demo/openai
spring.ai.openai.chat.options.model=gpt-3.5-turbo
spring.ai.openai.chat.options.temperature=0.7

spring.ai.vectorstore.milvus.collectionName=SpringAiCollection

spring.ai.openai.embedding.enabled=true

spring.testcontainers.beans.startup=parallel
8 changes: 4 additions & 4 deletions embeddingstores/neo4j-springai/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>21</java.version>
<spring-ai.version>0.8.1</spring-ai.version>
<spring-ai.version>1.0.0-M1</spring-ai.version>
<spotless.version>2.43.0</spotless.version>
</properties>

Expand Down Expand Up @@ -57,8 +57,8 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-testcontainers</artifactId>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-spring-boot-testcontainers</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -98,7 +98,7 @@
<configuration>
<java>
<palantirJavaFormat>
<version>2.40.0</version>
<version>2.47.0</version>
</palantirJavaFormat>
<importOrder />
<removeUnusedImports />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Neo4jVectorEmbeddingStoreExample {
class Neo4jVectorEmbeddingStoreExample {

public static void main(String[] args) {
SpringApplication.run(Neo4jVectorEmbeddingStoreExample.class, args);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.springframework.stereotype.Component;

@Component
public class Initializer implements CommandLineRunner {
class Initializer implements CommandLineRunner {

private final Neo4jVectorStoreService neo4jVectorStoreService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty(value = "spring.ai.openai.api-key", havingValue = "demo")
public class ResponseHeadersModification {
class ResponseHeadersModification {

@Bean
RestClient.Builder restClientBuilder() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@

@Configuration(proxyBeanMethods = false)
@OpenAPIDefinition(info = @Info(title = "pgvector-springai", version = "v1.0.0"), servers = @Server(url = "/"))
public class SwaggerConfig {}
class SwaggerConfig {}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

@RestController
@RequestMapping("/api/ai")
public class QueryController {
class QueryController {

private final Neo4jVectorStoreService neo4jVectorStoreService;

Expand Down
33 changes: 29 additions & 4 deletions embeddingstores/pgvector-springai/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>17</java.version>
<spring-ai.version>0.8.1</spring-ai.version>
<java.version>21</java.version>
<spring-ai.version>1.0.0-M1</spring-ai.version>

<spotless.version>2.43.0</spotless.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -56,8 +58,8 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-testcontainers</artifactId>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-spring-boot-testcontainers</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -90,6 +92,29 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>${spotless.version}</version>
<configuration>
<java>
<palantirJavaFormat>
<version>2.47.0</version>
</palantirJavaFormat>
<importOrder />
<removeUnusedImports />
<formatAnnotations />
</java>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.springframework.stereotype.Component;

@Component
public class Initializer implements CommandLineRunner {
class Initializer implements CommandLineRunner {

private final PgVectorStoreService pgVectorStoreService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty(value = "spring.ai.openai.api-key", havingValue = "demo")
public class ResponseHeadersModification {
class ResponseHeadersModification {

@Bean
RestClient.Builder restClientBuilder() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@

@Configuration(proxyBeanMethods = false)
@OpenAPIDefinition(info = @Info(title = "pgvector-springai", version = "v1.0.0"), servers = @Server(url = "/"))
public class SwaggerConfig {}
class SwaggerConfig {}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

@RestController
@RequestMapping("/api/ai")
public class QueryController {
class QueryController {

private final PgVectorStoreService pgVectorStoreService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.containsStringIgnoringCase;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.is;

Expand Down Expand Up @@ -70,7 +71,7 @@ void testRag() {
.post("/api/ai/chat")
.then()
.statusCode(200)
.body("queryResponse", containsString("yes"))
.body("queryResponse", containsStringIgnoringCase("yes"))
.log()
.all();
}
Expand All @@ -84,7 +85,7 @@ void testRag2() {
.post("/api/ai/chat")
.then()
.statusCode(200)
.body("queryResponse", containsString("No"))
.body("queryResponse", containsStringIgnoringCase("No"))
.log()
.all();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class LlmRagWithSpringAiApplication {
class LlmRagWithSpringAiApplication {

public static void main(String[] args) {
SpringApplication.run(LlmRagWithSpringAiApplication.class, args);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import org.springframework.jdbc.core.JdbcTemplate;

@Configuration(proxyBeanMethods = false)
public class AppConfig {
class AppConfig {
private static final Logger log = LoggerFactory.getLogger(AppConfig.class);

@Value("classpath:Rohit_Gurunath_Sharma.docx")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.springframework.context.annotation.Description;

@Configuration(proxyBeanMethods = false)
public class FunctionConfiguration {
class FunctionConfiguration {

private static final Logger log = LoggerFactory.getLogger(FunctionConfiguration.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

@Order(Ordered.HIGHEST_PRECEDENCE)
@ControllerAdvice
public class GlobalExceptionHandler {
class GlobalExceptionHandler {

@ExceptionHandler(MethodArgumentNotValidException.class)
@ResponseStatus(HttpStatus.BAD_REQUEST)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty(value = "spring.ai.openai.api-key", havingValue = "demo")
public class ResponseHeadersModification {
class ResponseHeadersModification {

private static final Logger LOGGER = LoggerFactory.getLogger(ResponseHeadersModification.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@

@Configuration(proxyBeanMethods = false)
@OpenAPIDefinition(info = @Info(title = "rag-springai-openai-llm", version = "v1.0.0"), servers = @Server(url = "/"))
public class SwaggerConfig {}
class SwaggerConfig {}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
@RestController
@RequestMapping("/api/ai")
@Validated
public class AiController {
class AiController {

private final AIChatService aiChatService;

Expand Down

0 comments on commit ae4d35e

Please sign in to comment.