Skip to content

Commit

Permalink
fix for older python
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelcolvin committed Nov 8, 2024
1 parent 21cd229 commit ffefa32
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pydantic_ai/models/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from collections.abc import Iterable, Iterator, Mapping, Sequence
from dataclasses import dataclass
from itertools import chain
from typing import Callable, cast
from typing import Callable, Union, cast

from typing_extensions import TypeAlias, overload

Expand Down Expand Up @@ -37,7 +37,7 @@ class DeltaToolCall:
DeltaToolCalls = dict[int, DeltaToolCall]

FunctionDef: TypeAlias = Callable[[list[Message], AgentInfo], LLMMessage]
StreamFunctionDef: TypeAlias = Callable[[list[Message], AgentInfo], Iterable[str] | Iterable[DeltaToolCalls]]
StreamFunctionDef: TypeAlias = Callable[[list[Message], AgentInfo], Union[Iterable[str], Iterable[DeltaToolCalls]]]


@dataclass
Expand Down
2 changes: 2 additions & 0 deletions tests/test_streaming.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations as _annotations

import json
from collections.abc import Iterable

Expand Down

0 comments on commit ffefa32

Please sign in to comment.