5
5
import warnings
6
6
from enum import Enum
7
7
from typing import Annotated , Any , Dict , List , Optional , Type , Union
8
+ from dataclasses import field
8
9
9
10
from lbox .exceptions import InconsistentOntologyException
10
- from pydantic import StringConstraints , Field
11
+ from pydantic import StringConstraints , field
11
12
from pydantic .dataclasses import dataclass
12
13
13
14
from labelbox .orm .db_object import DbObject
14
- from labelbox .orm .model import Field as LB_Field , Relationship
15
+ from labelbox .orm .model import Field , Relationship
15
16
from labelbox .schema .tool_building .step_reasoning_tool import StepReasoningTool
16
17
from labelbox .schema .tool_building .tool_type import ToolType
17
18
@@ -35,9 +36,9 @@ def __str__(self):
35
36
36
37
37
38
class FeatureSchema (DbObject ):
38
- name = LB_Field .String ("name" )
39
- color = LB_Field .String ("name" )
40
- normalized = LB_Field .Json ("normalized" )
39
+ name = Field .String ("name" )
40
+ color = Field .String ("name" )
41
+ normalized = Field .Json ("normalized" )
41
42
42
43
43
44
@dataclass
@@ -64,7 +65,7 @@ class Option:
64
65
feature_schema_id : Optional [FeatureSchemaId ] = None
65
66
options : Union [
66
67
List ["Classification" ], List ["PromptResponseClassification" ]
67
- ] = Field (default_factory = list )
68
+ ] = field (default_factory = list )
68
69
69
70
def __post_init__ (self ):
70
71
if self .label is None :
@@ -160,7 +161,7 @@ class UIMode(Enum):
160
161
name : Optional [str ] = None
161
162
instructions : Optional [str ] = None
162
163
required : bool = False
163
- options : List [Option ] = Field (default_factory = list )
164
+ options : List [Option ] = field (default_factory = list )
164
165
schema_id : Optional [str ] = None
165
166
feature_schema_id : Optional [str ] = None
166
167
scope : Scope = None
@@ -344,7 +345,7 @@ class Type(Enum):
344
345
name : Optional [str ] = None
345
346
instructions : Optional [str ] = None
346
347
required : bool = True
347
- options : List [ResponseOption ] = Field (default_factory = list )
348
+ options : List [ResponseOption ] = field (default_factory = list )
348
349
character_min : Optional [int ] = None
349
350
character_max : Optional [int ] = None
350
351
schema_id : Optional [str ] = None
@@ -449,7 +450,7 @@ class Type(Enum):
449
450
name : str
450
451
required : bool = False
451
452
color : Optional [str ] = None
452
- classifications : List [Classification ] = Field (default_factory = list )
453
+ classifications : List [Classification ] = field (default_factory = list )
453
454
schema_id : Optional [str ] = None
454
455
feature_schema_id : Optional [str ] = None
455
456
@@ -517,13 +518,13 @@ class Ontology(DbObject):
517
518
created_by (Relationship): `ToOne` relationship to User
518
519
"""
519
520
520
- name = LB_Field .String ("name" )
521
- description = LB_Field .String ("description" )
522
- updated_at = LB_Field .DateTime ("updated_at" )
523
- created_at = LB_Field .DateTime ("created_at" )
524
- normalized = LB_Field .Json ("normalized" )
525
- object_schema_count = LB_Field .Int ("object_schema_count" )
526
- classification_schema_count = LB_Field .Int ("classification_schema_count" )
521
+ name = Field .String ("name" )
522
+ description = Field .String ("description" )
523
+ updated_at = Field .DateTime ("updated_at" )
524
+ created_at = Field .DateTime ("created_at" )
525
+ normalized = Field .Json ("normalized" )
526
+ object_schema_count = Field .Int ("object_schema_count" )
527
+ classification_schema_count = Field .Int ("classification_schema_count" )
527
528
528
529
projects = Relationship .ToMany ("Project" , True )
529
530
created_by = Relationship .ToOne ("User" , False , "created_by" )
@@ -596,10 +597,10 @@ class OntologyBuilder:
596
597
597
598
"""
598
599
599
- tools : List [Union [Tool , StepReasoningTool ]] = Field (default_factory = list )
600
+ tools : List [Union [Tool , StepReasoningTool ]] = field (default_factory = list )
600
601
classifications : List [
601
602
Union [Classification , PromptResponseClassification ]
602
- ] = Field (default_factory = list )
603
+ ] = field (default_factory = list )
603
604
604
605
@classmethod
605
606
def from_dict (cls , dictionary : Dict [str , Any ]) -> Dict [str , Any ]:
0 commit comments