@@ -169,7 +169,7 @@ class AnalyzedTypeInfo:
169169def analyze_type_info (t : Any ) -> AnalyzedTypeInfo :
170170 """
171171 Analyze a Python type annotation and extract CocoIndex-specific type information.
172- Only concrete CocoIndex type annotations are supported . Raises ValueError for Any, empty, or untyped dict types.
172+ Type annotations for specific CocoIndex types are expected . Raises ValueError for Any, empty, or untyped dict types.
173173 """
174174 if isinstance (t , tuple ) and len (t ) == 2 :
175175 kt , vt = t
@@ -240,11 +240,12 @@ def analyze_type_info(t: Any) -> AnalyzedTypeInfo:
240240 _ = DtypeRegistry .validate_dtype_and_get_kind (elem_type )
241241 vector_info = VectorInfo (dim = None ) if vector_info is None else vector_info
242242
243- elif base_type is collections .abc .Mapping or base_type is dict :
243+ elif base_type is collections .abc .Mapping or base_type is dict or t is dict :
244244 args = typing .get_args (t )
245245 if len (args ) == 0 : # Handle untyped dict
246246 raise ValueError (
247- "Untyped dict is not supported; please provide a concrete type, e.g., dict[str, Any]."
247+ "Untyped dict is not accepted as a specific type annotation; please provide a concrete type, "
248+ "e.g. a dataclass or namedtuple for Struct types, a dict[str, T] for KTable types."
248249 )
249250 else :
250251 elem_type = (args [0 ], args [1 ])
@@ -288,12 +289,10 @@ def analyze_type_info(t: Any) -> AnalyzedTypeInfo:
288289 kind = "OffsetDateTime"
289290 elif t is datetime .timedelta :
290291 kind = "TimeDelta"
291- elif t is dict :
292+ else :
292293 raise ValueError (
293- "Untyped dict is not supported; please provide a concrete type, e.g., dict[str, Any]. "
294+ f"Unsupported as a specific type annotation for CocoIndex data type (https://cocoindex.io/docs/core/data_types): { t } "
294295 )
295- else :
296- raise ValueError (f"type unsupported yet: { t } " )
297296
298297 return AnalyzedTypeInfo (
299298 kind = kind ,
0 commit comments