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:
  • StreamingAssistant
  • Constructor Summary

    Constructors
    Constructor
    Description
    RestStreamingChannel(ai.yda.framework.core.assistant.StreamingAssistant<ai.yda.framework.rag.core.model.RagRequest,ai.yda.framework.rag.core.model.RagResponse> assistant)
    Constructs a new RestStreamingChannel instance with the specified StreamingAssistant instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    reactor.core.publisher.Flux<ai.yda.framework.rag.core.model.RagResponse>
    processRequest(ai.yda.framework.rag.core.model.RagRequest ragRequest)
    Processes the incoming RagRequest by delegating it to the StreamingAssistant.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 new RestStreamingChannel instance with the specified StreamingAssistant instance.
      Parameters:
      assistant - the StreamingAssistant instance used to process RagRequest and generate RagResponse in 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 incoming RagRequest by delegating it to the StreamingAssistant. This method is mapped to the HTTP POST method and handles the logic for processing a validated RagRequest. The request is passed to the streaming assistant, which performs the necessary operations to generate a RagResponse.
      Specified by:
      processRequest in interface ai.yda.framework.channel.core.StreamingChannel<ai.yda.framework.rag.core.model.RagRequest,ai.yda.framework.rag.core.model.RagResponse>
      Parameters:
      ragRequest - the RagRequest object containing the data to be processed.
      Returns:
      the stream of RagResponse objects generated by the assistant.