in aidial_interceptors_sdk/utils/streaming.py [0:0]
def _annotate(value: dict | DialException) -> AnnotatedValue:
if isinstance(value, dict):
return AnnotatedChunk(chunk=value, annotation=annotation)
else:
return AnnotatedException(error=value, annotation=annotation)