Skip to content

Commit dc8d562

Browse files
committed
Model config response count support
1 parent 2fab8c9 commit dc8d562

3 files changed

Lines changed: 11 additions & 3 deletions

File tree

libs/labelbox/src/labelbox/schema/project.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,18 +1118,19 @@ def get_label_count(self) -> int:
11181118
res = self.client.execute(query_str, {"projectId": self.uid})
11191119
return res["project"]["labelCount"]
11201120

1121-
def add_model_config(self, model_config_id: str) -> str:
1121+
def add_model_config(self, model_config_id: str, response_count: Optional[int] = None) -> str:
11221122
"""Adds a model config to this project.
11231123
11241124
Args:
11251125
model_config_id (str): ID of a model config to add to this project.
1126+
response_count (Optional[int]): Number of responses to generate. If not provided, uses the default.
11261127
11271128
Returns:
11281129
str, ID of the project model config association. This is needed for updating and deleting associations.
11291130
"""
11301131

1131-
query = """mutation CreateProjectModelConfigPyApi($projectId: ID!, $modelConfigId: ID!) {
1132-
createProjectModelConfig(input: {projectId: $projectId, modelConfigId: $modelConfigId}) {
1132+
query = """mutation CreateProjectModelConfigPyApi($projectId: ID!, $modelConfigId: ID!, $responseCount: Int) {
1133+
createProjectModelConfig(input: {projectId: $projectId, modelConfigId: $modelConfigId, responseCount: $responseCount}) {
11331134
projectModelConfigId
11341135
}
11351136
}"""
@@ -1138,6 +1139,9 @@ def add_model_config(self, model_config_id: str) -> str:
11381139
"projectId": self.uid,
11391140
"modelConfigId": model_config_id,
11401141
}
1142+
1143+
if response_count is not None:
1144+
params["responseCount"] = response_count
11411145
try:
11421146
result = self.client.execute(query, params)
11431147
except LabelboxError as e:

requirements-dev.lock

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
# features: []
77
# all-features: true
88
# with-sources: false
9+
# generate-hashes: false
10+
# universal: false
911

1012
-e file:libs/labelbox
1113
-e file:libs/lbox-clients

requirements.lock

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
# features: []
77
# all-features: true
88
# with-sources: false
9+
# generate-hashes: false
10+
# universal: false
911

1012
-e file:libs/labelbox
1113
-e file:libs/lbox-clients

0 commit comments

Comments
 (0)