6
6
#import < Foundation/NSString.h>
7
7
#import < Foundation/NSValue.h>
8
8
9
- @class YChatKotlinThrowable, YChatYChatCompanion, YChatKotlinArray<T>, YChatKotlinException, YChatKotlinRuntimeException, YChatKotlinIllegalStateException;
9
+ @class YChatKotlinThrowable, YChatYChatCompanion, YChatChatMessage, YChatKotlinArray<T>, YChatKotlinException, YChatKotlinRuntimeException, YChatKotlinIllegalStateException;
10
10
11
- @protocol YChatCompletion, YChatYChat, YChatYChatCallback, YChatKotlinIterator;
11
+ @protocol YChatChatCompletions, YChatCompletion, YChatEdits, YChatImageGenerations , YChatYChat, YChatYChatCallback, YChatKotlinIterator;
12
12
13
13
NS_ASSUME_NONNULL_BEGIN
14
14
#pragma clang diagnostic push
@@ -147,7 +147,10 @@ __attribute__((swift_name("KotlinBoolean")))
147
147
__attribute__ ((swift_name(" YChat" )))
148
148
@protocol YChatYChat
149
149
@required
150
+ - (id <YChatChatCompletions>)chatCompletions __attribute__((swift_name(" chatCompletions()" )));
150
151
- (id <YChatCompletion>)completion __attribute__ ((swift_name(" completion()" )));
152
+ - (id <YChatEdits>)edits __attribute__ ((swift_name(" edits()" )));
153
+ - (id <YChatImageGenerations>)imageGenerations __attribute__ ((swift_name(" imageGenerations()" )));
151
154
@end
152
155
153
156
__attribute__ ((swift_name(" YChatCallback" )))
@@ -172,6 +175,20 @@ __attribute__((swift_name("YChatCompanion")))
172
175
- (id <YChatYChat>)createApiKey:(NSString *)apiKey __attribute__ ((swift_name(" create(apiKey:)" )));
173
176
@end
174
177
178
+ __attribute__ ((objc_subclassing_restricted))
179
+ __attribute__((swift_name(" ChatMessage" )))
180
+ @interface YChatChatMessage : YChatBase
181
+ - (instancetype )initWithRole:(NSString *)role content:(NSString *)content __attribute__((swift_name(" init(role:content:)" ))) __attribute__((objc_designated_initializer));
182
+ - (NSString *)component1 __attribute__ ((swift_name(" component1()" ))) __attribute__((deprecated(" use corresponding property instead" )));
183
+ - (NSString *)component2 __attribute__ ((swift_name(" component2()" ))) __attribute__((deprecated(" use corresponding property instead" )));
184
+ - (YChatChatMessage *)doCopyRole:(NSString *)role content:(NSString *)content __attribute__ ((swift_name(" doCopy(role:content:)" )));
185
+ - (BOOL )isEqual:(id _Nullable)other __attribute__ ((swift_name(" isEqual(_:)" )));
186
+ - (NSUInteger )hash __attribute__ ((swift_name(" hash()" )));
187
+ - (NSString *)description __attribute__ ((swift_name(" description()" )));
188
+ @property (readonly) NSString *content __attribute__ ((swift_name(" content" )));
189
+ @property (readonly) NSString *role __attribute__ ((swift_name(" role" )));
190
+ @end
191
+
175
192
__attribute__ ((swift_name(" KotlinThrowable" )))
176
193
@interface YChatKotlinThrowable : YChatBase
177
194
- (instancetype )initWithMessage:(NSString * _Nullable)message __attribute__((swift_name(" init(message:)" ))) __attribute__((objc_designated_initializer));
@@ -209,6 +226,24 @@ __attribute__((swift_name("ChatGptException")))
209
226
@property YChatInt * _Nullable statusCode __attribute__ ((swift_name(" statusCode" )));
210
227
@end
211
228
229
+ __attribute__ ((swift_name(" ChatCompletions" )))
230
+ @protocol YChatChatCompletions
231
+ @required
232
+ - (id <YChatChatCompletions>)addMessageRole:(NSString *)role content:(NSString *)content __attribute__((swift_name(" addMessage(role:content:)" )));
233
+
234
+ /* *
235
+ * @note This method converts instances of CancellationException, ChatGptException to errors.
236
+ * Other uncaught Kotlin exceptions are fatal.
237
+ */
238
+ - (void )executeContent:(NSString *)content completionHandler:(void (^)(NSArray <YChatChatMessage *> * _Nullable, NSError * _Nullable))completionHandler __attribute__ ((swift_name(" execute(content:completionHandler:)" )));
239
+ - (void )executeContent:(NSString *)content callback:(id <YChatYChatCallback>)callback __attribute__ ((swift_name(" execute(content:callback:)" )));
240
+ - (id <YChatChatCompletions>)setMaxResultsResults:(int32_t )results __attribute__ ((swift_name(" setMaxResults(results:)" )));
241
+ - (id <YChatChatCompletions>)setMaxTokensTokens:(int32_t )tokens __attribute__ ((swift_name(" setMaxTokens(tokens:)" )));
242
+ - (id <YChatChatCompletions>)setModelModel:(NSString *)model __attribute__ ((swift_name(" setModel(model:)" )));
243
+ - (id <YChatChatCompletions>)setTemperatureTemperature:(double )temperature __attribute__ ((swift_name(" setTemperature(temperature:)" )));
244
+ - (id <YChatChatCompletions>)setTopPTopP:(double )topP __attribute__ ((swift_name(" setTopP(topP:)" )));
245
+ @end
246
+
212
247
__attribute__ ((swift_name(" Completion" )))
213
248
@protocol YChatCompletion
214
249
@required
@@ -227,6 +262,38 @@ __attribute__((swift_name("Completion")))
227
262
- (id <YChatCompletion>)setTopPTopP:(double )topP __attribute__ ((swift_name(" setTopP(topP:)" )));
228
263
@end
229
264
265
+ __attribute__ ((swift_name(" Edits" )))
266
+ @protocol YChatEdits
267
+ @required
268
+
269
+ /* *
270
+ * @note This method converts instances of CancellationException, ChatGptException to errors.
271
+ * Other uncaught Kotlin exceptions are fatal.
272
+ */
273
+ - (void )executeInstruction:(NSString *)instruction completionHandler:(void (^)(NSArray <NSString *> * _Nullable, NSError * _Nullable))completionHandler __attribute__((swift_name(" execute(instruction:completionHandler:)" )));
274
+ - (void )executeInstruction:(NSString *)instruction callback:(id <YChatYChatCallback>)callback __attribute__ ((swift_name(" execute(instruction:callback:)" )));
275
+ - (id <YChatEdits>)setInputInput:(NSString *)input __attribute__ ((swift_name(" setInput(input:)" )));
276
+ - (id <YChatEdits>)setModelModel:(NSString *)model __attribute__ ((swift_name(" setModel(model:)" )));
277
+ - (id <YChatEdits>)setResultsResults:(int32_t )results __attribute__ ((swift_name(" setResults(results:)" )));
278
+ - (id <YChatEdits>)setTemperatureTemperature:(double )temperature __attribute__ ((swift_name(" setTemperature(temperature:)" )));
279
+ - (id <YChatEdits>)setTopPTopP:(double )topP __attribute__ ((swift_name(" setTopP(topP:)" )));
280
+ @end
281
+
282
+ __attribute__ ((swift_name(" ImageGenerations" )))
283
+ @protocol YChatImageGenerations
284
+ @required
285
+
286
+ /* *
287
+ * @note This method converts instances of CancellationException, ChatGptException to errors.
288
+ * Other uncaught Kotlin exceptions are fatal.
289
+ */
290
+ - (void )executePrompt:(NSString *)prompt completionHandler:(void (^)(NSArray <NSString *> * _Nullable, NSError * _Nullable))completionHandler __attribute__((swift_name(" execute(prompt:completionHandler:)" )));
291
+ - (void )executePrompt:(NSString *)prompt callback:(id <YChatYChatCallback>)callback __attribute__ ((swift_name(" execute(prompt:callback:)" )));
292
+ - (id <YChatImageGenerations>)setResponseFormatResponseFormat:(NSString *)responseFormat __attribute__ ((swift_name(" setResponseFormat(responseFormat:)" )));
293
+ - (id <YChatImageGenerations>)setResultsResults:(int32_t )results __attribute__ ((swift_name(" setResults(results:)" )));
294
+ - (id <YChatImageGenerations>)setSizeSize:(NSString *)size __attribute__ ((swift_name(" setSize(size:)" )));
295
+ @end
296
+
230
297
__attribute__ ((objc_subclassing_restricted))
231
298
__attribute__((swift_name(" KotlinArray" )))
232
299
@interface YChatKotlinArray<T> : YChatBase
0 commit comments