Skip to content

Commit bfac10f

Browse files
sunildkumarbrandonbrandon-wadaAuto-format Bot
authored
Version 0.12.0 (#120)
* bump version * Update UNSURE to be UNCLEAR, catch __USURE received from the service (#105) * ask_async (#102) * initial commit * added ask_async to submit_image_query * Automatically reformatting code * added ask async method * Automatically reformatting code * added integration tests (requires BE merge first) * Automatically reformatting code * satisfying mypy * Automatically reformatting code * fix comments * change what type of exception test is catching * Automatically reformatting code * fix imports organization issue * fix implementation - wait must be 0 not None * Automatically reformatting code * forgot to make wait=0 in relevant test * feedback from PR review * Automatically reformatting code * ensure want_async is a serializable bool * add description * updated sphinx reqs to render some of the dependencies * updated docstring for ask_async and fixed small sphinx bugs in other folk's docstrings * Tests aren't passing because I didn't update the autogenerated code to expect a new param * Revert "Tests aren't passing because I didn't update the autogenerated code to expect a new param" This reverts commit 2477fd5. * fix generated * Automatically reformatting code * fix lint * Automatically reformatting code * Revert "Automatically reformatting code" This reverts commit cb9359e. * Revert "fix generated" This reverts commit 935c036. * Revert "Revert "Tests aren't passing because I didn't update the autogenerated code to expect a new param"" This reverts commit 07670e3. * Revert "Tests aren't passing because I didn't update the autogenerated code to expect a new param" This reverts commit 2477fd5. * Revert "updated docstring for ask_async and fixed small sphinx bugs in other folk's docstrings" This reverts commit 67e3edd. * third time at generated docs is the charm --------- Co-authored-by: Auto-format Bot <[email protected]> * Cli polishing (#109) * Add basic catch if api token isn't specified when cli is called * Pushes Groundlight class instantiation up until the function is actually called with arguments. This means that the entire help args are available even if we can't instantiate the class (no api key) * Fixed misunderstanding with metaprogramming, added tests * Addressing comments --------- Co-authored-by: Auto-format Bot <[email protected]> * Add ask_confident and ask_ml (#99) * Adding ask_confident and ask_fast * Fixing ask_ml behavior * Unhide wait functions, merging logic, fixed iq_is_answered logic * Rewriting doc strings in Sphinx style * fixed sphinx docstring return types * Making iq submission with inspection work with newly optional patience time --------- Co-authored-by: Auto-format Bot <[email protected]> * Linting * fix ask_async docstring --------- Co-authored-by: brandon <[email protected]> Co-authored-by: Brandon <[email protected]> Co-authored-by: Auto-format Bot <[email protected]>
1 parent 4f7d529 commit bfac10f

File tree

17 files changed

+728
-235
lines changed

17 files changed

+728
-235
lines changed

.vscode/settings.json

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33
"editor.codeActionsOnSave": {
44
"source.organizeImports": true
55
},
6-
"python.analysis.extraPaths": ["./generated"],
7-
"python.formatting.provider": "black"
8-
}
6+
"editor.rulers": [
7+
100,
8+
120
9+
],
10+
"python.analysis.extraPaths": [
11+
"./generated"
12+
],
13+
"python.formatting.provider": "black",
14+
"[python]": {
15+
"editor.codeActionsOnSave": {
16+
"source.organizeImports": false
17+
}
18+
}
19+
}

generated/docs/ImageQueriesApi.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ with openapi_client.ApiClient(configuration) as api_client:
207207
detector_id = "detector_id_example" # str | Choose a detector by its ID.
208208
human_review = "human_review_example" # str | If set to `DEFAULT`, use the regular escalation logic (i.e., send the image query for human review if the ML model is not confident). If set to `ALWAYS`, always send the image query for human review even if the ML model is confident. If set to `NEVER`, never send the image query for human review even if the ML model is not confident. (optional)
209209
patience_time = 3.14 # float | How long to wait for a confident response. (optional)
210+
want_async = "want_async_example" # str | If \"true\" then submitting an image query returns immediately without a result. The result will be computed asynchronously and can be retrieved later. (optional)
210211
body = open('@path/to/image.jpeg', 'rb') # file_type | (optional)
211212

212213
# example passing only required values which don't have defaults set
@@ -219,7 +220,7 @@ with openapi_client.ApiClient(configuration) as api_client:
219220
# example passing only required values which don't have defaults set
220221
# and optional values
221222
try:
222-
api_response = api_instance.submit_image_query(detector_id, human_review=human_review, patience_time=patience_time, body=body)
223+
api_response = api_instance.submit_image_query(detector_id, human_review=human_review, patience_time=patience_time, want_async=want_async, body=body)
223224
pprint(api_response)
224225
except openapi_client.ApiException as e:
225226
print("Exception when calling ImageQueriesApi->submit_image_query: %s\n" % e)
@@ -233,6 +234,7 @@ Name | Type | Description | Notes
233234
**detector_id** | **str**| Choose a detector by its ID. |
234235
**human_review** | **str**| If set to &#x60;DEFAULT&#x60;, use the regular escalation logic (i.e., send the image query for human review if the ML model is not confident). If set to &#x60;ALWAYS&#x60;, always send the image query for human review even if the ML model is confident. If set to &#x60;NEVER&#x60;, never send the image query for human review even if the ML model is not confident. | [optional]
235236
**patience_time** | **float**| How long to wait for a confident response. | [optional]
237+
**want_async** | **str**| If \&quot;true\&quot; then submitting an image query returns immediately without a result. The result will be computed asynchronously and can be retrieved later. | [optional]
236238
**body** | **file_type**| | [optional]
237239

