/ src / python / txtai / api / routers / workflow.py
workflow.py
 1  """
 2  Defines API paths for workflow endpoints.
 3  """
 4  
 5  from typing import List
 6  
 7  from fastapi import APIRouter, Body
 8  
 9  from .. import application
10  from ..route import EncodingAPIRoute
11  
12  router = APIRouter(route_class=EncodingAPIRoute)
13  
14  
15  @router.post("/workflow")
16  def workflow(name: str = Body(...), elements: List = Body(...)):
17      """
18      Executes a named workflow using elements as input.
19  
20      Args:
21          name: workflow name
22          elements: list of elements to run through workflow
23  
24      Returns:
25          list of processed elements
26      """
27  
28      return application.get().workflow(name, elements)