Working with Models
Working with Models
One of the most important parts of the Kodexa Platform is the ability to create and manage models. Models are the core of the platform and are used to extract data from documents. Models are created by using Python and the Kodexa SDK.
In its simplest form, a model is simply a small Python script that receives a Document and returns a Document. The model can be as simple as:
You would put this code in a module, i.e.
Deployment
To deploy the model, we need to also create a model.yml
file that describes the model. This file is used to describe the model, and also to provide the metadata that is used to deploy the model to the Kodexa Platform.
The model definition is simple, it has a slug, version, orgSlug, type, storeType, name and metadata. The metadata is the most important part of the model definition. The metadata is used to describe the model and is used to deploy the model to the Kodexa Platform. In our first model, we said the model is not trainable and has no options for inference. We can now deploy this model to try it out.
If you are logged in, you can deploy the model using the command line tools.
Debugging a Deploy
Sometimes you will want to understand what is in a deployment of a model. There are a couple of things you can do to understand what is on the server.
First, you can set the deploy to keep a ZIP representation. This will allow you to see what was finally packaged in the model, you do this by updating the model.yml, i.e.
The second way you can use is to download an implementation from the server, this is also useful for debugging if there is an issue in your deployment setup.
You can use the Kodexa CLI to run: