1+ using System ;
2+ using System . Collections . Generic ;
3+ using System . Linq ;
4+
5+ namespace OpenAI . Responses ;
6+
7+ /// <summary> Model factory for models. </summary>
8+ public static partial class OpenAIResponsesModelFactory
9+ {
10+ /// <summary> Initializes a new instance of <see cref="OpenAI.Responses.OpenAIResponse"/>. </summary>
11+ /// <returns> A new <see cref="OpenAI.Responses.OpenAIResponse"/> instance for mocking. </returns>
12+ public static OpenAIResponse OpenAIResponse (
13+ string id = null ,
14+ DateTimeOffset createdAt = default ,
15+ ResponseStatus ? status = null ,
16+ ResponseError error = null ,
17+ ResponseTokenUsage usage = null ,
18+ string endUserId = null ,
19+ ResponseReasoningOptions reasoningOptions = null ,
20+ int ? maxOutputTokenCount = null ,
21+ ResponseTextOptions textOptions = null ,
22+ ResponseTruncationMode ? truncationMode = null ,
23+ ResponseIncompleteStatusDetails incompleteStatusDetails = null ,
24+ IEnumerable < ResponseItem > outputItems = null ,
25+ bool parallelToolCallsEnabled = default ,
26+ ResponseToolChoice toolChoice = null ,
27+ string model = null ,
28+ IDictionary < string , string > metadata = null ,
29+ float ? temperature = null ,
30+ float ? topP = null ,
31+ string previousResponseId = null ,
32+ bool ? background = null ,
33+ string instructions = null ,
34+ IEnumerable < ResponseTool > tools = null )
35+ {
36+ outputItems ??= new List < ResponseItem > ( ) ;
37+ tools ??= new List < ResponseTool > ( ) ;
38+ metadata ??= new Dictionary < string , string > ( ) ;
39+
40+ return new OpenAIResponse (
41+ metadata : metadata ,
42+ temperature : temperature ,
43+ topP : topP ,
44+ serviceTier : null ,
45+ previousResponseId : previousResponseId ,
46+ background : background ,
47+ instructions : instructions ,
48+ tools : tools . ToList ( ) ,
49+ id : id ,
50+ status : status ,
51+ createdAt : createdAt ,
52+ error : error ,
53+ usage : usage ,
54+ endUserId : endUserId ,
55+ reasoningOptions : reasoningOptions ,
56+ maxOutputTokenCount : maxOutputTokenCount ,
57+ textOptions : textOptions ,
58+ truncationMode : truncationMode ,
59+ incompleteStatusDetails : incompleteStatusDetails ,
60+ outputItems : outputItems . ToList ( ) ,
61+ parallelToolCallsEnabled : parallelToolCallsEnabled ,
62+ toolChoice : toolChoice ,
63+ model : model ,
64+ @object : "response" ,
65+ additionalBinaryDataProperties : null ) ;
66+ }
67+
68+ /// <summary> Initializes a new instance of <see cref="OpenAI.Responses.MessageResponseItem"/>. </summary>
69+ /// <returns> A new <see cref="OpenAI.Responses.MessageResponseItem"/> instance for mocking. </returns>
70+ public static MessageResponseItem MessageResponseItem (
71+ string id = null ,
72+ MessageRole role = MessageRole . Assistant ,
73+ MessageStatus ? status = null )
74+ {
75+ // Convert the public MessageRole to the internal role type
76+ InternalResponsesMessageRole internalRole = role . ToSerialString ( ) ;
77+
78+ return new MessageResponseItem (
79+ id : id ,
80+ internalRole : internalRole ,
81+ status : status ) ;
82+ }
83+
84+ /// <summary> Initializes a new instance of <see cref="OpenAI.Responses.ReasoningResponseItem"/>. </summary>
85+ /// <param name="id">The ID of the reasoning response item.</param>
86+ /// <param name="encryptedContent">The encrypted reasoning content.</param>
87+ /// <param name="status">The status of the reasoning response item.</param>
88+ /// <param name="summaryParts">The collection of summary parts.</param>
89+ /// <returns> A new <see cref="OpenAI.Responses.ReasoningResponseItem"/> instance for mocking. </returns>
90+ public static ReasoningResponseItem ReasoningResponseItem (
91+ string id = null ,
92+ string encryptedContent = null ,
93+ ReasoningStatus ? status = null ,
94+ IEnumerable < ReasoningSummaryPart > summaryParts = null )
95+ {
96+ summaryParts ??= new List < ReasoningSummaryPart > ( ) ;
97+
98+ var item = new ReasoningResponseItem (
99+ kind : InternalItemType . Reasoning ,
100+ id : id ,
101+ additionalBinaryDataProperties : null ,
102+ encryptedContent : encryptedContent ,
103+ summaryParts : summaryParts . ToList ( ) ) ;
104+
105+ item . Status = status ;
106+ return item ;
107+ }
108+
109+ /// <summary> Initializes a new instance of <see cref="OpenAI.Responses.ReasoningResponseItem"/> with summary text. </summary>
110+ /// <param name="id">The ID of the reasoning response item.</param>
111+ /// <param name="encryptedContent">The encrypted reasoning content.</param>
112+ /// <param name="status">The status of the reasoning response item.</param>
113+ /// <param name="summaryText">The summary text to create a ReasoningSummaryTextPart from.</param>
114+ /// <returns> A new <see cref="OpenAI.Responses.ReasoningResponseItem"/> instance for mocking. </returns>
115+ public static ReasoningResponseItem ReasoningResponseItem (
116+ string id = null ,
117+ string encryptedContent = null ,
118+ ReasoningStatus ? status = null ,
119+ string summaryText = null )
120+ {
121+ var summaryParts = ! string . IsNullOrEmpty ( summaryText )
122+ ? new List < ReasoningSummaryPart > { new ReasoningSummaryTextPart ( summaryText ) }
123+ : new List < ReasoningSummaryPart > ( ) ;
124+
125+ var item = new ReasoningResponseItem (
126+ kind : InternalItemType . Reasoning ,
127+ id : id ,
128+ additionalBinaryDataProperties : null ,
129+ encryptedContent : encryptedContent ,
130+ summaryParts : summaryParts ) ;
131+
132+ item . Status = status ;
133+ return item ;
134+ }
135+
136+ /// <summary> Initializes a new instance of <see cref="OpenAI.Responses.ReferenceResponseItem"/>. </summary>
137+ /// <returns> A new <see cref="OpenAI.Responses.ReferenceResponseItem"/> instance for mocking. </returns>
138+ public static ReferenceResponseItem ReferenceResponseItem (
139+ string id = null )
140+ {
141+ return new ReferenceResponseItem (
142+ kind : InternalItemType . ItemReference ,
143+ id : id ,
144+ additionalBinaryDataProperties : null ) ;
145+ }
146+ }
0 commit comments