Skip to content

Commit 04b627a

Browse files
committed
Remove test
1 parent 6019623 commit 04b627a

File tree

7 files changed

+13
-336
lines changed

7 files changed

+13
-336
lines changed

ai-agent/src/main/java/io/sentrius/agent/services/EndpointRegistry.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@
1111
import io.sentrius.sso.core.dto.agents.AgentMemoryDTO;
1212
import io.sentrius.sso.core.dto.agents.MemoryQueryDTO;
1313
import io.sentrius.sso.core.dto.capabilities.EndpointDescriptor;
14-
import io.sentrius.sso.core.dto.ztat.TokenDTO;
15-
import io.sentrius.sso.core.embeddings.EmbeddingService;
14+
import io.sentrius.sso.core.embeddings.EmbeddingServiceIfc;
1615
import io.sentrius.sso.core.exceptions.ZtatException;
1716
import io.sentrius.sso.core.services.agents.AgentClientService;
18-
import jakarta.annotation.PostConstruct;
1917
import lombok.RequiredArgsConstructor;
2018
import lombok.extern.slf4j.Slf4j;
2119
import org.springframework.stereotype.Component;
@@ -29,7 +27,7 @@ public class EndpointRegistry {
2927
Map<String, EndpointDescriptor> descriptorMap = new HashMap<>();
3028

3129
private final AgentClientService agentClientService;
32-
private final EmbeddingService embeddingService;
30+
private final EmbeddingServiceIfc embeddingService;
3331

3432
public void loadEndpoints(AgentExecution dto) throws ZtatException, JsonProcessingException {
3533
List<EndpointDescriptor> endpoints = agentClientService.getAvailableEndpoints(dto); // however you get them

ai-agent/src/main/java/io/sentrius/agent/services/EndpointSearcher.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@
55
import java.util.List;
66
import java.util.Map;
77
import java.util.Set;
8-
import java.util.stream.Collectors;
9-
import com.fasterxml.jackson.core.JsonProcessingException;
108
import io.sentrius.sso.core.dto.capabilities.EndpointDescriptor;
119
import io.sentrius.sso.core.dto.ztat.TokenDTO;
12-
import io.sentrius.sso.core.embeddings.EmbeddingService;
10+
import io.sentrius.sso.core.embeddings.EmbeddingServiceIfc;
1311
import io.sentrius.sso.core.exceptions.ZtatException;
1412
import io.sentrius.sso.core.services.endpoints.CosineSimilarity;
1513
import lombok.extern.slf4j.Slf4j;
@@ -19,11 +17,12 @@
1917
@Service
2018
public class EndpointSearcher {
2119

22-
private final EmbeddingService embeddingService;
20+
private final EmbeddingServiceIfc embeddingService;
2321
private final EndpointRegistry endpointRegistry;
2422

25-
public EndpointSearcher(EmbeddingService embeddingService,
26-
EndpointRegistry endpointRegistry
23+
public EndpointSearcher(
24+
EmbeddingServiceIfc embeddingService,
25+
EndpointRegistry endpointRegistry
2726
) {
2827

2928
this.embeddingService = embeddingService;

api/src/main/java/io/sentrius/sso/controllers/api/agents/AgentMemoryController.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import io.sentrius.sso.core.controllers.BaseController;
66
import io.sentrius.sso.core.dto.agents.AgentMemoryDTO;
77
import io.sentrius.sso.core.dto.agents.MemoryQueryDTO;
8-
import io.sentrius.sso.core.embeddings.EmbeddingService;
8+
import io.sentrius.sso.core.embeddings.EmbeddingServiceIfc;
99
import io.sentrius.sso.core.model.agents.AgentMemory;
1010
import io.sentrius.sso.core.model.security.enums.ApplicationAccessEnum;
1111
import io.sentrius.sso.core.services.ErrorOutputService;
@@ -24,14 +24,11 @@
2424
import org.springframework.format.annotation.DateTimeFormat;
2525
import org.springframework.http.HttpStatus;
2626
import org.springframework.http.ResponseEntity;
27-
import org.springframework.security.core.Authentication;
2827
import org.springframework.web.bind.annotation.*;
2928

3029
import jakarta.validation.Valid;
31-
import java.security.Principal;
3230
import java.time.LocalDateTime;
3331
import java.util.ArrayList;
34-
import java.util.Collection;
3532
import java.util.HashMap;
3633
import java.util.List;
3734
import java.util.Map;
@@ -46,11 +43,11 @@ public class AgentMemoryController extends BaseController {
4643
private final PersistentAgentMemoryStore memoryStore;
4744
private final VectorAgentMemoryStore vectorMemoryStore;
4845
private final UserAttributeService userAttributeService;
49-
private final EmbeddingService embeddingService;
46+
private final EmbeddingServiceIfc embeddingService;
5047

5148
public AgentMemoryController(PersistentAgentMemoryStore memoryStore, VectorAgentMemoryStore vectorMemoryStore, UserService userService, SystemOptions systemOptions, ErrorOutputService errorOutputService,
5249
UserAttributeService userAttributeService,
53-
EmbeddingService embeddingService
50+
EmbeddingServiceIfc embeddingService
5451
) {
5552
super(userService, systemOptions, errorOutputService);
5653
this.memoryStore = memoryStore;

core/src/main/java/io/sentrius/sso/core/embeddings/EmbeddingService.java renamed to core/src/main/java/io/sentrius/sso/core/embeddings/EmbeddingServiceIfc.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import io.sentrius.sso.core.dto.ztat.TokenDTO;
66
import io.sentrius.sso.core.exceptions.ZtatException;
77

8-
public interface EmbeddingService {
8+
public interface EmbeddingServiceIfc {
99
float[] embed(TokenDTO dto, String text) throws ZtatException, JsonProcessingException;
1010
List<float[]> embed(TokenDTO dto, List<String> text) throws ZtatException, JsonProcessingException;
1111
}

core/src/main/java/io/sentrius/sso/core/services/agents/EmbeddingService.java

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,13 @@
2525
@Service
2626
public class EmbeddingService {
2727

28-
private final RestTemplate restTemplate;
2928
private final String integrationProxyUrl;
3029
private final ZeroTrustClientService zeroTrustClientService;
3130

3231
public EmbeddingService(
33-
RestTemplate restTemplate,
3432
@Value("${sentrius.integration.proxyUrl:http://localhost:8081}") String integrationProxyUrl,
3533
ZeroTrustClientService zeroTrustClientService
3634
) {
37-
this.restTemplate = restTemplate;
3835
this.integrationProxyUrl = integrationProxyUrl;
3936
this.zeroTrustClientService = zeroTrustClientService;
4037
}
@@ -149,49 +146,7 @@ public float[] embed(String text) {
149146
}
150147
}
151148

152-
/**
153-
* Generate embeddings for multiple texts in batch via integration proxy
154-
*/
155-
public Map<String, float[]> embedBatch(List<String> texts) {
156-
if (texts == null || texts.isEmpty()) {
157-
return new HashMap<>();
158-
}
159149

160-
try {
161-
String url = integrationProxyUrl + "/api/v1/embeddings/generate/batch";
162-
HttpHeaders headers = createAuthHeaders();
163-
if (headers == null) {
164-
log.warn("No authentication context available for batch embedding generation");
165-
return new HashMap<>();
166-
}
167-
168-
Map<String, Object> requestBody = new HashMap<>();
169-
requestBody.put("texts", texts);
170-
171-
HttpEntity<Map<String, Object>> entity = new HttpEntity<>(requestBody, headers);
172-
173-
ResponseEntity<Map> response = restTemplate.exchange(url, HttpMethod.POST, entity, Map.class);
174-
175-
if (response.getStatusCode().is2xxSuccessful() && response.getBody() != null) {
176-
Map<String, Object> responseBody = response.getBody();
177-
178-
if (responseBody.containsKey("embeddings")) {
179-
@SuppressWarnings("unchecked")
180-
Map<String, float[]> embeddings = (Map<String, float[]>) responseBody.get("embeddings");
181-
182-
log.debug("Generated batch embeddings for {} texts", embeddings.size());
183-
return embeddings;
184-
}
185-
}
186-
187-
log.warn("Failed to generate batch embeddings - unexpected response format");
188-
return new HashMap<>();
189-
190-
} catch (Exception e) {
191-
log.error("Error generating batch embeddings for {} texts", texts.size(), e);
192-
return new HashMap<>();
193-
}
194-
}
195150

196151
/**
197152
* Calculate cosine similarity between two embeddings

core/src/main/java/io/sentrius/sso/core/services/agents/LLMService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import java.util.Map;
55
import com.fasterxml.jackson.core.JsonProcessingException;
66
import io.sentrius.sso.core.dto.ztat.TokenDTO;
7-
import io.sentrius.sso.core.embeddings.EmbeddingService;
7+
import io.sentrius.sso.core.embeddings.EmbeddingServiceIfc;
88
import io.sentrius.sso.core.exceptions.ZtatException;
99
import io.sentrius.sso.core.utils.JsonUtil;
1010
import org.springframework.beans.factory.annotation.Value;
@@ -13,7 +13,7 @@
1313

1414
@Service
1515
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
16-
public class LLMService implements EmbeddingService {
16+
public class LLMService implements EmbeddingServiceIfc {
1717

1818
final ZeroTrustClientService zeroTrustClientService;
1919

0 commit comments

Comments
 (0)