Skip to content
Open
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
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ repos:

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.15.13
rev: v0.16.4
hooks:
# Run the linter.
- id: ruff-check
Expand Down
6 changes: 3 additions & 3 deletions src/tinytools/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
T = TypeVar("T")


def validate_shape(array: ArrayTensor, shape: tuple[int | None | EllipsisType, ...], arg_name: str = "array") -> None:
def validate_shape(array: ArrayTensor, shape: tuple[int | EllipsisType | None, ...], arg_name: str = "array") -> None:
"""Validate that an array shape matches a shape specification.

Args:
Expand Down Expand Up @@ -284,10 +284,10 @@ def validate_and_fill_optional_list(
def _validate_shape_parts(
*,
actual_shape: tuple[int, ...],
expected_parts: tuple[int | None | EllipsisType, ...],
expected_parts: tuple[int | EllipsisType | None, ...],
offset: int,
arg_name: str,
full_expected: tuple[int | None | EllipsisType, ...],
full_expected: tuple[int | EllipsisType | None, ...],
) -> None:
if len(actual_shape) != len(expected_parts):
msg = (
Expand Down
26 changes: 13 additions & 13 deletions src/tinytools/vlm/openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@ def encode_image(image: ImageType) -> str:
async def completion_with_retries(
self,
messages: list[dict[str, str]],
response_format: type[BaseModel] | None | Omit = omit,
response_format: type[BaseModel] | Omit | None = omit,
max_tokens: int = 8192,
temperature: float | None | Omit = omit,
top_p: float | None | Omit = omit,
presence_penalty: float | None | Omit = omit,
temperature: float | Omit | None = omit,
top_p: float | Omit | None = omit,
presence_penalty: float | Omit | None = omit,
extra_body: Body | None = None,
) -> dict[str, str] | None:
"""Completion with retries.
Expand Down Expand Up @@ -205,9 +205,9 @@ async def single_forward(
no_cache: bool | None = None,
ignore_cache: bool | None = None,
max_tokens: int = 8192,
temperature: float | None | Omit = omit,
top_p: float | None | Omit = omit,
presence_penalty: float | None | Omit = omit,
temperature: float | Omit | None = omit,
top_p: float | Omit | None = omit,
presence_penalty: float | Omit | None = omit,
extra_body: Body | None = None,
) -> str:
"""Make a single forward pass through the VLM/LLM with an optional image, system prompt and response format.
Expand Down Expand Up @@ -338,9 +338,9 @@ async def async_forward(
no_cache: bool = False,
ignore_cache: bool | None = None,
max_tokens: int = 8192,
temperature: float | None | Omit = omit,
top_p: float | None | Omit = omit,
presence_penalty: float | None | Omit = omit,
temperature: float | Omit | None = omit,
top_p: float | Omit | None = omit,
presence_penalty: float | Omit | None = omit,
extra_body: Body | None = None,
) -> list[str | None]:
"""Make a forward pass through the VLM/LLM with optional images, system prompts and response format.
Expand Down Expand Up @@ -400,9 +400,9 @@ def forward(
no_cache: bool | None = None,
ignore_cache: bool | None = None,
max_tokens: int = 8192,
temperature: float | None | Omit = omit,
top_p: float | None | Omit = omit,
presence_penalty: float | None | Omit = omit,
temperature: float | Omit | None = omit,
top_p: float | Omit | None = omit,
presence_penalty: float | Omit | None = omit,
extra_body: Body | None = None,
) -> list[str | None]:
"""Make a forward pass through the VLM/LLM with optional images, system prompts and response format.
Expand Down