Class RestChannel

java.lang.Object
ai.yda.framework.channel.rest.spring.web.RestChannel
All Implemented Interfaces:
ai.yda.framework.channel.core.Channel<ai.yda.framework.rag.core.model.RagRequest,ai.yda.framework.rag.core.model.RagResponse>

@RestController @RequestMapping(path="${ai.yda.framework.channel.rest.spring.endpoint-relative-path:/}") public class RestChannel extends Object implements ai.yda.framework.channel.core.Channel<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 an assistant. The path of the endpoint is configurable via properties, allowing for flexibility in deployment.
Since:
0.1.0
See Also:
  • Assistant
  • Constructor Summary

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

    Modifier and Type
    Method
    Description
    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 Assistant.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RestChannel

      public RestChannel(ai.yda.framework.core.assistant.Assistant<ai.yda.framework.rag.core.model.RagRequest,ai.yda.framework.rag.core.model.RagResponse> assistant)
      Constructs a new RestChannel instance with the specified Assistant instance.
      Parameters:
      assistant - the Assistant instance used to process RagRequest and generate RagResponse.
  • Method Details

    • processRequest

      @PostMapping public 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 Assistant.

      This method is mapped to the HTTP POST method and handles the logic for processing a validated RagRequest. The request is passed to the assistant, which performs the necessary operations to generate a RagResponse.

      Specified by:
      processRequest in interface ai.yda.framework.channel.core.Channel<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 RagResponse object generated by the assistant.