Skip to content

Add tests and agent docs for kwargs_type input/output#14157

Open
yiyixuxu wants to merge 2 commits into
mainfrom
kwargs-type-tests-and-docs
Open

Add tests and agent docs for kwargs_type input/output#14157
yiyixuxu wants to merge 2 commits into
mainfrom
kwargs-type-tests-and-docs

Conversation

@yiyixuxu

Copy link
Copy Markdown
Collaborator

add tests and docs for kwargs_type, which comes very handy for cosmos3

…pelines

Document how kwargs_type-tagged values flow from block outputs and user
inputs to consumer blocks (the mechanism behind denoiser_input_fields),
pin the behavior down with tests, and add a key-pattern section to
.ai/modular.md.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions github-actions Bot added size/M PR with diff < 200 LOC tests and removed size/M PR with diff < 200 LOC labels Jul 10, 2026
@yiyixuxu yiyixuxu requested review from dg845 and sayakpaul July 13, 2026 21:05

@sayakpaul sayakpaul left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the work and I left some comments.

I found it a bit confusing as a user as to when one should use, for example, pipe(a="testa", ...) and when one should use pipe(typea={"a": "testa"}). Maybe we could simplify that a bit (can be in a different PR and doesn't have to block this one).

Comment thread .ai/modular.md Outdated

def __call__(self, components, state: PipelineState) -> PipelineState:
block_state = self.get_block_state(state)
assert block_state.typea == block_state.expected_typea

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a bit confused here.

I'd imagine that the block_state.typea and block_state.expected_typea are different state-level components. But seems like they are the same. In what circumstance, a user would want to define input params like that?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's for testing only, the expcted_typea is the value we expect to receive in block_state for typea, and we use only use it for assert statement inside the block - but i restructured the test to make it lesss confusing

blocks = SequentialPipelineBlocks.from_blocks_dict(
{"producer": DummyKwargsProducerStep(), "consumer": DummyKwargsConsumerStep()}
)
pipe = blocks.init_pipeline()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When pipe is constructed, should we also assert against the params accepted by the call method of pipe?

…est pipeline call params

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions github-actions Bot added the size/M PR with diff < 200 LOC label Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M PR with diff < 200 LOC tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants