From b4c8156995989a8b6acd38ebf561006185217b7d Mon Sep 17 00:00:00 2001 From: Robert Grimm Date: Wed, 11 Dec 2024 11:21:40 -0600 Subject: [PATCH] Config fix, response as text/plain, remove @Authenticated * Configuration of Optional is temporarily removed to avoid errors. --- .../java/com/redhat/composer/api/AssistantMultipartApi.java | 4 ++-- .../com/redhat/composer/api/impl/AssistantAdminApiImpl.java | 2 -- .../java/com/redhat/composer/api/impl/AssistantApiImpl.java | 2 -- .../redhat/composer/api/impl/AssistantMultipartApiImpl.java | 2 -- .../api/impl/ContentRetrieverConnectionAdminApiImpl.java | 2 -- .../redhat/composer/api/impl/LlmConnectionAdminApiImpl.java | 2 -- src/main/java/com/redhat/composer/api/nonspec/LlmApi.java | 6 +----- .../composer/api/nonspec/validation/OidcValidationApi.java | 6 ++---- .../composer/config/application/ContentRetrieverConfig.java | 4 ++-- src/main/resources/META-INF/openapi.yml | 4 ++-- 10 files changed, 9 insertions(+), 25 deletions(-) diff --git a/src/main/java/com/redhat/composer/api/AssistantMultipartApi.java b/src/main/java/com/redhat/composer/api/AssistantMultipartApi.java index 3c19cab..73cb7fa 100644 --- a/src/main/java/com/redhat/composer/api/AssistantMultipartApi.java +++ b/src/main/java/com/redhat/composer/api/AssistantMultipartApi.java @@ -5,9 +5,9 @@ import jakarta.validation.Valid; import jakarta.ws.rs.BeanParam; import jakarta.ws.rs.Consumes; -import jakarta.ws.rs.Produces; import jakarta.ws.rs.POST; import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; import jakarta.ws.rs.core.MediaType; /** @@ -25,7 +25,7 @@ public interface AssistantMultipartApi { */ @POST @Consumes(MediaType.MULTIPART_FORM_DATA) - @Produces(MediaType.APPLICATION_JSON) + @Produces(MediaType.TEXT_PLAIN) Multi assistantChatStreamingMp( @Valid @BeanParam AssistantChatRequestMultipart multipartRequest ); diff --git a/src/main/java/com/redhat/composer/api/impl/AssistantAdminApiImpl.java b/src/main/java/com/redhat/composer/api/impl/AssistantAdminApiImpl.java index b00440b..a48deb7 100644 --- a/src/main/java/com/redhat/composer/api/impl/AssistantAdminApiImpl.java +++ b/src/main/java/com/redhat/composer/api/impl/AssistantAdminApiImpl.java @@ -6,7 +6,6 @@ import com.redhat.composer.api.model.CreateAssistantRequest; import com.redhat.composer.services.AssistantInfoService; import com.redhat.composer.util.mappers.BsonMapper; -import io.quarkus.security.Authenticated; import jakarta.inject.Inject; import java.util.List; @@ -14,7 +13,6 @@ /** * Admin API for Creating and Managing Assistants. */ -@Authenticated public class AssistantAdminApiImpl implements AssistantAdminApi { @Inject diff --git a/src/main/java/com/redhat/composer/api/impl/AssistantApiImpl.java b/src/main/java/com/redhat/composer/api/impl/AssistantApiImpl.java index bb47628..cf3f72f 100644 --- a/src/main/java/com/redhat/composer/api/impl/AssistantApiImpl.java +++ b/src/main/java/com/redhat/composer/api/impl/AssistantApiImpl.java @@ -4,14 +4,12 @@ import com.redhat.composer.api.mapper.AssistantMapper; import com.redhat.composer.api.model.AssistantChatMessage; import com.redhat.composer.services.ChatBotService; -import io.quarkus.security.Authenticated; import io.smallrye.mutiny.Multi; import jakarta.inject.Inject; /** * Assistant API for Chatting using assistants. */ -@Authenticated public class AssistantApiImpl implements AssistantApi { @Inject diff --git a/src/main/java/com/redhat/composer/api/impl/AssistantMultipartApiImpl.java b/src/main/java/com/redhat/composer/api/impl/AssistantMultipartApiImpl.java index f832134..ee82e2b 100644 --- a/src/main/java/com/redhat/composer/api/impl/AssistantMultipartApiImpl.java +++ b/src/main/java/com/redhat/composer/api/impl/AssistantMultipartApiImpl.java @@ -7,7 +7,6 @@ import com.redhat.composer.services.ChatBotService; import dev.langchain4j.data.document.loader.FileSystemDocumentLoader; import dev.langchain4j.data.document.parser.apache.tika.ApacheTikaDocumentParser; -import io.quarkus.security.Authenticated; import io.smallrye.mutiny.Multi; import jakarta.inject.Inject; import org.apache.tika.metadata.Metadata; @@ -15,7 +14,6 @@ /** * Assistant API for Chatting using assistants. */ -@Authenticated public class AssistantMultipartApiImpl implements AssistantMultipartApi { @Inject diff --git a/src/main/java/com/redhat/composer/api/impl/ContentRetrieverConnectionAdminApiImpl.java b/src/main/java/com/redhat/composer/api/impl/ContentRetrieverConnectionAdminApiImpl.java index cb695a7..40eba8c 100644 --- a/src/main/java/com/redhat/composer/api/impl/ContentRetrieverConnectionAdminApiImpl.java +++ b/src/main/java/com/redhat/composer/api/impl/ContentRetrieverConnectionAdminApiImpl.java @@ -6,7 +6,6 @@ import com.redhat.composer.api.model.RetrieverConnection; import com.redhat.composer.services.AssistantInfoService; import com.redhat.composer.util.mappers.BsonMapper; -import io.quarkus.security.Authenticated; import jakarta.inject.Inject; import java.util.List; @@ -14,7 +13,6 @@ /** * Admin API for Creating and Managing Assistants. */ -@Authenticated public class ContentRetrieverConnectionAdminApiImpl implements ContentRetrieverConnectionAdminApi { @Inject diff --git a/src/main/java/com/redhat/composer/api/impl/LlmConnectionAdminApiImpl.java b/src/main/java/com/redhat/composer/api/impl/LlmConnectionAdminApiImpl.java index 6ff9bf9..2f9b241 100644 --- a/src/main/java/com/redhat/composer/api/impl/LlmConnectionAdminApiImpl.java +++ b/src/main/java/com/redhat/composer/api/impl/LlmConnectionAdminApiImpl.java @@ -6,7 +6,6 @@ import com.redhat.composer.api.model.LLMConnection; import com.redhat.composer.services.AssistantInfoService; import com.redhat.composer.util.mappers.BsonMapper; -import io.quarkus.security.Authenticated; import jakarta.inject.Inject; import java.util.List; @@ -14,7 +13,6 @@ /** * Admin API for Creating and Managing Assistants. */ -@Authenticated public class LlmConnectionAdminApiImpl implements LlmConnectionAdminApi { @Inject diff --git a/src/main/java/com/redhat/composer/api/nonspec/LlmApi.java b/src/main/java/com/redhat/composer/api/nonspec/LlmApi.java index 628e3a2..a90d156 100644 --- a/src/main/java/com/redhat/composer/api/nonspec/LlmApi.java +++ b/src/main/java/com/redhat/composer/api/nonspec/LlmApi.java @@ -1,28 +1,24 @@ package com.redhat.composer.api.nonspec; -import org.jboss.logging.Logger; - import com.redhat.composer.config.llm.models.streaming.StreamingBaseModel; import com.redhat.composer.config.llm.models.streaming.StreamingModelFactory; import com.redhat.composer.config.llm.models.synchronous.SynchronousBaseModel; import com.redhat.composer.config.llm.models.synchronous.SynchronousModelFactory; import com.redhat.composer.model.request.LLMRequest; - import dev.langchain4j.model.chat.ChatLanguageModel; import dev.langchain4j.model.chat.StreamingChatLanguageModel; import dev.langchain4j.service.AiServices; -import io.quarkus.security.Authenticated; import io.smallrye.mutiny.Multi; import jakarta.inject.Inject; import jakarta.ws.rs.POST; import jakarta.ws.rs.Path; import jakarta.ws.rs.QueryParam; +import org.jboss.logging.Logger; /** * Api For Testing the LLM. */ @Path("/llm") -@Authenticated public class LlmApi { Logger log = Logger.getLogger(LlmApi.class); diff --git a/src/main/java/com/redhat/composer/api/nonspec/validation/OidcValidationApi.java b/src/main/java/com/redhat/composer/api/nonspec/validation/OidcValidationApi.java index c9577f5..701d496 100644 --- a/src/main/java/com/redhat/composer/api/nonspec/validation/OidcValidationApi.java +++ b/src/main/java/com/redhat/composer/api/nonspec/validation/OidcValidationApi.java @@ -1,18 +1,16 @@ package com.redhat.composer.api.nonspec.validation; -import java.util.Set; - -import io.quarkus.security.Authenticated; import io.quarkus.security.identity.SecurityIdentity; import jakarta.inject.Inject; import jakarta.ws.rs.GET; import jakarta.ws.rs.Path; +import java.util.Set; + /** * OIDCValidationAPI. */ @Path("/auth") -@Authenticated public class OidcValidationApi { @Inject diff --git a/src/main/java/com/redhat/composer/config/application/ContentRetrieverConfig.java b/src/main/java/com/redhat/composer/config/application/ContentRetrieverConfig.java index 00bf83f..a385f70 100644 --- a/src/main/java/com/redhat/composer/config/application/ContentRetrieverConfig.java +++ b/src/main/java/com/redhat/composer/config/application/ContentRetrieverConfig.java @@ -106,7 +106,7 @@ interface DocumentSplitConfig { * * @return max segment size */ - @Min(50) + // TODO: Add @Min(50) back after ensuring Optional stays validated in prod builds Optional defaultSegmentSizeInTokens(); /** @@ -120,7 +120,7 @@ interface DocumentSplitConfig { * * @return segment overlap size */ - @Min(0) + // TODO: Add @Min(0) back after ensuring Optional stays validated in prod builds Optional defaultSegmentOverlapInTokens(); } diff --git a/src/main/resources/META-INF/openapi.yml b/src/main/resources/META-INF/openapi.yml index 91adb65..471588a 100644 --- a/src/main/resources/META-INF/openapi.yml +++ b/src/main/resources/META-INF/openapi.yml @@ -338,7 +338,7 @@ paths: '200': description: OK content: - application/json: + text/plain: schema: type: array items: @@ -365,7 +365,7 @@ paths: '200': description: OK content: - application/json: + text/plain: schema: type: array items: