Skip to content

Add is_empty structural emptiness check for OutputSchema#431

Merged
NISH1001 merged 1 commit into
developfrom
feature/output-emptiness
Apr 20, 2026
Merged

Add is_empty structural emptiness check for OutputSchema#431
NISH1001 merged 1 commit into
developfrom
feature/output-emptiness

Conversation

@NISH1001
Copy link
Copy Markdown
Collaborator

@NISH1001 NISH1001 commented Apr 20, 2026

Summary

  • Add akd.utils.is_empty(value) — recursive structural emptiness check. Returns True for None, empty/whitespace strings, empty bytes, and containers (BaseModel, dict, list, tuple, set, frozenset) whose contents are all recursively empty. Concrete scalars like 0, False, 0.0, datetime(...) are NOT considered empty.
  • Expose OutputSchema.is_empty() as a thin wrapper so callers can do result.is_empty() instead of hand-rolling per-schema checks. Useful for short-circuiting downstream logic when an agent/tool returns a structurally blank result.
  • Lazy-import of akd.utils inside the method to avoid a circular import via akd/__init__.py.

Test plan

  • uv run pytest tests/test_utils_is_empty.py -v — 43 passed
  • Manual sanity: O().is_empty() True; O(a='hi').is_empty() False; O(a=' ').is_empty() True
  • uv run pytest — full suite green

Copy link
Copy Markdown
Collaborator

@sanzog03 sanzog03 left a comment

Choose a reason for hiding this comment

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

lgtm

@github-actions
Copy link
Copy Markdown

❌ Tests failed (exit code: 1)

📊 Test Results

  • Passed: 593
  • Failed: 2
  • Skipped: 39
  • Warnings: 182
  • Coverage: 76%

Branch: feature/output-emptiness
PR: #431
Commit: 53fd4e1

📋 Full coverage report and logs are available in the workflow run.

@NISH1001 NISH1001 merged commit f2713ba into develop Apr 20, 2026
1 check passed
@NISH1001 NISH1001 deleted the feature/output-emptiness branch April 20, 2026 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants