Ontology

class labelbox.schema.ontology.FeatureSchema(client, field_values)[source]

Bases: DbObject

class labelbox.schema.ontology.Ontology(*args, **kwargs)[source]

Bases: DbObject

An ontology specifies which tools and classifications are available to a project. This is read only for now. .. attribute:: name

type:

str

description
Type:

str

updated_at
Type:

datetime

created_at
Type:

datetime

normalized
Type:

json

object_schema_count
Type:

int

classification_schema_count
Type:

int

projects

ToMany relationship to Project

Type:

Relationship

created_by

ToOne relationship to User

Type:

Relationship

classifications() List[Classification | PromptResponseClassification][source]

Get list of classifications in an Ontology.

tools() List[Tool][source]

Get list of tools (AKA objects) in an Ontology.

class labelbox.schema.ontology.OntologyBuilder(tools: ~typing.List[~labelbox.schema.ontology.Tool | ~labelbox.schema.tool_building.step_reasoning_tool.StepReasoningTool | ~labelbox.schema.tool_building.fact_checking_tool.FactCheckingTool | ~labelbox.schema.tool_building.prompt_issue_tool.PromptIssueTool] = <factory>, classifications: ~typing.List[~labelbox.schema.tool_building.classification.Classification | ~labelbox.schema.tool_building.classification.PromptResponseClassification] = <factory>)[source]

Bases: object

A class to help create an ontology for a Project. This should be used for making Project ontologies from scratch. OntologyBuilder can also pull from an already existing Project’s ontology.

There are no required instantiation arguments.

To create an ontology, use the asdict() method after fully building your ontology within this class, and inserting it into client.create_ontology() as the “normalized” parameter.

Example

>>> builder = OntologyBuilder()
>>> ...
>>> ontology = client.create_ontology(
>>>    "Ontology from new features",
>>>    ontology_builder.asdict(),
>>>    media_type=lb.MediaType.Image,
>>> )
>>> project.connect_ontology(ontology)
tools

(list)

Type:

List[labelbox.schema.ontology.Tool | labelbox.schema.tool_building.step_reasoning_tool.StepReasoningTool | labelbox.schema.tool_building.fact_checking_tool.FactCheckingTool | labelbox.schema.tool_building.prompt_issue_tool.PromptIssueTool]

classifications

(list)

Type:

List[labelbox.schema.tool_building.classification.Classification | labelbox.schema.tool_building.classification.PromptResponseClassification]