refactor(model_runtime): use Sequence for content in PromptMessage

- Replaced list with Sequence for more flexible content type.
- Improved type consistency by importing from collections.abc.
This commit is contained in:
-LAN- 2024-11-14 13:01:57 +08:00
parent 93bbb194f2
commit 47e8a5d4d1

View File

@ -1,4 +1,5 @@
from abc import ABC
from collections.abc import Sequence
from enum import Enum
from typing import Optional
@ -107,7 +108,7 @@ class PromptMessage(ABC, BaseModel):
"""
role: PromptMessageRole
content: Optional[str | list[PromptMessageContent]] = None
content: Optional[str | Sequence[PromptMessageContent]] = None
name: Optional[str] = None
def is_empty(self) -> bool: