haystack icon indicating copy to clipboard operation
haystack copied to clipboard

Update `FileTypeRouter` so its output sockets names are valid identifiers

Open silvanocerza opened this issue 1 year ago • 0 comments

FileTypeRouter output sockets are MIME type names. This makes them non valid Python identifiers as they may contain invalid characters like / or -.

We must make sure that the output sockets names are valid Python identifiers so they can be used with autocompletion and can be accessed using the Sockets class.

e.g

router = FileTypeRouter(mime_types=["text/plain", "audio/x-wav", "image/jpeg"])

router.outputs.text_plain
router.outputs.audio_x_wav

We should also update all occurences that still use strings in Pipeline.connect() after this is fixed.

silvanocerza avatar Feb 01 '24 17:02 silvanocerza