-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Description
Problem
Currently, the BaseNode framework requires all Inputs and Outputs fields to be typed as str, which leads to several issues:
- Type casting required: Developers need to manually cast values (e.g.,
int(self.inputs.items)) - Type ignore comments: Multiple
# type: ignorecomments are needed to suppress type checker warnings - Loss of type safety: The framework doesn't leverage Python's type system effectively
- Poor developer experience: IDE support and autocompletion are limited
Example
Currently we need to write:
class Inputs(BaseModel):
items: str # Should be int
async def execute(self):
count = int(self.inputs.items) # type: ignore
return [self.Outputs(processed=str(i)) for i in range(count)]Instead of the more natural:
class Inputs(BaseModel):
items: int
async def execute(self):
count = self.inputs.items
return [self.Outputs(processed=str(i)) for i in range(count)]Expected Outcome
The BaseNode framework should:
- Support proper type annotations for Inputs and Outputs fields
- Automatically handle type conversion/validation where needed
- Eliminate the need for manual type casting and type ignore comments
- Provide better IDE support and type safety
Context
This issue was identified during code review of comprehensive test cases for BaseNode.
Related PR: #262
Related Comment: #262 (comment)
cc: @NiveditJain
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
No status