diff --git a/pom.xml b/pom.xml
index e798dc1..f0432bf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -42,10 +42,12 @@
org.springframework.boot
spring-boot-starter-web
-
+
+
+
org.springframework.ai
spring-ai-openai-spring-boot-starter
@@ -54,6 +56,10 @@
org.springframework.ai
spring-ai-azure-openai
+
+ org.springframework.ai
+ spring-ai-azure-store
+
org.neo4j.driver
neo4j-java-driver
diff --git a/src/main/java/com/olympus/hermione/configurations/HermioneConfig.java b/src/main/java/com/olympus/hermione/config/HermioneConfig.java
similarity index 55%
rename from src/main/java/com/olympus/hermione/configurations/HermioneConfig.java
rename to src/main/java/com/olympus/hermione/config/HermioneConfig.java
index 717c04b..5daa131 100644
--- a/src/main/java/com/olympus/hermione/configurations/HermioneConfig.java
+++ b/src/main/java/com/olympus/hermione/config/HermioneConfig.java
@@ -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
}
+
+
}
diff --git a/src/main/java/com/olympus/hermione/config/VectorStoreConfig.java b/src/main/java/com/olympus/hermione/config/VectorStoreConfig.java
new file mode 100644
index 0000000..c47a7aa
--- /dev/null
+++ b/src/main/java/com/olympus/hermione/config/VectorStoreConfig.java
@@ -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 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);
+ }
+}
+
diff --git a/src/main/java/com/olympus/hermione/security/entity/User.java b/src/main/java/com/olympus/hermione/security/entity/User.java
index 4763be0..ef7576e 100644
--- a/src/main/java/com/olympus/hermione/security/entity/User.java
+++ b/src/main/java/com/olympus/hermione/security/entity/User.java
@@ -34,6 +34,7 @@ public class User implements UserDetails{
private String password;
private String name;
private String surname;
+
@DocumentReference
private Project selectedProject;
@DocumentReference
diff --git a/src/main/java/com/olympus/hermione/services/ScenarioExecutionService.java b/src/main/java/com/olympus/hermione/services/ScenarioExecutionService.java
index 4c1fba2..0183592 100644
--- a/src/main/java/com/olympus/hermione/services/ScenarioExecutionService.java
+++ b/src/main/java/com/olympus/hermione/services/ScenarioExecutionService.java
@@ -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 o_aiModel;
if(scenario.getModelId() != null){
o_aiModel = aiModelRepository.findById(scenario.getModelId());
@@ -159,7 +156,6 @@ public class ScenarioExecutionService {
)
.build();
}
-
List steps = scenario.getSteps();
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index c10a16a..e41aba6 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -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