mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-11 19:56:03 +00:00
Simplify type signature using only Sequence covariance
This commit is contained in:
parent
53c6f846d4
commit
1f5adff5a7
1 changed files with 1 additions and 8 deletions
|
|
@ -80,14 +80,7 @@ async def convert_chat_choice_to_response_message(
|
|||
|
||||
|
||||
async def convert_response_content_to_chat_content(
|
||||
content: (
|
||||
str
|
||||
# List types for exact matches (invariant)
|
||||
| list[OpenAIResponseInputMessageContent]
|
||||
| list[OpenAIResponseOutputMessageContent]
|
||||
# Sequence for mixed content types (covariant - accepts list of subtypes)
|
||||
| Sequence[OpenAIResponseInputMessageContent | OpenAIResponseOutputMessageContent]
|
||||
),
|
||||
content: str | Sequence[OpenAIResponseInputMessageContent | OpenAIResponseOutputMessageContent],
|
||||
) -> str | list[OpenAIChatCompletionContentPartParam]:
|
||||
"""
|
||||
Convert the content parts from an OpenAI Response API request into OpenAI Chat Completion content parts.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue