Skip to content

mirascope.core.base.message_param

BaseMessageParam

Bases: BaseModel

A base class for message parameters.

Usage Documentation

Prompts

Attributes:

Name Type Description
role str

The role of the message (e.g. "system", "user", "assistant")

content str | Sequence[TextPart | ImagePart | AudioPart | CacheControlPart | DocumentPart]

The content of the message

TextPart

Bases: BaseModel

A content part for text.

Attributes:

Name Type Description
type Literal['text']

Always "text"

text str

The text content

ImagePart

Bases: BaseModel

A content part for images.

Attributes:

Name Type Description
type Literal['image']

Always "image"

media_type str

The media type (e.g. image/jpeg)

image bytes

The raw image bytes

detail str | None

(Optional) The detail to use for the image (supported by OpenAI)

AudioPart

Bases: BaseModel

A content part for audio.

Attributes:

Name Type Description
type Literal['audio']

Always "audio"

media_type str

The media type (e.g. audio/wav)

audio bytes

The raw audio bytes