Skip to content

Enable create_ontology to upsert #1921

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions libs/labelbox/src/labelbox/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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

Expand Down