[gpt-oss] Add IncompleteDetails to ResponsesRepsonse (#24561)
Signed-off-by: Andrew Xia <axia@meta.com>
This commit is contained in:
@@ -30,7 +30,7 @@ except ImportError: # For newer openai versions (>= 1.100.0)
|
||||
from openai.types.responses import (ResponseFormatTextConfig as
|
||||
ResponseTextConfig)
|
||||
|
||||
from openai.types.responses.response import ToolChoice
|
||||
from openai.types.responses.response import IncompleteDetails, ToolChoice
|
||||
from openai.types.responses.tool import Tool
|
||||
from openai.types.shared import Metadata, Reasoning
|
||||
from pydantic import (BaseModel, ConfigDict, Field, TypeAdapter,
|
||||
@@ -1868,7 +1868,7 @@ class ResponsesResponse(OpenAIBaseModel):
|
||||
id: str = Field(default_factory=lambda: f"resp_{random_uuid()}")
|
||||
created_at: int = Field(default_factory=lambda: int(time.time()))
|
||||
# error: Optional[ResponseError] = None
|
||||
# incomplete_details: Optional[IncompleteDetails] = None
|
||||
incomplete_details: Optional[IncompleteDetails] = None
|
||||
instructions: Optional[str] = None
|
||||
metadata: Optional[Metadata] = None
|
||||
model: str
|
||||
@@ -1904,9 +1904,18 @@ class ResponsesResponse(OpenAIBaseModel):
|
||||
status: ResponseStatus,
|
||||
usage: Optional[ResponseUsage] = None,
|
||||
) -> "ResponsesResponse":
|
||||
|
||||
incomplete_details: Optional[IncompleteDetails] = None
|
||||
if status == 'incomplete':
|
||||
incomplete_details = IncompleteDetails(reason='max_output_tokens')
|
||||
# TODO: implement the other reason for incomplete_details,
|
||||
# which is content_filter
|
||||
# incomplete_details = IncompleteDetails(reason='content_filter')
|
||||
|
||||
return cls(
|
||||
id=request.request_id,
|
||||
created_at=created_time,
|
||||
incomplete_details=incomplete_details,
|
||||
instructions=request.instructions,
|
||||
metadata=request.metadata,
|
||||
model=model_name,
|
||||
@@ -2109,7 +2118,7 @@ class DetokenizeResponse(OpenAIBaseModel):
|
||||
|
||||
class TokenizerInfoResponse(OpenAIBaseModel):
|
||||
"""
|
||||
Response containing tokenizer configuration
|
||||
Response containing tokenizer configuration
|
||||
equivalent to tokenizer_config.json
|
||||
"""
|
||||
|
||||
@@ -2199,7 +2208,7 @@ class TranscriptionRequest(OpenAIBaseModel):
|
||||
to_language: Optional[str] = None
|
||||
"""The language of the output audio we transcribe to.
|
||||
|
||||
Please note that this is not currently used by supported models at this
|
||||
Please note that this is not currently used by supported models at this
|
||||
time, but it is a placeholder for future use, matching translation api.
|
||||
"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user