Package dev.dokimos.server.service
Class LlmConnectionService
java.lang.Object
dev.dokimos.server.service.LlmConnectionService
Registers and reads LLM connections. Inline keys are encrypted before persistence; responses never
carry key material. Connection names are unique across the server.
-
Constructor Summary
ConstructorsConstructorDescriptionLlmConnectionService(LlmConnectionRepository connectionRepository, LlmCredentialService credentialService, EvalJobRepository evalJobRepository) -
Method Summary
Modifier and TypeMethodDescriptioncreate(CreateLlmConnectionRequest request, TenantScope scope) Registers a connection.voiddelete(UUID id, TenantScope scope) Deletes a connection along with its judge job queue records.get(UUID id, TenantScope scope) Returns a connection by id, visible under the scope.list(TenantScope scope) update(UUID id, UpdateLlmConnectionRequest request, TenantScope scope) Replaces a connection's name, base URL, and model, and optionally its credential.
-
Constructor Details
-
LlmConnectionService
public LlmConnectionService(LlmConnectionRepository connectionRepository, LlmCredentialService credentialService, EvalJobRepository evalJobRepository)
-
-
Method Details
-
create
@Transactional public LlmConnectionView create(CreateLlmConnectionRequest request, TenantScope scope) Registers a connection. Exactly one of an inline key or a credential reference is stored; an inline key is encrypted at rest.- Parameters:
request- the connection definition- Returns:
- the public view of the saved connection
- Throws:
IllegalStateException- if a connection with the same name already exists (mapped to 409)
-
list
-
get
Returns a connection by id, visible under the scope.- Throws:
IllegalArgumentException- if no connection has the id under the scope (mapped to 404)
-
update
@Transactional public LlmConnectionView update(UUID id, UpdateLlmConnectionRequest request, TenantScope scope) Replaces a connection's name, base URL, and model, and optionally its credential. A supplied inline key is encrypted and replaces the credential reference; a supplied credential reference replaces the inline key; supplying neither keeps the existing credential.- Parameters:
id- the connection to updaterequest- the new connection definition- Returns:
- the public view of the updated connection
- Throws:
IllegalArgumentException- if no connection has the id (mapped to 404)IllegalStateException- if the new name is already taken by another connection (mapped to 409)
-
delete
Deletes a connection along with its judge job queue records. The eval results those jobs produced remain on their run items, so deleting a connection never removes scoring history.- Parameters:
id- the connection to delete- Throws:
IllegalArgumentException- if no connection has the id (mapped to 404)
-