Skip to main content

Set Up Pipeline

A Wyvern pipeline is the API route that defines the logistics of your ML application pipeline and it defines the API endpoint of yours. There are a couple of inputs:
  • REQUEST_SCHEMA_CLASS: the class of the request schema. This is used to validate the request data.
  • RESPONSE_SCHEMA_CLASS: the class of the response schema. This is used to validate the response data.
  • PATH: the path of the API. This is used in the API routing.
  • (Optional) API_VERSION: the version of the API. This is used in the API routing. The default value is “v1”. As a result, the final url of your pipeline will be /api/v1/{your PATH}
  • (Optional) API_NAME: the name of the API. This is used in the API routing. If not provided, the name of the pipeline component class will be used by default.
Now let’s define a PipelineComponent under pipelines/product_ranking/ranking_pipeline.py:
pipelines/product_ranking/ranking_pipeline.py
With this example, MyRankingRequest is the request schema and RankingResponse is the response schema. And the API url is /api/v1/my-ranking

Register Pipelines

Similar to registering realtime features, register the pipeline with the Wyvern service in pipelines/main.py:
pipelines/main.py
To register the pipeline, pass the the route_components as a list, containing your pipelines, to WyvernService.generate_app. This basically register the /api/v1/ranking route in the Wyvern service. Now if you do wyvern run, your ranking endpoint is ready to serve a request.