feat(connectors): add moss-connector-zeroentropy

Merged
HA
3mo ago
+1258-1

What

A new data connector, moss-connector-zeroentropy, that migrates a ZeroEntropy collection into a Moss index. Follows the established moss-data-connector/_template pattern exactly (same shape as the Supabase/MongoDB/DynamoDB connectors).

from moss_connector_zeroentropy import ZeroEntropyConnector, ingest

source = ZeroEntropyConnector(collection_name="my_collection", api_key="...")  # or ZEROENTROPY_API_KEY
await ingest(source, project_id="...", project_key="...", index_name="my_collection")

How it works

  • ZeroEntropyConnector.__iter__ walks documents.get_info_list (an auto-paginating cursor) and yields one moss.DocumentInfo per document via a mapper.
  • Default mapping (path -> id, parsed content -> text, metadata -> metadata) means a whole collection migrates with no mapper; pass mapper= to customize.
  • The list endpoint returns metadata only, so content is fetched per document via documents.get_info(..., include_content=True). Documents that never parsed (no content) are skipped rather than indexed empty.
  • ZeroEntropy metadata is typed Dict[str, str | list[str]]; the connector coerces list values to strings (Moss requires Dict[str, str]).
  • path_prefix= scopes the migration; include_content=False migrates metadata only.

Testing

  • tests/test_zeroentropy.py — 9 mocked unit tests, all passing (default/custom mapper, skip-empty-content, include_content=False, path_prefix, auto_id, empty collection, metadata coercion).
  • tests/test_integration_zeroentropy_moss.py — skippable live round trip (ZeroEntropy → Moss → query → delete), gated on ZEROENTROPY_API_KEY / ZEROENTROPY_TEST_COLLECTION / MOSS_PROJECT_ID / MOSS_PROJECT_KEY.
  • Verified against the installed zeroentropy 0.1.0a11 SDK by introspection: method names, keyword params (collection_name, path, include_content, path_prefix), the SyncGetDocumentInfoListCursor return, and every response field the connector reads all match.

Also

  • publish-moss-connector-zeroentropy.yml (mirrors the other connectors' publish workflows).
  • Row added to packages/moss-data-connector/README.md.

CI is green (python-lint + python-sdk-test pass under the pinned ruff from #480).