Skip to main content

Train a basic engine

info

This is a preview of the new Shaped docs. Found an issue or have feedback? Let us know!

Engines are used for all retrieval and ranking in Shaped. Simple engines can be used for semantic search, while complex engines may do behaviour-based retrieval.

Engines are configured declaratively with YAML or JSON.

Write your engine config

Here is an example of a minimal semantic search engine:

# engine.yaml
version: v2
name: basic_engine
data:
item_table:
name: movielens_items # change this to your table name
index:
embeddings:
- name: content_embedding # enables vector search
encoder:
type: hugging_face
model_name: sentence-transformers/all-MiniLM-L6-v2
item_fields: # update these to your table's text columns
- movie_title
- description

Create your model via CLI

Upload the config file via CLI:

shaped create-model --file engine.yaml

Patch your model

If you make changes to your config and want to re-train your mode, use the update-model command:

shaped update-model --file engine.yaml