Unreal OpenAI API 1.0.0
ChatCommonTypes.h
1// OpenAI, Copyright LifeEXE. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "Provider/Types/CommonTypes.h"
7#include "Provider/Types/ToolsTypes.h"
8#include "Provider/OpenAIOptional.h"
9#include "ChatCommonTypes.generated.h"
10
11UENUM(BlueprintType)
12enum class EMessageContentType : uint8
13{
14 Text,
15 Image_URL
16};
17
18UENUM(BlueprintType)
19enum class EChatResponseFormat : uint8
20{
21 Text = 0,
22 JSON_Object
23};
24
25UENUM(BlueprintType)
26enum class EServiceTier : uint8
27{
28 Auto = 0,
29 Default
30};
31
32USTRUCT(BlueprintType)
34{
35 GENERATED_BODY()
39 UPROPERTY(BlueprintReadWrite, Category = "OpenAI | Required")
40 FString URL;
41
45 UPROPERTY(BlueprintReadWrite, Category = "OpenAI | Required")
46 FString Detail{"auto"};
47};
48
49USTRUCT(BlueprintType)
51{
52 GENERATED_BODY()
53
54
57 UPROPERTY(BlueprintReadWrite, Category = "OpenAI | Required")
58 FString Text;
59
63 UPROPERTY(BlueprintReadWrite, Category = "OpenAI | Required")
64 FImageURL Image_URL;
65
69 UPROPERTY(BlueprintReadWrite, Category = "OpenAI | Required")
70 FString Type{"text"};
71};
72
73USTRUCT(BlueprintType)
75{
76 GENERATED_BODY()
77
78 // ========================== content ===============================
79
80
84 UPROPERTY(BlueprintReadWrite, Category = "OpenAI | Required")
85 FString Content;
86
93 UPROPERTY(BlueprintReadWrite, Category = "OpenAI | Required")
94 TArray<FMessageContent> ContentArray;
95
96 // ========================== common ===============================
97
101 UPROPERTY(BlueprintReadWrite, Category = "OpenAI | Required")
102 FString Role;
103
108 UPROPERTY(BlueprintReadWrite, Category = "OpenAI | Optional")
110
111 // ========================== tools ===============================
112
116 UPROPERTY(BlueprintReadWrite, Category = "OpenAI | Optional")
117 TArray<FToolCalls> Tool_Calls;
118
122 UPROPERTY(BlueprintReadWrite, Category = "OpenAI | Optional")
123 FOptionalString Tool_Call_ID;
124};
125
127// REQUEST TYPES
129
130USTRUCT(BlueprintType)
132{
133 GENERATED_BODY()
134
135
138 UPROPERTY(BlueprintReadWrite, Category = "OpenAI | Required")
139 FString Type{"text"};
140};
141
142USTRUCT(BlueprintType)
144{
145 GENERATED_BODY()
146
147
153 UPROPERTY(BlueprintReadWrite, Category = "OpenAI | Optional")
154 FOptionalBool Include_Usage;
155};
156
157USTRUCT(BlueprintType)
159{
160 GENERATED_BODY()
161
162
165 UPROPERTY(BlueprintReadWrite, Category = "OpenAI | Required")
166 TArray<FMessage> Messages; //@todo: check
167
172 UPROPERTY(BlueprintReadWrite, Category = "OpenAI | Required")
173 FString Model;
174
180 UPROPERTY(BlueprintReadWrite, Category = "OpenAI | Optional")
181 float Frequency_Penalty{0.0f};
182
192 UPROPERTY(BlueprintReadWrite, Category = "OpenAI | Optional")
193 TMap<FString, int32> Logit_Bias;
194
199 UPROPERTY(BlueprintReadWrite, Category = "OpenAI | Optional")
200 bool Logprobs{false};
201
207 UPROPERTY(BlueprintReadWrite, Category = "OpenAI | Optional")
208 FOptionalInt Top_Logprobs;
209
214 UPROPERTY(BlueprintReadWrite, Category = "OpenAI | Optional")
215 FOptionalInt Max_Completion_Tokens;
216
222 UPROPERTY(BlueprintReadWrite, Category = "OpenAI | Optional")
223 int32 N{1};
224
230 UPROPERTY(BlueprintReadWrite, Category = "OpenAI | Optional")
231 float Presence_Penalty{0.0f};
232
244 UPROPERTY(BlueprintReadWrite, Category = "OpenAI | Optional")
245 FChatCompletionResponseFormat Response_Format; //@todo: upgrade
246
253 UPROPERTY(BlueprintReadWrite, Category = "OpenAI | Optional")
255
273 UPROPERTY(BlueprintReadWrite, Category = "OpenAI | Optional")
274 FOptionalString Service_Tier;
275
279 UPROPERTY(BlueprintReadWrite, Category = "OpenAI | Optional")
280 TArray<FString> Stop;
281
289 UPROPERTY(BlueprintReadWrite, Category = "OpenAI | Optional")
290 bool Stream{false};
291
295 UPROPERTY(BlueprintReadWrite, Category = "OpenAI | Optional")
296 FStreamOptions Stream_Options;
297
303 UPROPERTY(BlueprintReadWrite, Category = "OpenAI | Optional")
304 float Temperature{1.0f};
305
312 UPROPERTY(BlueprintReadWrite, Category = "OpenAI | Optional")
313 float Top_P{1.0f};
314
321 UPROPERTY(BlueprintReadWrite, Category = "OpenAI | Optional")
322 TArray<FTools> Tools;
323
334 UPROPERTY(BlueprintReadWrite, Category = "OpenAI | Optional")
335 FToolChoice Tool_Choice; // @todo: none option
336
340 UPROPERTY(BlueprintReadWrite, Category = "OpenAI | Optional")
341 FOptionalBool Parallel_Tool_Calls;
342
346 UPROPERTY(BlueprintReadWrite, Category = "OpenAI | Optional")
348};
349
351// RESPONSE TYPES
353
354USTRUCT(BlueprintType)
355struct FUsage
356{
357 GENERATED_BODY()
358
359
362 UPROPERTY(BlueprintReadOnly, Category = "OpenAI")
363 int32 Completion_Tokens{};
364
368 UPROPERTY(BlueprintReadOnly, Category = "OpenAI")
369 int32 Prompt_Tokens{};
370
374 UPROPERTY(BlueprintReadOnly, Category = "OpenAI")
375 int32 Total_Tokens{};
376};
377
381USTRUCT(BlueprintType)
383{
384 GENERATED_BODY()
385
386
389 UPROPERTY(BlueprintReadOnly, Category = "OpenAI")
390 FString Token;
391
397 UPROPERTY(BlueprintReadOnly, Category = "OpenAI")
398 int32 Logprob{};
399
407 UPROPERTY(BlueprintReadOnly, Category = "OpenAI")
408 TArray<uint8> Bytes;
409};
410
411USTRUCT(BlueprintType)
413{
414 GENERATED_BODY()
415
416
420 UPROPERTY(BlueprintReadOnly, Category = "OpenAI")
421 TArray<FLogProb> Top_Logprobs;
422};
423
424USTRUCT(BlueprintType)
426{
427 GENERATED_BODY()
428
429
432 UPROPERTY(BlueprintReadOnly, Category = "OpenAI")
433 TArray<FLogProbExtent> Content;
434
438 UPROPERTY(BlueprintReadOnly, Category = "OpenAI")
439 TArray<FLogProbExtent> Refusal;
440};
441
442USTRUCT(BlueprintType)
444{
445 GENERATED_BODY()
446
447
450 UPROPERTY(BlueprintReadOnly, Category = "OpenAI")
451 FString ID;
452
456 UPROPERTY(BlueprintReadOnly, Category = "OpenAI")
457 int32 Created{};
458
462 UPROPERTY(BlueprintReadOnly, Category = "OpenAI")
463 FString Model;
464
469 UPROPERTY(BlueprintReadOnly, Category = "OpenAI")
470 FString Service_Tier;
471
477 UPROPERTY(BlueprintReadOnly, Category = "OpenAI")
478 FString System_Fingerprint;
479
483 UPROPERTY(BlueprintReadOnly, Category = "OpenAI")
484 FString Object;
485};
Definition: OpenAI.Build.cs:6
Definition: ChatCommonTypes.h:159
Definition: ChatCommonTypes.h:444
Definition: ChatCommonTypes.h:132
Definition: ChatCommonTypes.h:34
Definition: ChatCommonTypes.h:413
Definition: ChatCommonTypes.h:383
Definition: ChatCommonTypes.h:426
Definition: ChatCommonTypes.h:51
Definition: ChatCommonTypes.h:75
Definition: OpenAIOptional.h:58
Definition: OpenAIOptional.h:34
Definition: OpenAIOptional.h:10
Definition: ChatCommonTypes.h:144
Definition: ToolsTypes.h:32
Definition: ToolsTypes.h:123
Definition: ToolsTypes.h:108
Definition: ChatCommonTypes.h:356