Ontology
- class labelbox.schema.ontology.Ontology(*args, **kwargs)[source]
Bases:
DbObjectAn 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.
- class labelbox.schema.ontology.OntologyBuilder(tools: ~typing.List[~labelbox.schema.ontology.Tool | ~labelbox.schema.tool_building.step_reasoning_tool.StepReasoningTool] = <factory>, classifications: ~typing.List[~labelbox.schema.ontology.Classification | ~labelbox.schema.ontology.PromptResponseClassification] = <factory>)[source]
Bases:
objectA 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]
- classifications
(list)
- Type:
List[labelbox.schema.ontology.Classification | labelbox.schema.ontology.PromptResponseClassification]
- class labelbox.schema.ontology.PromptResponseClassification(class_type: ~labelbox.schema.ontology.PromptResponseClassification.Type, name: str | None = None, instructions: str | None = None, required: bool = True, options: ~typing.List[~labelbox.schema.ontology.ResponseOption] = <factory>, character_min: int | None = None, character_max: int | None = None, schema_id: str | None = None, feature_schema_id: str | None = None)[source]
Bases:
objectA PromptResponseClassification to be added to a Project’s ontology. The classification is dependent on the PromptResponseClassification Type.
To instantiate, the “class_type” and “name” parameters must be passed in.
The “options” parameter holds a list of Response Option objects. This is not necessary for some Classification types, such as RESPONSE_TEXT or PROMPT. To see which types require options, look at the “_REQUIRES_OPTIONS” class variable.
Example(s): >>> classification = PromptResponseClassification( >>> class_type = PromptResponseClassification.Type.Prompt, >>> character_min = 1, >>> character_max = 1 >>> name = “Prompt Classification Example”)
>>> classification_two = PromptResponseClassification( >>> class_type = PromptResponseClassification.Type.RESPONSE_RADIO, >>> name = "Second Example")
>>> classification_two.add_option(ResponseOption( >>> value = "Option Example"))
- class_type
(Classification.Type)
- name
(str)
- Type:
str | None
- instructions
(str)
- Type:
str | None
- required
(bool)
- Type:
bool
- options
(list)
- Type:
- character_min
(int)
- Type:
int | None
- character_max
(int)
- Type:
int | None
- schema_id
(str)
- Type:
str | None
- feature_schema_id
(str)
- Type:
str | None
- class labelbox.schema.ontology.ResponseOption(value: str | int, label: str | int | None = None, schema_id: str | None = None, feature_schema_id: str | None = None, options: ~typing.List[~labelbox.schema.ontology.Classification] | ~typing.List[~labelbox.schema.ontology.PromptResponseClassification] = <factory>)[source]
Bases:
OptionAn option is a possible answer within a PromptResponseClassification response object in a Project’s ontology.
To instantiate, only the “value” parameter needs to be passed in.
- Example(s):
option = ResponseOption(value = “Response Option Example”)
- value
(str)
- Type:
str | int
- schema_id
(str)
- Type:
str | None
- feature_schema_id
(str)
- Type:
str | None
- options
(list)
- Type:
List[labelbox.schema.ontology.Classification] | List[labelbox.schema.ontology.PromptResponseClassification]