Skip to content

Commit

Permalink
Merge pull request #999 from PrefectHQ/fix-tests
Browse files Browse the repository at this point in the history
`utcnow` is deprecated
  • Loading branch information
zzstoatzz authored Nov 30, 2024
2 parents 9d20165 + d5905d7 commit 9ae60e1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cookbook/structured_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import marvin
from pydantic import AfterValidator, Field

result = marvin.extract(
result: list[str] = marvin.extract(
data="nO, i HaVe NeVeR HeaRd oF uV",
target=Annotated[
str,
Expand Down
8 changes: 6 additions & 2 deletions src/marvin/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,9 @@ class Image(MarvinType):
data: Optional[bytes] = Field(default=None, repr=False)
url: Optional[str] = None
format: str = "png"
timestamp: datetime.datetime = Field(default_factory=datetime.datetime.utcnow)
timestamp: datetime.datetime = Field(
default_factory=lambda: datetime.datetime.now(datetime.timezone.utc)
)
detail: Literal["auto", "low", "high"] = "auto"

def __init__(self, data_or_url=None, **kwargs):
Expand Down Expand Up @@ -354,7 +356,9 @@ class Audio(MarvinType):
data: bytes = Field(repr=False)
_data_stream: Optional[AsyncIterator[bytes]] = PrivateAttr()
url: Optional[Path] = None
timestamp: datetime.datetime = Field(default_factory=datetime.datetime.utcnow)
timestamp: datetime.datetime = Field(
default_factory=lambda: datetime.datetime.now(datetime.timezone.utc)
)
format: Literal["wav", "mp3", "pcm"] = "pcm"

def __init__(self, _data_stream: AsyncIterator[bytes] = None, **data):
Expand Down

0 comments on commit 9ae60e1

Please sign in to comment.