From d36ed587d328e5337ac565537a7eefbd110987fd Mon Sep 17 00:00:00 2001 From: Travis Hairfield Date: Mon, 25 Nov 2024 12:51:19 -0800 Subject: [PATCH] Enable create_ontology to upsert --- libs/labelbox/src/labelbox/client.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libs/labelbox/src/labelbox/client.py b/libs/labelbox/src/labelbox/client.py index 6269f4927..b067f317a 100644 --- a/libs/labelbox/src/labelbox/client.py +++ b/libs/labelbox/src/labelbox/client.py @@ -1334,6 +1334,7 @@ def create_ontology( normalized, media_type: MediaType = None, ontology_kind: OntologyKind = None, + ontology_id: str = None, ) -> Ontology: """ Creates an ontology from normalized data @@ -1354,6 +1355,7 @@ def create_ontology( media_type (MediaType or None): Media type of a new ontology ontology_kind (OntologyKind or None): set to OntologyKind.ModelEvaluation if the ontology is for chat evaluation or OntologyKind.ResponseCreation if ontology is for response creation, leave as None otherwise. + ontology_id (str): The id of the ontology to update Returns: The created Ontology @@ -1390,6 +1392,8 @@ def create_ontology( "mediaType": media_type_value, } } + if ontology_id is not None: + params["data"]["id"] = ontology_id if editor_task_type_value: params["data"]["editorTaskType"] = editor_task_type_value