module

Smith::LLM::OpenAIContent

The OpenAI content shape, shared by the three adapters that speak it.

content is a plain string until a message carries something that is not text; then it has to become an array of parts. Keeping that switch in one place is what stops the three from drifting — the string form is the one every existing session was written with, and a provider that reshaped it for no reason would invalidate its own prompt cache.

Class methods

image_part(json : JSON::Builder, block : ContentBlock) : Nil

An image as a data URI. There is no document part in this shape: a PDF never reaches here, because the agent has already replaced it with text for any provider whose supports_documents? says no.

Source
images(msg : Message) : Array(ContentBlock)

The attachments of a message, in the order they were written.

Source