Skip to main content

Open in Colab

GitHub

Client

Create an ontology

Each Tool and Classification type requires a specific value to be passed when creating the feature.
FeatureClassValue
Bounding boxToolBBOX
PolygonToolPOLYGON
PolylineToolLINE
PointToolPOINT
Segmentation maskToolRASTER_SEGMENTATION
RelationshipToolRELATIONSHIP
EntityToolNER
Message rankingToolMESSAGE_RANKING
Single message selectionToolMESSAGE_SINGLE_SELECTION
Multiple message selectionToolMESSAGE_MULTI_SELECTION
Message step reasoningToolSTEP_REASONING
Fact-checkingToolFACT_CHECKING
Prompt ratingToolPROMPT_ISSUE
RadioClassificationRADIO
ChecklistClassificationCHECKLIST
TextClassificationTEXT
When you create an ontology, specify the media_type parameter, which represents the modality of the data rows that the ontology will be used to label. Certain features are only compatible with certain media types.

Specify an ontology media type

The media_type parameter of client.create_ontology defaults to None, but it’s highly recommended to specify one for validation and error handling.
The media_type parameter takes the following values:
  • lb.MediaType.Audio
  • lb.MediaType.Conversational
  • lb.MediaType.Document
  • lb.MediaType.Geospatial_Tile
  • lb.MediaType.Html
  • lb.MediaType.Image
  • lb.MediaType.Simple_Tile
  • lb.MediaType.Text
  • lb.MediaType.Video

Create ontologies from new features

You can define new features to build new ontologies. The following code sample shows how to create simple features for upserting into ontologies. To learn more about creating features, see Features.
You can then create an ontology with your defined features either using ontology_builder or client.create_ontology_from_feature_schemas().
For more complex ontology creation examples, see Ontology examples guide .

Create from normalized JSON format

  • Users can create ontologies from a JSON definition of the ontology.
  • Each tool type requires a specific value to be passed:
ToolValue
Bounding boxrectangle
Polygonpolygon
Polylineline
Pointpoint
Segmentation maskraster-segmentation
Entitynamed-entity

Create from existing features

If you already have features created, you can query them by name or by schema id. Re-using an existing feature is highly recommended.

Create a nested ontology

You can create a child feature nested under a parent feature. Only classification features can be children of a nested ontology. For instance, if you want to create an ontology where a bounding box has a radio sub-classification, you will add a classificationsfield that contains a list of classification features as children.

Get ontologies

Check if a feature is archived in an ontology

Get all unused ontologies

Delete an unused ontology

Connect an ontology to a project

Methods

Get the tools

Get the classifications

Attributes