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