Class RestStreamingChannel
java.lang.Object
ai.yda.framework.channel.rest.spring.streaming.web.RestStreamingChannel
- All Implemented Interfaces:
ai.yda.framework.channel.core.StreamingChannel<ai.yda.framework.rag.core.model.RagRequest,ai.yda.framework.rag.core.model.RagResponse>
@RestController
@RequestMapping(path="${ai.yda.framework.channel.rest.spring.streaming.endpoint-relative-path:/}")
public class RestStreamingChannel
extends Object
implements ai.yda.framework.channel.core.StreamingChannel<ai.yda.framework.rag.core.model.RagRequest,ai.yda.framework.rag.core.model.RagResponse>
Provides REST controller logic that handles incoming requests for processing using a streaming assistant. The path
of the endpoint is configurable via properties, allowing for flexibility in deployment.
- Since:
- 0.1.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionRestStreamingChannel(ai.yda.framework.core.assistant.StreamingAssistant<ai.yda.framework.rag.core.model.RagRequest, ai.yda.framework.rag.core.model.RagResponse> assistant) Constructs a newRestStreamingChannelinstance with the specifiedStreamingAssistantinstance. -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Flux<ai.yda.framework.rag.core.model.RagResponse> processRequest(ai.yda.framework.rag.core.model.RagRequest ragRequest) Processes the incomingRagRequestby delegating it to theStreamingAssistant.
-
Constructor Details
-
RestStreamingChannel
public RestStreamingChannel(ai.yda.framework.core.assistant.StreamingAssistant<ai.yda.framework.rag.core.model.RagRequest, ai.yda.framework.rag.core.model.RagResponse> assistant) Constructs a newRestStreamingChannelinstance with the specifiedStreamingAssistantinstance.- Parameters:
assistant- theStreamingAssistantinstance used to processRagRequestand generateRagResponsein streaming manner.
-
-
Method Details
-
processRequest
@PostMapping(produces="text/event-stream") public reactor.core.publisher.Flux<ai.yda.framework.rag.core.model.RagResponse> processRequest(@RequestBody @Validated ai.yda.framework.rag.core.model.RagRequest ragRequest) Processes the incomingRagRequestby delegating it to theStreamingAssistant. This method is mapped to the HTTP POST method and handles the logic for processing a validatedRagRequest. The request is passed to the streaming assistant, which performs the necessary operations to generate aRagResponse.- Specified by:
processRequestin interfaceai.yda.framework.channel.core.StreamingChannel<ai.yda.framework.rag.core.model.RagRequest,ai.yda.framework.rag.core.model.RagResponse> - Parameters:
ragRequest- theRagRequestobject containing the data to be processed.- Returns:
- the
streamofRagResponseobjects generated by the assistant.
-