mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-17 22:19:47 +00:00
content part fixes
This commit is contained in:
parent
e48d062233
commit
6bd215706d
5 changed files with 271 additions and 33 deletions
|
|
@ -624,19 +624,23 @@ class OpenAIResponseObjectStreamResponseMcpCallCompleted(BaseModel):
|
|||
|
||||
|
||||
@json_schema_type
|
||||
class OpenAIResponseContentPart(BaseModel):
|
||||
"""Base class for response content parts."""
|
||||
|
||||
id: str
|
||||
type: str
|
||||
class OpenAIResponseContentPartOutputText(BaseModel):
|
||||
type: Literal["output_text"] = "output_text"
|
||||
text: str
|
||||
# TODO: add annotations, logprobs, etc.
|
||||
|
||||
|
||||
@json_schema_type
|
||||
class OpenAIResponseContentPartText(OpenAIResponseContentPart):
|
||||
"""Text content part for streaming responses."""
|
||||
class OpenAIResponseContentPartRefusal(BaseModel):
|
||||
type: Literal["refusal"] = "refusal"
|
||||
refusal: str
|
||||
|
||||
text: str
|
||||
type: Literal["text"] = "text"
|
||||
|
||||
OpenAIResponseContentPart = Annotated[
|
||||
OpenAIResponseContentPartOutputText | OpenAIResponseContentPartRefusal,
|
||||
Field(discriminator="type"),
|
||||
]
|
||||
register_schema(OpenAIResponseContentPart, name="OpenAIResponseContentPart")
|
||||
|
||||
|
||||
@json_schema_type
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue