Skip to content

chore(deps): bump mloda to 0.9.0 and adopt the columnar PythonDict contract - #81

Merged
TomKaltofen merged 4 commits into
mloda-ai:mainfrom
TomKaltofen:chore/bump-mloda-0.9.0
Jul 8, 2026
Merged

chore(deps): bump mloda to 0.9.0 and adopt the columnar PythonDict contract#81
TomKaltofen merged 4 commits into
mloda-ai:mainfrom
TomKaltofen:chore/bump-mloda-0.9.0

Conversation

@TKaltofen

Copy link
Copy Markdown
Collaborator

Summary

Bumps mloda from 0.8.0 to 0.9.0 (newest PyPI release) and adopts both of its breaking changes.

Columnar PythonDict contract

mloda 0.9.0 makes PythonDict's native representation columnar dict[str, list] and rejects row lists with heterogeneous keys. mloda ships rows_to_columnar and row_count helpers but no public columnar-to-rows inverse, so this repo adds one:

  • New rag_integration/feature_groups/columnar.py with columnar_to_rows (row-wise read path for every calculate_feature that iterates data) and homogenize_rows (uniform key schema for source rows so mixed metadata, e.g. one doc with author and one without, passes the stricter output contract).
  • All 26 calculate_feature implementations audited; every row-wise data consumer (chunking, dedup, embedding, PII redaction, vector store, evaluators, graph_rag source read) pivots via columnar_to_rows first. Test contracts and the three CLI demos unwrap columnar partitions the same way.
  • rag_demo now requests the deduped feature alongside the embedded one (mloda returns only the requested feature's column), restoring the chunk-text preview and --output JSON.

Option forwarding

Input-feature group options forward by default in 0.9.0 and DefaultOptionKeys.feature_chainer_parser_key is retired. The graph_rag connector migrates to forward_group_exclude on its declared source feature.

Review follow-ups (Claude Opus + codex, both applied)

  • Direct unit tests for the columnar helpers (previously only covered indirectly).
  • Removed a redundant re-pivot in BaseImageDeduplicator._extract_items.
  • flatten_result no longer corrupts already-row-wise lists (only treats a leading dict as a partition when every value is a list).
  • Evaluators guard relevance-id reads with 'or []' against the None that homogenize_rows backfills.

Testing

  • tox green: 711 passed, 1 skipped; ruff, mypy --strict, bandit clean.
  • All three CLI demos ran end-to-end (rag_demo with mixed-schema docs, swap_demo, eval_demo arg surface).

No open repo issues existed to fold into this pass.

TKaltofen added 4 commits July 8, 2026 15:13
…ntract

mloda 0.9.0 ships two breaking changes that affect this plugin:

- Input-feature options now forward by default and the
  feature_chainer_parser_key shield is retired. The graph_rag connector
  migrates to forward_group_exclude on the source feature it declares.
- PythonDict results and mid-chain calculate_feature data are columnar
  dict[str, list] instead of row-wise list[dict].

Add a columnar_to_rows helper and pivot every calculate_feature data read
and run_all result consumer (source, tests, CLI) back to rows. Feature
groups still return list[dict]; mloda normalizes homogeneous rows on output.
homogenize_rows gives dataset sources a uniform key schema so the stricter
columnar output contract accepts mixed corpus/query rows.
… preview

Review follow-ups to the mloda 0.9.0 bump:

- Document and image source feature groups preserve arbitrary per-row
  metadata, so mixed inputs (one doc carries author, the next does not)
  produced heterogeneous rows that mloda 0.9.0's columnar output contract
  rejects. Run both base sources through homogenize_rows, matching the
  dataset sources.
- rag_demo requested only the final embedded feature, but mloda returns
  just the requested feature's column, so the chunk-text preview and the
  --output JSON were always blank. Request the deduped feature alongside
  and align its chunk text to the embeddings.
columnar_to_rows and homogenize_rows back every PythonDict feature group
since the 0.9.0 bump but had no direct unit tests; pin their edge cases
(pivot, passthrough, schema-less empty, key backfill and ordering).
BaseImageDeduplicator._extract_items re-pivoted rows the shared base had
already pivoted; drop the redundant call.
…vance ids

Review follow-ups: flatten_result pivoted a leading row dict as if it
were a columnar partition, corrupting already-row-wise input; only treat
a leading dict as a partition when every value is a list. The evaluators
read relevance-id lists with a [] default, but homogenize_rows backfills
absent keys with None, so a future mixed-modality dataset would raise;
guard with 'or []'.
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