Merge branch 'master' into develop
This commit is contained in:
@@ -34,16 +34,17 @@ stages:
|
|||||||
|
|
||||||
- script: |
|
- script: |
|
||||||
echo "Building the first repository..."
|
echo "Building the first repository..."
|
||||||
|
pwd
|
||||||
ls -lrth
|
ls -lrth
|
||||||
displayName: 'list files'
|
displayName: 'list files'
|
||||||
|
|
||||||
- task: Maven@3
|
- task: Maven@4
|
||||||
inputs:
|
inputs:
|
||||||
mavenPomFile: 'olympus-common/pom.xml'
|
mavenPomFile: 'olympus-common/pom.xml'
|
||||||
goals: 'install'
|
goals: 'install'
|
||||||
displayName: 'Build olympus-common'
|
displayName: 'Build olympus-common'
|
||||||
|
|
||||||
- task: Maven@3
|
- task: Maven@4
|
||||||
inputs:
|
inputs:
|
||||||
mavenPomFile: 'hermione/pom.xml'
|
mavenPomFile: 'hermione/pom.xml'
|
||||||
goals: 'install -DskipTests'
|
goals: 'install -DskipTests'
|
||||||
@@ -68,8 +69,15 @@ stages:
|
|||||||
docker images
|
docker images
|
||||||
displayName: 'List docker images'
|
displayName: 'List docker images'
|
||||||
|
|
||||||
- upload: hermione/manifests
|
- script: |
|
||||||
artifact: manifests
|
echo "Removing Docker images to clean up..."
|
||||||
|
docker rmi $(docker images -q)
|
||||||
|
displayName: 'Clean up Docker Images'
|
||||||
|
continueOnError: true
|
||||||
|
condition: always()
|
||||||
|
|
||||||
|
#- upload: hermione/manifests
|
||||||
|
# artifact: manifests
|
||||||
|
|
||||||
- stage: Deploy
|
- stage: Deploy
|
||||||
displayName: Deploy stage
|
displayName: Deploy stage
|
||||||
@@ -88,6 +96,7 @@ stages:
|
|||||||
runOnce:
|
runOnce:
|
||||||
deploy:
|
deploy:
|
||||||
steps:
|
steps:
|
||||||
|
- checkout: self
|
||||||
- script: |
|
- script: |
|
||||||
echo "##vso[task.setvariable variable=shortCommitSha]$(echo $(Build.SourceVersion) | cut -c1-8)"
|
echo "##vso[task.setvariable variable=shortCommitSha]$(echo $(Build.SourceVersion) | cut -c1-8)"
|
||||||
displayName: 'Set Short Commit SHA'
|
displayName: 'Set Short Commit SHA'
|
||||||
@@ -97,18 +106,12 @@ stages:
|
|||||||
echo "Short Commit SHA: $(shortCommitSha)"
|
echo "Short Commit SHA: $(shortCommitSha)"
|
||||||
displayName: 'Echo short commit SHA'
|
displayName: 'Echo short commit SHA'
|
||||||
|
|
||||||
- task: KubernetesManifest@0
|
- task: KubernetesManifest@1
|
||||||
displayName: Deploy to Kubernetes cluster
|
displayName: Deploy to Kubernetes cluster
|
||||||
inputs:
|
inputs:
|
||||||
action: deploy
|
action: deploy
|
||||||
|
namespace: olympus
|
||||||
manifests: |
|
manifests: |
|
||||||
$(Pipeline.Workspace)/manifests/hermione-deployment.yaml
|
$(Pipeline.Workspace)/manifests/hermione-deployment.yaml
|
||||||
containers: |
|
containers: |
|
||||||
$(azurecontainerRegistry)/$(imageName):$(shortCommitSha)
|
$(azurecontainerRegistry)/$(imageName):$(shortCommitSha)
|
||||||
|
|
||||||
- script: |
|
|
||||||
echo "Removing Docker images to clean up..."
|
|
||||||
docker rmi $(docker images -q)
|
|
||||||
displayName: 'Clean up Docker Images'
|
|
||||||
continueOnError: true
|
|
||||||
condition: always()
|
|
||||||
@@ -16,6 +16,9 @@ spec:
|
|||||||
containers:
|
containers:
|
||||||
- name: hermione
|
- name: hermione
|
||||||
image: olympusreg.azurecr.io/hermione:a843dee4
|
image: olympusreg.azurecr.io/hermione:a843dee4
|
||||||
|
env:
|
||||||
|
- name: DEFAULT_CONNECTION_IDLE_TIMEOUT
|
||||||
|
value: "300"
|
||||||
envFrom:
|
envFrom:
|
||||||
- configMapRef:
|
- configMapRef:
|
||||||
name: olympus-db-shared-cfg
|
name: olympus-db-shared-cfg
|
||||||
|
|||||||
4
pom.xml
4
pom.xml
@@ -60,6 +60,10 @@
|
|||||||
<groupId>org.springframework.ai</groupId>
|
<groupId>org.springframework.ai</groupId>
|
||||||
<artifactId>spring-ai-azure-store</artifactId>
|
<artifactId>spring-ai-azure-store</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.ai</groupId>
|
||||||
|
<artifactId>spring-ai-chroma-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>
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ import org.slf4j.Logger;
|
|||||||
import com.azure.ai.openai.OpenAIClient;
|
import com.azure.ai.openai.OpenAIClient;
|
||||||
import com.azure.ai.openai.OpenAIClientBuilder;
|
import com.azure.ai.openai.OpenAIClientBuilder;
|
||||||
import com.azure.core.credential.AzureKeyCredential;
|
import com.azure.core.credential.AzureKeyCredential;
|
||||||
|
import com.olympus.hermione.stepSolvers.ExternalAgentSolver;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -239,7 +240,9 @@ public class ScenarioExecutionService {
|
|||||||
case "RAG_SOURCE_CODE":
|
case "RAG_SOURCE_CODE":
|
||||||
solver = new SourceCodeRagSolver();
|
solver = new SourceCodeRagSolver();
|
||||||
break;
|
break;
|
||||||
|
case "EXTERNAL_AGENT":
|
||||||
|
solver = new ExternalAgentSolver();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,145 @@
|
|||||||
|
package com.olympus.hermione.stepSolvers;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.http.HttpEntity;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.http.HttpMethod;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import com.olympus.hermione.models.ScenarioExecution;
|
||||||
|
import com.olympus.hermione.utility.AttributeParser;
|
||||||
|
|
||||||
|
import ch.qos.logback.classic.Logger;
|
||||||
|
|
||||||
|
public class ExternalAgentSolver extends StepSolver {
|
||||||
|
|
||||||
|
private String agent_input;
|
||||||
|
private String agent_base_url;
|
||||||
|
private String agent_output_variable;
|
||||||
|
private String agent_application;
|
||||||
|
private String agent_project;
|
||||||
|
|
||||||
|
Logger logger = (Logger) LoggerFactory.getLogger(BasicQueryRagSolver.class);
|
||||||
|
|
||||||
|
private void loadParameters(){
|
||||||
|
logger.info("Loading parameters");
|
||||||
|
|
||||||
|
if(this.step.getAttributes().get("agent_input")!=null ){
|
||||||
|
this.agent_input = (String) this.step.getAttributes().get("agent_input");
|
||||||
|
logger.info("agent_input: " + this.agent_input);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.step.getAttributes().get("agent_application")!=null ){
|
||||||
|
this.agent_input = (String) this.step.getAttributes().get("agent_application");
|
||||||
|
logger.info("agent_application: " + this.agent_application);
|
||||||
|
}
|
||||||
|
if(this.step.getAttributes().get("agent_project")!=null ){
|
||||||
|
this.agent_project = (String) this.step.getAttributes().get("agent_project");
|
||||||
|
logger.info("agent_project: " + this.agent_project);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.step.getAttributes().get("agent_base_url")!=null ){
|
||||||
|
this.agent_base_url = (String) this.step.getAttributes().get("agent_base_url");
|
||||||
|
logger.info("agent_base_url: " + this.agent_base_url);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.step.getAttributes().get("agent_output_variable")!=null ){
|
||||||
|
this.agent_output_variable = (String) this.step.getAttributes().get("agent_output_variable");
|
||||||
|
logger.info("agent_output_variable: " + this.agent_output_variable);
|
||||||
|
}
|
||||||
|
|
||||||
|
AttributeParser attributeParser = new AttributeParser(this.scenarioExecution);
|
||||||
|
|
||||||
|
this.agent_input = attributeParser.parse((String) this.step.getAttributes().get("agent_input"));
|
||||||
|
this.agent_application = attributeParser.parse((String) this.step.getAttributes().get("agent_application"));
|
||||||
|
this.agent_project = attributeParser.parse((String) this.step.getAttributes().get("agent_project"));
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ScenarioExecution solveStep() throws Exception {
|
||||||
|
|
||||||
|
System.out.println("Solving step: " + this.step.getName());
|
||||||
|
|
||||||
|
this.scenarioExecution.setCurrentStepId(this.step.getStepId());
|
||||||
|
|
||||||
|
loadParameters();
|
||||||
|
|
||||||
|
|
||||||
|
RestTemplate restTemplate = new RestTemplate();
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
|
||||||
|
JSONObject requestBody = new JSONObject();
|
||||||
|
requestBody.put("executionId", this.scenarioExecution.getId());
|
||||||
|
requestBody.put("user_input", this.agent_input);
|
||||||
|
requestBody.put("application", this.agent_application);
|
||||||
|
requestBody.put("project", this.agent_project);
|
||||||
|
|
||||||
|
HttpEntity<String> request = new HttpEntity<>(requestBody.toString(), headers);
|
||||||
|
|
||||||
|
ResponseEntity<String> response = restTemplate.exchange(
|
||||||
|
this.agent_base_url+"/execute",
|
||||||
|
HttpMethod.POST,
|
||||||
|
request,
|
||||||
|
String.class
|
||||||
|
);
|
||||||
|
|
||||||
|
JSONObject jsonResponse = new JSONObject(response.getBody());
|
||||||
|
|
||||||
|
if (!jsonResponse.get("status").equals("STARTED")) {
|
||||||
|
throw new Exception("Agent execution failed with status: " + jsonResponse.get("status"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int maxTries = 500;
|
||||||
|
// Pool the status GET api until it return the SUCCESS or FAILED message
|
||||||
|
while(!jsonResponse.get("status").equals("COMPLETED") && !jsonResponse.get("status").equals("FAILED") && maxTries > 0){
|
||||||
|
response = restTemplate.exchange(
|
||||||
|
this.agent_base_url + "/status/" + this.scenarioExecution.getId(),
|
||||||
|
HttpMethod.GET,
|
||||||
|
request,
|
||||||
|
String.class
|
||||||
|
);
|
||||||
|
jsonResponse = new JSONObject(response.getBody());
|
||||||
|
|
||||||
|
try {
|
||||||
|
Thread.sleep(2000);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
logger.error("Thread was interrupted", e);
|
||||||
|
}
|
||||||
|
logger.info ("Check status => Remaining tryes :" + maxTries);
|
||||||
|
maxTries--;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.info ("Stop pooling agents pod. Latest status = "+jsonResponse.get("status"));
|
||||||
|
|
||||||
|
if(jsonResponse.get("status").equals("COMPLETED")){
|
||||||
|
response = restTemplate.exchange(
|
||||||
|
this.agent_base_url + "/execution_result/" + this.scenarioExecution.getId(),
|
||||||
|
HttpMethod.GET,
|
||||||
|
request,
|
||||||
|
String.class
|
||||||
|
);
|
||||||
|
jsonResponse = new JSONObject(response.getBody());
|
||||||
|
|
||||||
|
this.scenarioExecution.getExecSharedMap().put(this.agent_output_variable, jsonResponse.toString());
|
||||||
|
this.scenarioExecution.setNextStepId(this.step.getNextStepId());
|
||||||
|
|
||||||
|
}else{
|
||||||
|
logger.error ("ERROR on pooling Agents");
|
||||||
|
|
||||||
|
throw new Exception("Agent execution failed with status: " + jsonResponse.get("status"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return this.scenarioExecution;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -27,7 +27,7 @@ public class StepSolver {
|
|||||||
|
|
||||||
private Logger logger = LoggerFactory.getLogger(StepSolver.class);
|
private Logger logger = LoggerFactory.getLogger(StepSolver.class);
|
||||||
|
|
||||||
public ScenarioExecution solveStep(){
|
public ScenarioExecution solveStep() throws Exception {
|
||||||
logger.info("Solving step: " + this.step.getName());
|
logger.info("Solving step: " + this.step.getName());
|
||||||
this.scenarioExecution.setCurrentStepId(this.step.getStepId());
|
this.scenarioExecution.setCurrentStepId(this.step.getStepId());
|
||||||
this.scenarioExecution.setNextStepId(this.step.getNextStepId());
|
this.scenarioExecution.setNextStepId(this.step.getNextStepId());
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ 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.api-key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||||
spring.ai.vectorstore.azure.url=https://search-olympus.search.windows.net
|
spring.ai.vectorstore.azure.url=https://search-olympus.search.windows.net_old
|
||||||
spring.ai.vectorstore.azure.initialize-schema =false
|
spring.ai.vectorstore.azure.initialize-schema =false
|
||||||
|
|
||||||
|
|
||||||
@@ -58,4 +58,10 @@ eureka.instance.preferIpAddress: true
|
|||||||
hermione.fe.url = http://localhost:5173
|
hermione.fe.url = http://localhost:5173
|
||||||
|
|
||||||
java-parser-module.url: http://java-parser-module-service.olympus.svc.cluster.local:8080
|
java-parser-module.url: http://java-parser-module-service.olympus.svc.cluster.local:8080
|
||||||
|
java-re-module.url: http://java-re-module-service.olympus.svc.cluster.local:8080
|
||||||
|
|
||||||
|
spring.ai.vectorstore.chroma.client.host=http://108.142.74.161
|
||||||
|
spring.ai.vectorstore.chroma.client.port=8000
|
||||||
|
spring.ai.vectorstore.chroma.client.key-token=nVYLh3eq92aJP4x08dNdWngilPG2ooj9
|
||||||
|
spring.ai.vectorstore.chroma.initialize-schema=true
|
||||||
|
spring.ai.vectorstore.chroma.collection-name=olympus
|
||||||
Reference in New Issue
Block a user