@dataclass
class ExternalImageSearchRequest:
image_ids: list[str]
@dataclass
class ExternalImageSearchResponse:
result: Optional[external.ImageSearchResponse]
error: Optional[str]
@function
def external_image_search(_, event: ExternalImageSearchRequest) -> ExternalImageSearchResponse:
try:
result, error = external.image_search(config, session, event.image_ids)
if error is not None:
return ExternalImageSearchResponse(None, dumps(error))
return ExternalImageSearchResponse(result, None)
except Exception as e:
return ExternalImageSearchResponse(None, dumps(e))
class ImageSearchResponseValue(TypedDict):
key_1: str
key_2: str
key_3: str
key_4: str
ImageSearchResponse = dict[str, list[ImageSearchResponseValue]]
Traceback (most recent call last):
@function
File "/app/client/queries/app.py", line 65, in <module>
^^^^^^^^
File "/app/client/run-env/lib/python3.11/site-packages/compute_modules/annotations.py", line 34, in function
return function_wrapper(maybe_func)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/client/run-env/lib/python3.11/site-packages/compute_modules/annotations.py", line 30, in function_wrapper
add_function(func, streaming=streaming, edits=edits)
File "/app/client/run-env/lib/python3.11/site-packages/compute_modules/function_registry/function_registry.py", line 41, in add_function
parse_result = parse_function_schema(
^^^^^^^^^^^^^^^^^^^^^^
File "/app/client/run-env/lib/python3.11/site-packages/compute_modules/function_registry/function_schema_parser.py", line 56, in parse_function_schema
^^^^^^^^^^^^^^^^^^^^^^^^^^^
output = _extract_output(type_hints)
File "/app/client/run-env/lib/python3.11/site-packages/compute_modules/function_registry/function_schema_parser.py", line 151, in _extract_output
output_data_type, _ = _extract_data_type(type_hints[RETURN_KEY])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/client/run-env/lib/python3.11/site-packages/compute_modules/function_registry/function_schema_parser.py", line 300, in _extract_data_type
custom_type_fields[field_name], child_class_node = _extract_data_type(field_type_hint)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/client/run-env/lib/python3.11/site-packages/compute_modules/function_registry/function_schema_parser.py", line 296, in _extract_data_type
File "/app/client/run-env/lib/python3.11/site-packages/compute_modules/function_registry/function_schema_parser.py", line 320, in _assert_is_valid_custom_type
_assert_is_valid_custom_type(type_hint)
if issubclass(item, dict):
^^^^^^^^^^^^^^^^^^^^^^
TypeError: issubclass() arg 1 must be a class
app.py:
external.py
trace: