Refactor dependencies in pom.xml and remove commented code
This commit is contained in:
10
pom.xml
10
pom.xml
@@ -42,10 +42,12 @@
|
|||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
|
|
||||||
|
<!--<dependency>
|
||||||
<groupId>org.springframework.ai</groupId>
|
<groupId>org.springframework.ai</groupId>
|
||||||
<artifactId>spring-ai-mongodb-atlas-store-spring-boot-starter</artifactId>
|
<artifactId>spring-ai-mongodb-atlas-store-spring-boot-starter</artifactId>
|
||||||
</dependency>
|
</dependency>-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.ai</groupId>
|
<groupId>org.springframework.ai</groupId>
|
||||||
<artifactId>spring-ai-openai-spring-boot-starter</artifactId>
|
<artifactId>spring-ai-openai-spring-boot-starter</artifactId>
|
||||||
@@ -54,6 +56,10 @@
|
|||||||
<groupId>org.springframework.ai</groupId>
|
<groupId>org.springframework.ai</groupId>
|
||||||
<artifactId>spring-ai-azure-openai</artifactId>
|
<artifactId>spring-ai-azure-openai</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.ai</groupId>
|
||||||
|
<artifactId>spring-ai-azure-store</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.neo4j.driver</groupId>
|
<groupId>org.neo4j.driver</groupId>
|
||||||
<artifactId>neo4j-java-driver</artifactId>
|
<artifactId>neo4j-java-driver</artifactId>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.olympus.hermione.configurations;
|
package com.olympus.hermione.config;
|
||||||
|
|
||||||
import org.springframework.ai.azure.openai.AzureOpenAiEmbeddingModel;
|
import org.springframework.ai.azure.openai.AzureOpenAiEmbeddingModel;
|
||||||
import org.springframework.ai.embedding.EmbeddingModel;
|
import org.springframework.ai.embedding.EmbeddingModel;
|
||||||
@@ -11,25 +11,29 @@ import org.springframework.context.annotation.Primary;
|
|||||||
@Configuration
|
@Configuration
|
||||||
public class HermioneConfig {
|
public class HermioneConfig {
|
||||||
|
|
||||||
private final OpenAiEmbeddingModel myServiceLib1;
|
private final OpenAiEmbeddingModel openAiEmbeddingModel;
|
||||||
private final AzureOpenAiEmbeddingModel myServiceLib2;
|
private final AzureOpenAiEmbeddingModel azureOpenAiEmbeddingModel;
|
||||||
|
|
||||||
// Autowiring beans from both libraries
|
// Autowiring beans from both libraries
|
||||||
public HermioneConfig(OpenAiEmbeddingModel myServiceLib1, AzureOpenAiEmbeddingModel myServiceLib2) {
|
public HermioneConfig(OpenAiEmbeddingModel myServiceLib1,
|
||||||
this.myServiceLib1 = myServiceLib1;
|
AzureOpenAiEmbeddingModel azureOpenAiEmbeddingModel) {
|
||||||
this.myServiceLib2 = myServiceLib2;
|
this.openAiEmbeddingModel = myServiceLib1;
|
||||||
|
this.azureOpenAiEmbeddingModel = azureOpenAiEmbeddingModel;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Re-declaring and marking one as primary
|
// Re-declaring and marking one as primary
|
||||||
@Bean
|
@Bean
|
||||||
@Primary
|
|
||||||
public EmbeddingModel primaryMyService() {
|
public EmbeddingModel primaryMyService() {
|
||||||
return myServiceLib1; // Choose the one you want as primary
|
return openAiEmbeddingModel; // Choose the one you want as primary
|
||||||
}
|
}
|
||||||
|
|
||||||
// Optionally declare the other bean without primary
|
// Optionally declare the other bean without primary
|
||||||
@Bean
|
@Bean
|
||||||
|
@Primary
|
||||||
public EmbeddingModel secondaryMyService() {
|
public EmbeddingModel secondaryMyService() {
|
||||||
return myServiceLib2; // The other one
|
return azureOpenAiEmbeddingModel; // The other one
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package com.olympus.hermione.config;
|
||||||
|
|
||||||
|
import com.azure.core.credential.AzureKeyCredential;
|
||||||
|
import com.azure.search.documents.indexes.SearchIndexClient;
|
||||||
|
import com.azure.search.documents.indexes.SearchIndexClientBuilder;
|
||||||
|
import org.springframework.ai.embedding.EmbeddingModel;
|
||||||
|
import org.springframework.ai.vectorstore.VectorStore;
|
||||||
|
import org.springframework.ai.vectorstore.azure.AzureVectorStore;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class VectorStoreConfig {
|
||||||
|
|
||||||
|
|
||||||
|
@Value("${spring.ai.vectorstore.azure.api-key}")
|
||||||
|
private String azureKey;
|
||||||
|
@Value("${spring.ai.vectorstore.azure.url}")
|
||||||
|
private String azureEndpoint;
|
||||||
|
@Value("${spring.ai.vectorstore.azure.initialize-schema}")
|
||||||
|
private boolean initSchema;
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public SearchIndexClient searchIndexClient() {
|
||||||
|
return new SearchIndexClientBuilder().endpoint(azureEndpoint)
|
||||||
|
.credential(new AzureKeyCredential(azureKey))
|
||||||
|
.buildClient();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public VectorStore vectorStore(SearchIndexClient searchIndexClient, @Qualifier("azureOpenAiEmbeddingModel") EmbeddingModel embeddingModel) {
|
||||||
|
List<AzureVectorStore.MetadataField> fields = new ArrayList<>();
|
||||||
|
|
||||||
|
fields.add(AzureVectorStore.MetadataField.text("KsApplicationName"));
|
||||||
|
fields.add(AzureVectorStore.MetadataField.text("KsProjectName"));
|
||||||
|
fields.add(AzureVectorStore.MetadataField.text("KsDoctype"));
|
||||||
|
fields.add(AzureVectorStore.MetadataField.text("KsDocSource"));
|
||||||
|
fields.add(AzureVectorStore.MetadataField.text("KsFileSource"));
|
||||||
|
fields.add(AzureVectorStore.MetadataField.text("KsDocumentId"));
|
||||||
|
|
||||||
|
return new AzureVectorStore(searchIndexClient, embeddingModel,initSchema, fields);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -34,6 +34,7 @@ public class User implements UserDetails{
|
|||||||
private String password;
|
private String password;
|
||||||
private String name;
|
private String name;
|
||||||
private String surname;
|
private String surname;
|
||||||
|
|
||||||
@DocumentReference
|
@DocumentReference
|
||||||
private Project selectedProject;
|
private Project selectedProject;
|
||||||
@DocumentReference
|
@DocumentReference
|
||||||
|
|||||||
@@ -68,8 +68,6 @@ public class ScenarioExecutionService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
DiscoveryClient discoveryClient;
|
DiscoveryClient discoveryClient;
|
||||||
|
|
||||||
//@Autowired
|
|
||||||
//ChatModel chatModel;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
Driver graphDriver;
|
Driver graphDriver;
|
||||||
@@ -129,7 +127,6 @@ public class ScenarioExecutionService {
|
|||||||
scenarioExecution.setExecSharedMap(execSharedMap);
|
scenarioExecution.setExecSharedMap(execSharedMap);
|
||||||
scenarioExecutionRepository.save(scenarioExecution);
|
scenarioExecutionRepository.save(scenarioExecution);
|
||||||
|
|
||||||
//TODO: should be initialized with the scenario specific infos
|
|
||||||
Optional<AiModel> o_aiModel;
|
Optional<AiModel> o_aiModel;
|
||||||
if(scenario.getModelId() != null){
|
if(scenario.getModelId() != null){
|
||||||
o_aiModel = aiModelRepository.findById(scenario.getModelId());
|
o_aiModel = aiModelRepository.findById(scenario.getModelId());
|
||||||
@@ -161,7 +158,6 @@ public class ScenarioExecutionService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
List<ScenarioStep> steps = scenario.getSteps();
|
List<ScenarioStep> steps = scenario.getSteps();
|
||||||
String startStepId=scenario.getStartWithStepId();
|
String startStepId=scenario.getStartWithStepId();
|
||||||
|
|
||||||
|
|||||||
@@ -10,13 +10,19 @@ spring.ai.vectorstore.mongodb.indexName=vector_index
|
|||||||
spring.ai.vectorstore.mongodb.collection-name=vector_store
|
spring.ai.vectorstore.mongodb.collection-name=vector_store
|
||||||
spring.ai.vectorstore.mongodb.initialize-schema=false
|
spring.ai.vectorstore.mongodb.initialize-schema=false
|
||||||
|
|
||||||
|
spring.ai.vectorstore.azure.api-key=jxKqZvbMKuo1MwXs8ilEAeRDeswtoTXO1lWX600jP2AzSeDXo1nq
|
||||||
|
spring.ai.vectorstore.azure.url=https://search-olympus.search.windows.net
|
||||||
|
spring.ai.vectorstore.azure.initialize-schema =false
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
spring.ai.openai.api-key=sk-proj-j3TFJ0h348DIzMrYYfyUT3BlbkFJjk4HMc8A2ux2Asg8Y7H1
|
spring.ai.openai.api-key=sk-proj-j3TFJ0h348DIzMrYYfyUT3BlbkFJjk4HMc8A2ux2Asg8Y7H1
|
||||||
spring.ai.openai.chat.options.model=gpt-4o-mini
|
spring.ai.openai.chat.options.model=gpt-4o-mini
|
||||||
spring.main.allow-circular-references=true
|
spring.main.allow-circular-references=true
|
||||||
|
|
||||||
spring.ai.azure.openai.api-key=YOUR_API_KEY
|
spring.ai.azure.openai.api-key=9fb33cc69d914d4c8225b974876510b5
|
||||||
spring.ai.azure.openai.endpoint=YOUR_ENDPOINT
|
spring.ai.azure.openai.endpoint=https://ai-olympus.openai.azure.com/
|
||||||
spring.ai.azure.openai.chat.options.deployment-name=gpt-4o
|
spring.ai.azure.openai.chat.options.deployment-name=gpt-4o-mini
|
||||||
spring.ai.azure.openai.chat.options.temperature=0.7
|
spring.ai.azure.openai.chat.options.temperature=0.7
|
||||||
|
|
||||||
neo4j.uri=neo4j+s://e17e6f08.databases.neo4j.io:7687
|
neo4j.uri=neo4j+s://e17e6f08.databases.neo4j.io:7687
|
||||||
|
|||||||
Reference in New Issue
Block a user