mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-03 07:23:33 +00:00
fix(count_tokens): preserve typed validator return
This commit is contained in:
parent
a9571f3104
commit
fbf50f2c07
1 changed files with 2 additions and 2 deletions
|
|
@ -1,7 +1,7 @@
|
|||
from collections.abc import Mapping
|
||||
from itertools import chain
|
||||
from types import MappingProxyType
|
||||
from typing import Final
|
||||
from typing import Final, cast
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, Request, Response
|
||||
from fastapi.responses import JSONResponse, ORJSONResponse
|
||||
|
|
@ -37,7 +37,7 @@ class _GoogleCountTokensSystemInstruction(BaseModel):
|
|||
@field_validator("parts", mode="before")
|
||||
@classmethod
|
||||
def normalize_parts(cls, parts: object) -> object:
|
||||
return (parts,) if isinstance(parts, Mapping) else parts
|
||||
return (cast(object, parts),) if isinstance(parts, Mapping) else parts
|
||||
|
||||
|
||||
class _GoogleCountTokensFunctionDeclaration(BaseModel):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue