1+ using System ;
2+ using System . Collections . Generic ;
3+ using System . ComponentModel ;
4+ using System . Diagnostics . CodeAnalysis ;
5+ using System . Linq ;
6+ using OpenAI . Chat ;
7+
8+ namespace OpenAI ;
9+
10+ /// <summary> Model factory for Chat models. </summary>
11+ public static partial class ChatModelFactory
12+ {
13+ /// <summary> Initializes a new instance of <see cref="OpenAI.Chat.ChatCompletion"/>. </summary>
14+ /// <returns> A new <see cref="OpenAI.Chat.ChatCompletion"/> instance for mocking. </returns>
15+ public static ChatCompletion ChatCompletion (
16+ string id = null ,
17+ ChatFinishReason finishReason = default ,
18+ ChatMessageContent content = null ,
19+ string refusal = null ,
20+ IEnumerable < ChatToolCall > toolCalls = null ,
21+ ChatMessageRole role = default ,
22+ IEnumerable < ChatTokenLogProbabilityDetails > contentTokenLogProbabilities = null ,
23+ IEnumerable < ChatTokenLogProbabilityDetails > refusalTokenLogProbabilities = null ,
24+ DateTimeOffset createdAt = default ,
25+ string model = null ,
26+ string systemFingerprint = null ,
27+ ChatTokenUsage usage = default )
28+ {
29+ return OpenAI . Chat . OpenAIChatModelFactory . ChatCompletion (
30+ id : id ,
31+ finishReason : finishReason ,
32+ content : content ,
33+ refusal : refusal ,
34+ toolCalls : toolCalls ,
35+ role : role ,
36+ functionCall : default ,
37+ contentTokenLogProbabilities : contentTokenLogProbabilities ,
38+ refusalTokenLogProbabilities : refusalTokenLogProbabilities ,
39+ createdAt : createdAt ,
40+ model : model ,
41+ systemFingerprint : systemFingerprint ,
42+ usage : usage ) ;
43+ }
44+
45+ /// <summary> Initializes a new instance of <see cref="OpenAI.Chat.StreamingChatCompletionUpdate"/>. </summary>
46+ /// <returns> A new <see cref="OpenAI.Chat.StreamingChatCompletionUpdate"/> instance for mocking. </returns>
47+ public static StreamingChatCompletionUpdate StreamingChatCompletionUpdate (
48+ string completionId = null ,
49+ ChatMessageContent contentUpdate = null ,
50+ IEnumerable < StreamingChatToolCallUpdate > toolCallUpdates = null ,
51+ ChatMessageRole ? role = default ,
52+ string refusalUpdate = null ,
53+ IEnumerable < ChatTokenLogProbabilityDetails > contentTokenLogProbabilities = null ,
54+ IEnumerable < ChatTokenLogProbabilityDetails > refusalTokenLogProbabilities = null ,
55+ ChatFinishReason ? finishReason = default ,
56+ DateTimeOffset createdAt = default ,
57+ string model = null ,
58+ string systemFingerprint = null ,
59+ ChatTokenUsage usage = default )
60+ {
61+ return OpenAI . Chat . OpenAIChatModelFactory . StreamingChatCompletionUpdate (
62+ completionId : completionId ,
63+ contentUpdate : contentUpdate ,
64+ functionCallUpdate : default ,
65+ toolCallUpdates : toolCallUpdates ,
66+ role : role ,
67+ refusalUpdate : refusalUpdate ,
68+ contentTokenLogProbabilities : contentTokenLogProbabilities ,
69+ refusalTokenLogProbabilities : refusalTokenLogProbabilities ,
70+ finishReason : finishReason ,
71+ createdAt : createdAt ,
72+ model : model ,
73+ systemFingerprint : systemFingerprint ,
74+ usage : usage ) ;
75+ }
76+
77+ /// <summary> Initializes a new instance of <see cref="OpenAI.Chat.ChatCompletionDeletionResult"/>. </summary>
78+ /// <returns> A new <see cref="OpenAI.Chat.ChatCompletionDeletionResult"/> instance for mocking. </returns>
79+ public static ChatCompletionDeletionResult ChatCompletionDeletionResult (
80+ bool deleted = true ,
81+ string chatCompletionId = null )
82+ {
83+ return new ChatCompletionDeletionResult (
84+ deleted : deleted ,
85+ @object : "chat.completion.deleted" ,
86+ chatCompletionId : chatCompletionId ,
87+ additionalBinaryDataProperties : null ) ;
88+ }
89+
90+ /// <summary> Initializes a new instance of <see cref="OpenAI.Chat.UserChatMessage"/>. </summary>
91+ /// <returns> A new <see cref="OpenAI.Chat.UserChatMessage"/> instance for mocking. </returns>
92+ public static UserChatMessage UserChatMessage (
93+ string content = null ,
94+ string participantName = null )
95+ {
96+ content ??= "User message content" ;
97+ var message = new UserChatMessage ( content ) ;
98+ if ( participantName != null )
99+ {
100+ message . ParticipantName = participantName ;
101+ }
102+ return message ;
103+ }
104+
105+ /// <summary> Initializes a new instance of <see cref="OpenAI.Chat.AssistantChatMessage"/>. </summary>
106+ /// <returns> A new <see cref="OpenAI.Chat.AssistantChatMessage"/> instance for mocking. </returns>
107+ public static AssistantChatMessage AssistantChatMessage (
108+ string content = null ,
109+ IEnumerable < ChatToolCall > toolCalls = null ,
110+ string participantName = null )
111+ {
112+ AssistantChatMessage message ;
113+ if ( toolCalls != null )
114+ {
115+ message = new AssistantChatMessage ( toolCalls ) ;
116+ }
117+ else
118+ {
119+ content ??= "Assistant message content" ;
120+ message = new AssistantChatMessage ( content ) ;
121+ }
122+
123+ if ( participantName != null )
124+ {
125+ message . ParticipantName = participantName ;
126+ }
127+ return message ;
128+ }
129+
130+ /// <summary> Initializes a new instance of <see cref="OpenAI.Chat.SystemChatMessage"/>. </summary>
131+ /// <returns> A new <see cref="OpenAI.Chat.SystemChatMessage"/> instance for mocking. </returns>
132+ public static SystemChatMessage SystemChatMessage (
133+ string content = null ,
134+ string participantName = null )
135+ {
136+ content ??= "System message content" ;
137+ var message = new SystemChatMessage ( content ) ;
138+ if ( participantName != null )
139+ {
140+ message . ParticipantName = participantName ;
141+ }
142+ return message ;
143+ }
144+
145+ /// <summary> Initializes a new instance of <see cref="OpenAI.Chat.ToolChatMessage"/>. </summary>
146+ /// <returns> A new <see cref="OpenAI.Chat.ToolChatMessage"/> instance for mocking. </returns>
147+ public static ToolChatMessage ToolChatMessage (
148+ string toolCallId = "tool_call_id" ,
149+ string content = null )
150+ {
151+ content ??= "Tool message content" ;
152+ return new ToolChatMessage ( toolCallId , content ) ;
153+ }
154+
155+ /// <summary> Initializes a new instance of <see cref="OpenAI.Chat.ChatTokenUsage"/>. </summary>
156+ /// <returns> A new <see cref="OpenAI.Chat.ChatTokenUsage"/> instance for mocking. </returns>
157+ public static ChatTokenUsage ChatTokenUsage (
158+ int outputTokenCount = default ,
159+ int inputTokenCount = default ,
160+ int totalTokenCount = default )
161+ {
162+ return OpenAI . Chat . OpenAIChatModelFactory . ChatTokenUsage (
163+ outputTokenCount : outputTokenCount ,
164+ inputTokenCount : inputTokenCount ,
165+ totalTokenCount : totalTokenCount ) ;
166+ }
167+
168+ /// <summary> Initializes a new instance of <see cref="OpenAI.Chat.ChatTokenLogProbabilityDetails"/>. </summary>
169+ /// <returns> A new <see cref="OpenAI.Chat.ChatTokenLogProbabilityDetails"/> instance for mocking. </returns>
170+ public static ChatTokenLogProbabilityDetails ChatTokenLogProbabilityDetails (
171+ string token = null ,
172+ float logProbability = default ,
173+ ReadOnlyMemory < byte > ? utf8Bytes = null ,
174+ IEnumerable < ChatTokenTopLogProbabilityDetails > topLogProbabilities = null )
175+ {
176+ return OpenAI . Chat . OpenAIChatModelFactory . ChatTokenLogProbabilityDetails (
177+ token : token ,
178+ logProbability : logProbability ,
179+ utf8Bytes : utf8Bytes ,
180+ topLogProbabilities : topLogProbabilities ) ;
181+ }
182+
183+ /// <summary> Initializes a new instance of <see cref="OpenAI.Chat.ChatTokenTopLogProbabilityDetails"/>. </summary>
184+ /// <returns> A new <see cref="OpenAI.Chat.ChatTokenTopLogProbabilityDetails"/> instance for mocking. </returns>
185+ public static ChatTokenTopLogProbabilityDetails ChatTokenTopLogProbabilityDetails (
186+ string token = null ,
187+ float logProbability = default ,
188+ ReadOnlyMemory < byte > ? utf8Bytes = null )
189+ {
190+ return OpenAI . Chat . OpenAIChatModelFactory . ChatTokenTopLogProbabilityDetails (
191+ token : token ,
192+ logProbability : logProbability ,
193+ utf8Bytes : utf8Bytes ) ;
194+ }
195+
196+ /// <summary> Initializes a new instance of <see cref="OpenAI.Chat.StreamingChatToolCallUpdate"/>. </summary>
197+ /// <returns> A new <see cref="OpenAI.Chat.StreamingChatToolCallUpdate"/> instance for mocking. </returns>
198+ public static StreamingChatToolCallUpdate StreamingChatToolCallUpdate (
199+ int index = default ,
200+ string toolCallId = null ,
201+ ChatToolCallKind kind = default ,
202+ string functionName = null ,
203+ BinaryData functionArgumentsUpdate = null )
204+ {
205+ return OpenAI . Chat . OpenAIChatModelFactory . StreamingChatToolCallUpdate (
206+ index : index ,
207+ toolCallId : toolCallId ,
208+ kind : kind ,
209+ functionName : functionName ,
210+ functionArgumentsUpdate : functionArgumentsUpdate ) ;
211+ }
212+ }
0 commit comments