Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add path field to ByteStream #6168

Closed
wants to merge 5 commits into from
Closed
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
3 changes: 2 additions & 1 deletion haystack/preview/dataclasses/byte_stream.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from dataclasses import dataclass, field
from pathlib import Path
from typing import Optional, Dict, Any
from typing import Dict, Any, Optional, Union


@dataclass(frozen=True)
Expand All @@ -11,6 +11,7 @@ class ByteStream:

data: bytes
metadata: Dict[str, Any] = field(default_factory=dict, hash=False)
path: Optional[Union[str, Path]] = None
mime_type: Optional[str] = field(default=None)
Comment on lines +14 to 15
Copy link
Member

Choose a reason for hiding this comment

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

What is the difference between = None and field(default=None)?

(Excuse my ignorance...)


def to_file(self, destination_path: Path):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
preview:
- Introduces a `path` optional field to ByteStream.