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>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
|
||||
<!--<dependency>
|
||||
<groupId>org.springframework.ai</groupId>
|
||||
<artifactId>spring-ai-mongodb-atlas-store-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
</dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.ai</groupId>
|
||||
<artifactId>spring-ai-openai-spring-boot-starter</artifactId>
|
||||
@@ -54,6 +56,10 @@
|
||||
<groupId>org.springframework.ai</groupId>
|
||||
<artifactId>spring-ai-azure-openai</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.ai</groupId>
|
||||
<artifactId>spring-ai-azure-store</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.neo4j.driver</groupId>
|
||||
<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.embedding.EmbeddingModel;
|
||||
@@ -11,25 +11,29 @@ import org.springframework.context.annotation.Primary;
|
||||
@Configuration
|
||||
public class HermioneConfig {
|
||||
|
||||
private final OpenAiEmbeddingModel myServiceLib1;
|
||||
private final AzureOpenAiEmbeddingModel myServiceLib2;
|
||||
|
||||
private final OpenAiEmbeddingModel openAiEmbeddingModel;
|
||||
private final AzureOpenAiEmbeddingModel azureOpenAiEmbeddingModel;
|
||||
|
||||
// Autowiring beans from both libraries
|
||||
public HermioneConfig(OpenAiEmbeddingModel myServiceLib1, AzureOpenAiEmbeddingModel myServiceLib2) {
|
||||
this.myServiceLib1 = myServiceLib1;
|
||||
this.myServiceLib2 = myServiceLib2;
|
||||
public HermioneConfig(OpenAiEmbeddingModel myServiceLib1,
|
||||
AzureOpenAiEmbeddingModel azureOpenAiEmbeddingModel) {
|
||||
this.openAiEmbeddingModel = myServiceLib1;
|
||||
this.azureOpenAiEmbeddingModel = azureOpenAiEmbeddingModel;
|
||||
|
||||
}
|
||||
|
||||
// Re-declaring and marking one as primary
|
||||
@Bean
|
||||
@Primary
|
||||
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
|
||||
@Bean
|
||||
@Primary
|
||||
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 name;
|
||||
private String surname;
|
||||
|
||||
@DocumentReference
|
||||
private Project selectedProject;
|
||||
@DocumentReference
|
||||
|
||||
@@ -68,8 +68,6 @@ public class ScenarioExecutionService {
|
||||
@Autowired
|
||||
DiscoveryClient discoveryClient;
|
||||
|
||||
//@Autowired
|
||||
//ChatModel chatModel;
|
||||
|
||||
@Autowired
|
||||
Driver graphDriver;
|
||||
@@ -129,7 +127,6 @@ public class ScenarioExecutionService {
|
||||
scenarioExecution.setExecSharedMap(execSharedMap);
|
||||
scenarioExecutionRepository.save(scenarioExecution);
|
||||
|
||||
//TODO: should be initialized with the scenario specific infos
|
||||
Optional<AiModel> o_aiModel;
|
||||
if(scenario.getModelId() != null){
|
||||
o_aiModel = aiModelRepository.findById(scenario.getModelId());
|
||||
@@ -159,7 +156,6 @@ public class ScenarioExecutionService {
|
||||
)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
|
||||
List<ScenarioStep> steps = scenario.getSteps();
|
||||
|
||||
@@ -10,13 +10,19 @@ spring.ai.vectorstore.mongodb.indexName=vector_index
|
||||
spring.ai.vectorstore.mongodb.collection-name=vector_store
|
||||
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.chat.options.model=gpt-4o-mini
|
||||
spring.main.allow-circular-references=true
|
||||
|
||||
spring.ai.azure.openai.api-key=YOUR_API_KEY
|
||||
spring.ai.azure.openai.endpoint=YOUR_ENDPOINT
|
||||
spring.ai.azure.openai.chat.options.deployment-name=gpt-4o
|
||||
spring.ai.azure.openai.api-key=9fb33cc69d914d4c8225b974876510b5
|
||||
spring.ai.azure.openai.endpoint=https://ai-olympus.openai.azure.com/
|
||||
spring.ai.azure.openai.chat.options.deployment-name=gpt-4o-mini
|
||||
spring.ai.azure.openai.chat.options.temperature=0.7
|
||||
|
||||
neo4j.uri=neo4j+s://e17e6f08.databases.neo4j.io:7687
|
||||
|
||||
Reference in New Issue
Block a user