ResponseExtensions Class

Definition

Extension methods for ResponseObject that provide typed access to BinaryData properties like ToolChoice and Instructions.

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

Methods

Name Description
GetInstructionItems(ResponseObject)

Expands the Instructions BinaryData into a typed list of Item objects. A plain string is wrapped as a single ItemMessage with Developer role and the instruction text.

GetToolChoiceExpanded(ResponseObject)

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

SetInstructions(ResponseObject, IList<Item>)

Sets the Instructions property from a list of Item objects.

SetInstructions(ResponseObject, String)

Sets the Instructions property from a plain text string.

SetToolChoice(ResponseObject, ToolChoiceOptions)

Sets the ToolChoice property from a ToolChoiceOptions enum value (string shorthand).

SetToolChoice(ResponseObject, ToolChoiceParam)

Sets the ToolChoice property from a typed ToolChoiceParam object.

Applies to