Add workflow payload compression encoder#526
Conversation
4e2aad7 to
54fb520
Compare
d202362 to
d391c9f
Compare
d391c9f to
f1d8248
Compare
f1d8248 to
db1cf64
Compare
| return data, encoding_options | ||
| return data, encoding_options, encoding_metadata | ||
|
|
||
| async def encode_event_payload_content( |
There was a problem hiding this comment.
This is only used in tests as far as I can tell, what is this for?
There was a problem hiding this comment.
Good catch — this helper was only used by the test. I removed it and the test, and cleaned up a couple of nearby compression-only leftovers.
db1cf64 to
a466079
Compare
|
|
||
| class CompressedPayloadData(BaseModel): | ||
| algorithm_config: AlgorithmConfig | ||
| b64data: str |
There was a problem hiding this comment.
That is adding quite a lot of bytes on your compressed data.
Keeping the config in the compressed payload is necessary as we saw in the other PR to allow any consumer to decode the payload, but we should find a better encoding mechanism than base64 which is inflating the final payload size.
There was a problem hiding this comment.
Agreed. I moved the compression config into encoding_metadata and now keep the compressed bytes directly as the payload, so we avoid the JSON/base64 envelope overhead while preserving config-independent decoding.
Summary
Checks
uv run python -m pytest src/mistralai/extra/tests/test_workflow_encoding.py -quv run ruff check src/mistralai/extra/workflows/encoding/models.py src/mistralai/extra/workflows/encoding/payload_encoder.py src/mistralai/extra/tests/test_workflow_encoding.pyuv run ruff format --check src/mistralai/extra/workflows/encoding/models.py src/mistralai/extra/workflows/encoding/payload_encoder.py src/mistralai/extra/tests/test_workflow_encoding.pyCI note
.github/workflows/run_example_scripts.yaml.run_examplesfailures on this PR showedMISTRAL_API_KEY:empty in the job environment, followed byhttpx.LocalProtocolError: Illegal header value b'Bearer '. That points to examples running without the CI API-key secret, not to the workflow compression code.mainrun_examplesruns pass withMISTRAL_API_KEY: ***present; an oldermainfailure on 2026-05-06 had the secret present and failed later for a different example issue.