Skip to content

Commit

Permalink
fix configuration setup
Browse files Browse the repository at this point in the history
  • Loading branch information
lburgazzoli committed Mar 21, 2024
1 parent 740228d commit e173a71
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,24 @@

import io.smallrye.config.ConfigMapping;
import io.smallrye.config.WithDefault;
import io.smallrye.config.WithName;

@ConfigMapping
@ConfigMapping(prefix = "camel.assistant")
public interface AssistantConfiguration {

Qdrant qdrant();

interface Qdrant {
@WithName("collection.name")
String collectionName();
Collection collection();

@WithDefault("localhost")
@WithName("host")
String host();

@WithDefault("6334")
@WithName("grpc.port")
int grpcPort();
int port();

interface Collection {
@WithDefault("camel")
String name();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class AssistantEmbeddingStoreService {
@Named
QdrantEmbeddingStore store() {
return QdrantEmbeddingStore.builder()
.collectionName(configuration.qdrant().collectionName())
.collectionName(configuration.qdrant().collection().name())
.client(client)
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class AssistantProducers {
public QdrantClient qdrantClient(AssistantConfiguration configuration) {
QdrantGrpcClient gc = QdrantGrpcClient.newBuilder(
configuration.qdrant().host(),
configuration.qdrant().grpcPort(),
configuration.qdrant().port(),
false)
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ public class AssistantReadiness implements HealthCheck {
public HealthCheckResponse call() {
HealthCheckResponseBuilder rb = HealthCheckResponse.named("Qdrant connection health check")
.withData("qdrant.host", configuration.qdrant().host())
.withData("qdrant.port", configuration.qdrant().grpcPort())
.withData("qdrant.collection", configuration.qdrant().collectionName());
.withData("qdrant.port", configuration.qdrant().port())
.withData("qdrant.collection", configuration.qdrant().collection().name());

try {
Collections.CollectionInfo reply =
client.getCollectionInfoAsync(configuration.qdrant().collectionName(), Duration.ofSeconds(5)).get();
client.getCollectionInfoAsync(configuration.qdrant().collection().name(), Duration.ofSeconds(5)).get();

rb.withData("collection.status", reply.getStatus().name());

Expand Down
6 changes: 3 additions & 3 deletions assistant-backend/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
quarkus.banner.enabled=false

qdrant.collection.name=camel
qdrant.host=${QDRANT_HOST:localhost}
qdrant.grpc.port=${QDRANT_GRPC_PORT:6334}
camel.assistant.qdrant.collection.name=camel
camel.assistant.qdrant.host=${QDRANT_HOST:localhost}
camel.assistant.qdrant.port=${QDRANT_GRPC_PORT:6334}

# Override this for using with a different AI service
quarkus.langchain4j.chat-model.provider=ollama
Expand Down

0 comments on commit e173a71

Please sign in to comment.