Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Openai Openai python Easy Input Message

From Leeroopedia
Knowledge Sources
Domains API_Types, Python
Last Updated 2026-02-15 00:00 GMT

Overview

Concrete type for representing an easy input message response model provided by the openai-python SDK.

Description

EasyInputMessage is a Pydantic model class that represents a message input to the model with a role indicating instruction-following hierarchy. It extends BaseModel and includes a content field (either a plain string or a ResponseInputMessageContentList for multimodal input), a role field restricted to "user", "assistant", "system", or "developer" (where developer/system roles take precedence over user), and an optional type field fixed to "message". Instructions given with the "developer" or "system" role take precedence over those given with the "user" role.

Usage

Import this type when deserializing or inspecting message inputs returned in API responses. This is the response model counterpart to EasyInputMessageParam which is used for request construction.

Code Reference

Source Location

Signature

class EasyInputMessage(BaseModel):
    """A message input to the model with a role indicating
    instruction following hierarchy."""
    content: Union[str, ResponseInputMessageContentList]
    role: Literal["user", "assistant", "system", "developer"]
    type: Optional[Literal["message"]] = None

Import

from openai.types.responses import EasyInputMessage

I/O Contract

Fields

Name Type Required Description
content Union[str, ResponseInputMessageContentList] Yes Text, image, or audio input to the model. Can also contain previous assistant responses.
role Literal["user", "assistant", "system", "developer"] Yes The role of the message input. Developer/system roles take precedence over user.
type Optional[Literal["message"]] No The type of the message input. Always "message" when present.

Usage Examples

from openai.types.responses import EasyInputMessage

# Inspect a message from a response
msg = EasyInputMessage.model_validate({
    "content": "Hello, world!",
    "role": "user",
})
print(f"Role: {msg.role}, Content: {msg.content}")

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment