Skip to content

In SuperComponent utils update _is_compatible(type1, type2) to return the common type #9076

@sjrl

Description

@sjrl

In SuperComponents during the validation of an input_mapping provided by a user we check if the types of the combined inputs are compatible using the _is_compatible utility function. _is_compatible works by checking if the two types have some overlapping common type rather than using strict type validation.

This is helpful because it can quickly alert a user if a mapping is not possible due to an incompatible type.

However, after this compatibility check we then assign one of the types (e.g. type1 or type2) as the overall type of the input socket to the SuperComponent. This isn't 100% accurate because we should use the overlapping type of the two types.

So my suggestion would be to expand on _is_compatible to also return the detected overlapping type between type1 and type2 which we could use to assign as the overall type for that input socket.

Metadata

Metadata

Assignees

Labels

P2Medium priority, add to the next sprint if no P1 available

Type

No type

Projects

No projects

Milestone

No milestone

Development

Participants

@mpangrazzi@julian-risch@sjrl

Issue actions

    In SuperComponent utils update `_is_compatible(type1, type2)` to return the common type · Issue #9076 · deepset-ai/haystack