XpressAI/xircuits

Does the type decorator works?

Closed this issue · 4 comments

Reference
#86

I feel like the type decorator doesn't change the type when we specify the type with the type keyword in the xai_decorator. Here why I said that.

Each type will have different InArgs and OutArgs by default as shown here. We can see how the type was set in the GENERAL category.

Assuming changing the type using the decorator, that component should be by default have the correct InArgs and OutArgs.
For example, if I did something like this in the script :

@xai_component(type="math")
class NewMath(Component):

    def __init__(self):

        self.done = False

    def execute(self) -> None:
        
        self.done = True

Expected Result(should be the same as Math Operation's component):
Newmath expected
math

Actual Result:
Newmath Actual

I could be wrong in expecting that result since I assumed type works like that.

treo commented

It works as related to having that type on the component itself.

Components that are defined as components aren't in the GENERAL category though.

If it only ever affects those in GENERAL, then it didn't do anything before either 😂

I see. I was hoping it could affects those not in GENERAL though.

treo commented

It does the same thing as before, which is "put a type value on the component that is returned".

As far as I can tell, that value only really changes something for components in the GENERAL category, but we were still putting them on a few components in the ADVANCED category.

I didn't dive into the code that is processing the type value, but if we actually want it to do something we can add that. However, that wasn't the point of the referenced pull request. The point of the pull request was simply to get rid of some hard coded values that where detached from the components they were referring to.

The point of the pull request was simply to get rid of some hard coded values that where detached from the components they were referring to.

Yeah, my bad. I assumed that pull request can do the impossible or non-existing things.

Also, I'll close this issue as you already answered my question.