238240
### Return type

generated/docs/ImageQuery.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Name | Type | Description | Notes
1111
**query** | **str** | A question about the image. | [readonly]
1212
**detector_id** | **str** | Which detector was used on this image query? | [readonly]
1313
**result_type** | **bool, date, datetime, dict, float, int, list, str, none_type** | What type of result are we returning? | [readonly]
14-
**result** | **bool, date, datetime, dict, float, int, list, str, none_type** | | [readonly]
14+
**result** | **bool, date, datetime, dict, float, int, list, str, none_type** | | [optional] [readonly]
1515
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
1616

1717
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

generated/model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# generated by datamodel-codegen:
22
# filename: public-api.yaml
3-
# timestamp: 2023-08-09T20:46:11+00:00
3+
# timestamp: 2023-10-16T23:29:00+00:00
44

55
from __future__ import annotations
66

@@ -69,7 +69,7 @@ class ImageQuery(BaseModel):
6969
query: str = Field(..., description="A question about the image.")
7070
detector_id: str = Field(..., description="Which detector was used on this image query?")
7171
result_type: ResultTypeEnum = Field(..., description="What type of result are we returning?")
72-
result: ClassificationResult
72+
result: Optional[ClassificationResult] = None
7373

7474

7575
class PaginatedDetectorList(BaseModel):

generated/openapi_client/api/image_queries_api.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ def __init__(self, api_client=None):
133133
"detector_id",
134134
"human_review",
135135
"patience_time",
136+
"want_async",
136137
"body",
137138
],
138139
"required": [
@@ -149,17 +150,20 @@ def __init__(self, api_client=None):
149150
"detector_id": (str,),
150151
"human_review": (str,),
151152
"patience_time": (float,),
153+
"want_async": (str,),
152154
"body": (file_type,),
153155
},
154156
"attribute_map": {
155157
"detector_id": "detector_id",
156158
"human_review": "human_review",
157159
"patience_time": "patience_time",
160+
"want_async": "want_async",
158161
},
159162
"location_map": {
160163
"detector_id": "query",
161164
"human_review": "query",
162165
"patience_time": "query",
166+
"want_async": "query",
163167
"body": "body",
164168
},
165169
"collection_format_map": {},
@@ -299,6 +303,7 @@ def submit_image_query(self, detector_id, **kwargs):
299303
Keyword Args:
300304
human_review (str): If set to `DEFAULT`, use the regular escalation logic (i.e., send the image query for human review if the ML model is not confident). If set to `ALWAYS`, always send the image query for human review even if the ML model is confident. If set to `NEVER`, never send the image query for human review even if the ML model is not confident. . [optional]
301305
patience_time (float): How long to wait for a confident response.. [optional]
306+
want_async (str): If \"true\" then submitting an image query returns immediately without a result. The result will be computed asynchronously and can be retrieved later.. [optional]
302307
body (file_type): [optional]
303308
_return_http_data_only (bool): response data without head status
304309
code and headers. Default is True.

generated/openapi_client/model/image_query.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,7 @@ def discriminator():
168168

169169
@classmethod
170170
@convert_js_args_to_python_args
171-
def _from_openapi_data(
172-
cls, id, type, created_at, query, detector_id, result_type, result, *args, **kwargs
173-
): # noqa: E501
171+
def _from_openapi_data(cls, id, type, created_at, query, detector_id, result_type, *args, **kwargs): # noqa: E501
174172
"""ImageQuery - a model defined in OpenAPI
175173
176174
Args:
@@ -180,7 +178,6 @@ def _from_openapi_data(
180178
query (str): A question about the image.
181179
detector_id (str): Which detector was used on this image query?
182180
result_type (bool, date, datetime, dict, float, int, list, str, none_type): What type of result are we returning?
183-
result (bool, date, datetime, dict, float, int, list, str, none_type):
184181
185182
Keyword Args:
186183
_check_type (bool): if True, values for parameters in openapi_types
@@ -213,6 +210,7 @@ def _from_openapi_data(
213210
Animal class but this time we won't travel
214211
through its discriminator because we passed in
215212
_visited_composed_classes = (Animal,)
213+
result (bool, date, datetime, dict, float, int, list, str, none_type): [optional] # noqa: E501
216214
"""
217215

218216
_check_type = kwargs.pop("_check_type", True)
@@ -247,7 +245,6 @@ def _from_openapi_data(
247245
self.query = query
248246
self.detector_id = detector_id
249247
self.result_type = result_type
250-
self.result = result
251248
for var_name, var_value in kwargs.items():
252249
if (
253250
var_name not in self.attribute_map
@@ -306,6 +303,7 @@ def __init__(self, *args, **kwargs): # noqa: E501
306303
Animal class but this time we won't travel
307304
through its discriminator because we passed in
308305
_visited_composed_classes = (Animal,)
306+
result (bool, date, datetime, dict, float, int, list, str, none_type): [optional] # noqa: E501
309307
"""
310308

311309
_check_type = kwargs.pop("_check_type", True)

0 commit comments

Comments
 (0)