Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config validation fix, response as text/plain, remove @Authenticated #16

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -25,7 +25,7 @@ public interface AssistantMultipartApi {
*/
@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(MediaType.APPLICATION_JSON)
@Produces(MediaType.TEXT_PLAIN)
Multi<String> assistantChatStreamingMp(
@Valid @BeanParam AssistantChatRequestMultipart multipartRequest
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@
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;

/**
* Admin API for Creating and Managing Assistants.
*/
@Authenticated
public class AssistantAdminApiImpl implements AssistantAdminApi {

@Inject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@
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;

/**
* Assistant API for Chatting using assistants.
*/
@Authenticated
public class AssistantMultipartApiImpl implements AssistantMultipartApi {

@Inject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@
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;

/**
* Admin API for Creating and Managing Assistants.
*/
@Authenticated
public class ContentRetrieverConnectionAdminApiImpl implements ContentRetrieverConnectionAdminApi {

@Inject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@
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;

/**
* Admin API for Creating and Managing Assistants.
*/
@Authenticated
public class LlmConnectionAdminApiImpl implements LlmConnectionAdminApi {

@Inject
Expand Down
6 changes: 1 addition & 5 deletions src/main/java/com/redhat/composer/api/nonspec/LlmApi.java
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ interface DocumentSplitConfig {
*
* @return max segment size
*/
@Min(50)
// TODO: Add @Min(50) back after ensuring Optional<Integer> stays validated in prod builds
Optional<Integer> defaultSegmentSizeInTokens();

/**
Expand All @@ -120,7 +120,7 @@ interface DocumentSplitConfig {
*
* @return segment overlap size
*/
@Min(0)
// TODO: Add @Min(0) back after ensuring Optional<Integer> stays validated in prod builds
Optional<Integer> defaultSegmentOverlapInTokens();

}
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/META-INF/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ paths:
'200':
description: OK
content:
application/json:
text/plain:
schema:
type: array
items:
Expand All @@ -365,7 +365,7 @@ paths:
'200':
description: OK
content:
application/json:
text/plain:
schema:
type: array
items:
Expand Down
Loading