CreateResponseExtensions Class

Definition

Extension methods for CreateResponse.

public static class CreateResponseExtensions
type CreateResponseExtensions = class
Public Module CreateResponseExtensions
Inheritance
CreateResponseExtensions

Methods

Name Description
GetConversationExpanded(CreateResponse)

Expands the Conversation BinaryData into a typed ConversationParam. A plain string is treated as the conversation ID.

GetConversationId(CreateResponse)

Extracts the conversation ID from the Conversation field, which may be a plain string ID or a JSON object with an id property. Returns null if no conversation context is present.

GetInputExpanded(CreateResponse)

Expands the Input BinaryData into a typed list of Item objects. A plain string input is wrapped as a single ItemMessage with User role and text content. Array elements without a "type" discriminator default to ItemMessage deserialization.

GetInstructionsBinaryData(CreateResponse)

Converts the Instructions string into a BinaryData suitable for assigning to Instructions.

This method properly JSON-encodes the string so it can be round-tripped through Utf8JsonWriter.WriteRawValue. Use this instead of FromString(String), which would produce invalid JSON.

GetToolChoiceExpanded(CreateResponse)

Expands the ToolChoice BinaryData into a typed ToolChoiceParam. String shorthands ("auto", "required") are expanded to ToolChoiceAllowed with the corresponding mode. "none" returns null.

Applies to