Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,26 @@ from haystack.dataclasses import Document
doc = Document(content="col\n1\n2\n3")
```

### `GeneratedAnswer` and `ExtractedAnswer` serialization format

**What changed:** `GeneratedAnswer.to_dict()` and `ExtractedAnswer.to_dict()` now return a flat dictionary of the object's fields instead of wrapping them in a `{"type": ..., "init_parameters": {...}}` envelope. `from_dict()` still accepts the old wrapped format, so existing serialized artifacts keep loading.

**Why:** Aligns these dataclasses with how every other Haystack dataclass (`Document`, `ChatMessage`, etc.) serializes, and removes redundant type metadata from pipeline snapshots and `State` objects.

**How to migrate:** Update any code that reads the serialized output to access fields at the top level instead of under `init_parameters`. See [#11805](https://github.com/deepset-ai/haystack/pull/11805).

Before (v2.x):
```python
serialized = generated_answer.to_dict()
data = serialized["init_parameters"]["data"]
```

After (v3.0):
```python
serialized = generated_answer.to_dict()
data = serialized["data"]
```

### Components Moved to External Packages

**What changed:** Some components have been moved out of Haystack into dedicated integration packages,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
upgrade:
- |
``GeneratedAnswer`` and ``ExtractedAnswer`` now serialize to the same flat format as
all other Haystack dataclasses (``Document``, ``ChatMessage``, etc.). This is a breaking
change: ``to_dict()`` no longer wraps the fields in the ``{"type": "...", "init_parameters":
{...}}`` envelope and instead returns the fields at the top level. Any code or stored
artifact that reads the serialized output and expects the ``type``/``init_parameters``
keys must be updated to read the fields directly. ``from_dict()`` remains backward
compatible and still accepts the old wrapped format.