openai.internal.ChatExtraPart

A content part carrying extra keys beside its own, which is how a `${cache(args)}` in the prompt reaches the wire: chat completions places a cache breakpoint ON A CONTENT PART (`prompt_cache_breakpoint`), while the delimiter sits BETWEEN parts — so the breakpoint goes on the part before the delimiter, and everything up to and including that part is the cached prefix (`_chat_apply_cache_delimiter`).

Reference version

Signature

class openai.internal.ChatExtraPart

A content part carrying extra keys beside its own, which is how a ${cache(args)} in the prompt reaches the wire: chat completions places a cache breakpoint ON A CONTENT PART (prompt_cache_breakpoint), while the delimiter sits BETWEEN parts — so the breakpoint goes on the part before the delimiter, and everything up to and including that part is the cached prefix (_chat_apply_cache_delimiter).

args is sent AS WRITTEN, including a null nested inside it. That is why to_json PARKS the extra keys under _chat_directives_key() rather than splatting them onto the part: the body then goes through _chat_prune_nulls, whose job is to drop the CLIENT's unset options, and it would take an authored {"ttl": null} with them. The parked key is opaque to that pass and _chat_apply_directives splices it back onto the part immediately afterwards, so the key never reaches the wire.

Source:<builtin>/openai/ns_internal/chat.bamlbytes 13563–14352

Fields

extra

map<string, baml.json.json>

Implementations

baml.ToJson for openai.internal.ChatExtraPart

Instance methods

function

to_json

(self) -> baml.json.json throws baml.json.SerializationError

Source:<builtin>/openai/ns_internal/chat.bamlbytes 13657–14350