Python class
ResponseResource
ResponseResourceβ
class max.pipelines.request.ResponseResource(*, id, object='response', created_at, status, model, citations=None, error=None, frequency_penalty=None, include=None, incomplete_details=None, logit_bias=None, logprobs=None, max_output_tokens=None, metadata=None, modalities=None, n=None, output=None, parallel_tool_calls=None, presence_penalty=None, reasoning=None, reasoning_reference=None, response_format=None, seed=None, service_tier=None, stop=None, store=None, stream=None, stream_options=None, temperature=None, tool_choice=None, tools=None, top_logprobs=None, top_p=None, truncation=None, usage=None, user=None, verbosity=None)
Bases: BaseModel
The response from the model.
-
Parameters:
-
- id (str)
- object (Literal['response'])
- created_at (int)
- status (str)
- model (str)
- citations (list[UrlCitationBody | ItemReferenceParam] | None)
- error (Error | None)
- frequency_penalty (float | None)
- include (list[IncludeEnum] | None)
- incomplete_details (IncompleteDetails | None)
- logit_bias (dict[str, float] | None)
- logprobs (bool | None)
- max_output_tokens (int | None)
- metadata (dict[str, str] | None)
- modalities (list[str] | None)
- n (int | None)
- output (list[Message] | None)
- parallel_tool_calls (bool | None)
- presence_penalty (float | None)
- reasoning (ReasoningBody | None)
- reasoning_reference (ReasoningReference | None)
- response_format (TextField | JsonObjectField | JsonSchemaField | None)
- seed (int | None)
- service_tier (ServiceTierEnum | None)
- stop (str | list[str] | None)
- store (bool | None)
- stream (bool | None)
- stream_options (StreamOptionsParam | None)
- temperature (float | None)
- tool_choice (ToolChoiceValueEnum | FunctionToolChoice | AllowedToolChoice | None)
- tools (list[FunctionTool] | None)
- top_logprobs (int | None)
- top_p (float | None)
- truncation (TruncationEnum | None)
- usage (Usage | None)
- user (str | None)
- verbosity (VerbosityEnum | None)
citationsβ
citations: list[UrlCitationBody | ItemReferenceParam] | None
created_atβ
created_at: int
errorβ
frequency_penaltyβ
from_generation_output()β
classmethod from_generation_output(generation_output, model)
Create a ResponseResource from a GenerationOutput.
Converts pipeline generation output to the OpenResponses API response format.
-
Parameters:
-
Returns:
-
A ResponseResource instance with the generated content formatted as an assistant message in the output field.
-
Return type:
Example:
>>> from max.pipelines.modeling.types.generation import GenerationOutput
>>> from max.pipelines.request import RequestID
>>> from max.pipelines.request.open_responses import OutputImageContent
>>> from max.pipelines.modeling.types.status import GenerationStatus
>>> import numpy as np
>>>
>>> # Create generation output
>>> img_array = (np.random.rand(512, 512, 3) * 255).astype(np.uint8)
>>> gen_output = GenerationOutput(
... request_id=RequestID(value="req-123"),
... final_status=GenerationStatus.END_OF_SEQUENCE,
... output=[OutputImageContent.from_numpy(img_array, format="png")]
... )
>>>
>>> # Convert to ResponseResource
>>> response = ResponseResource.from_generation_output(
... gen_output, model="flux-2-dev-t2i-bfloat16-v2"
... )idβ
id: str
includeβ
include: list[IncludeEnum] | None
incomplete_detailsβ
incomplete_details: IncompleteDetails | None
logit_biasβ
logprobsβ
max_output_tokensβ
metadataβ
modalitiesβ
modelβ
model: str
model_configβ
model_config: ClassVar[ConfigDict] = {'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
nβ
objectβ
object: Literal['response']
outputβ
parallel_tool_callsβ
presence_penaltyβ
reasoningβ
reasoning: ReasoningBody | None
reasoning_referenceβ
reasoning_reference: ReasoningReference | None
response_formatβ
response_format: ResponseFormat | None
seedβ
service_tierβ
service_tier: ServiceTierEnum | None
statusβ
status: str
stopβ
storeβ
streamβ
stream_optionsβ
stream_options: StreamOptionsParam | None
temperatureβ
tool_choiceβ
tool_choice: ToolChoice | None
toolsβ
tools: list[FunctionTool] | None
top_logprobsβ
top_pβ
truncationβ
truncation: TruncationEnum | None
usageβ
userβ
verbosityβ
verbosity: VerbosityEnum | None
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!