@celljs/ai-openai 3.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +96 -0
  3. package/lib/common/api/api-protocol.d.ts +47 -0
  4. package/lib/common/api/api-protocol.d.ts.map +1 -0
  5. package/lib/common/api/api-protocol.js +6 -0
  6. package/lib/common/api/api-protocol.js.map +1 -0
  7. package/lib/common/api/chat-request.d.ts +198 -0
  8. package/lib/common/api/chat-request.d.ts.map +1 -0
  9. package/lib/common/api/chat-request.js +145 -0
  10. package/lib/common/api/chat-request.js.map +1 -0
  11. package/lib/common/api/chat-response.d.ts +193 -0
  12. package/lib/common/api/chat-response.d.ts.map +1 -0
  13. package/lib/common/api/chat-response.js +124 -0
  14. package/lib/common/api/chat-response.js.map +1 -0
  15. package/lib/common/api/embeddings-request.d.ts +59 -0
  16. package/lib/common/api/embeddings-request.d.ts.map +1 -0
  17. package/lib/common/api/embeddings-request.js +49 -0
  18. package/lib/common/api/embeddings-request.js.map +1 -0
  19. package/lib/common/api/embeddings-response.d.ts +27 -0
  20. package/lib/common/api/embeddings-response.d.ts.map +1 -0
  21. package/lib/common/api/embeddings-response.js +30 -0
  22. package/lib/common/api/embeddings-response.js.map +1 -0
  23. package/lib/common/api/index.d.ts +10 -0
  24. package/lib/common/api/index.d.ts.map +1 -0
  25. package/lib/common/api/index.js +13 -0
  26. package/lib/common/api/index.js.map +1 -0
  27. package/lib/common/api/message.d.ts +216 -0
  28. package/lib/common/api/message.d.ts.map +1 -0
  29. package/lib/common/api/message.js +179 -0
  30. package/lib/common/api/message.js.map +1 -0
  31. package/lib/common/api/openai-api.d.ts +18 -0
  32. package/lib/common/api/openai-api.d.ts.map +1 -0
  33. package/lib/common/api/openai-api.js +99 -0
  34. package/lib/common/api/openai-api.js.map +1 -0
  35. package/lib/common/api/openai-api.spec.d.ts +2 -0
  36. package/lib/common/api/openai-api.spec.d.ts.map +1 -0
  37. package/lib/common/api/openai-api.spec.js +162 -0
  38. package/lib/common/api/openai-api.spec.js.map +1 -0
  39. package/lib/common/api/openai-model.d.ts +117 -0
  40. package/lib/common/api/openai-model.d.ts.map +1 -0
  41. package/lib/common/api/openai-model.js +121 -0
  42. package/lib/common/api/openai-model.js.map +1 -0
  43. package/lib/common/api/response-format.d.ts +60 -0
  44. package/lib/common/api/response-format.d.ts.map +1 -0
  45. package/lib/common/api/response-format.js +79 -0
  46. package/lib/common/api/response-format.js.map +1 -0
  47. package/lib/common/api/usage.d.ts +79 -0
  48. package/lib/common/api/usage.d.ts.map +1 -0
  49. package/lib/common/api/usage.js +95 -0
  50. package/lib/common/api/usage.js.map +1 -0
  51. package/lib/common/index.d.ts +4 -0
  52. package/lib/common/index.d.ts.map +1 -0
  53. package/lib/common/index.js +7 -0
  54. package/lib/common/index.js.map +1 -0
  55. package/lib/common/model/index.d.ts +5 -0
  56. package/lib/common/model/index.d.ts.map +1 -0
  57. package/lib/common/model/index.js +8 -0
  58. package/lib/common/model/index.js.map +1 -0
  59. package/lib/common/model/openai-chat-model.d.ts +37 -0
  60. package/lib/common/model/openai-chat-model.d.ts.map +1 -0
  61. package/lib/common/model/openai-chat-model.js +357 -0
  62. package/lib/common/model/openai-chat-model.js.map +1 -0
  63. package/lib/common/model/openai-chat-model.spec.d.ts +2 -0
  64. package/lib/common/model/openai-chat-model.spec.d.ts.map +1 -0
  65. package/lib/common/model/openai-chat-model.spec.js +82 -0
  66. package/lib/common/model/openai-chat-model.spec.js.map +1 -0
  67. package/lib/common/model/openai-chat-options.d.ts +159 -0
  68. package/lib/common/model/openai-chat-options.d.ts.map +1 -0
  69. package/lib/common/model/openai-chat-options.js +231 -0
  70. package/lib/common/model/openai-chat-options.js.map +1 -0
  71. package/lib/common/model/openai-embedding-model.d.ts +15 -0
  72. package/lib/common/model/openai-embedding-model.d.ts.map +1 -0
  73. package/lib/common/model/openai-embedding-model.js +64 -0
  74. package/lib/common/model/openai-embedding-model.js.map +1 -0
  75. package/lib/common/model/openai-embedding-model.spec.d.ts +2 -0
  76. package/lib/common/model/openai-embedding-model.spec.d.ts.map +1 -0
  77. package/lib/common/model/openai-embedding-model.spec.js +100 -0
  78. package/lib/common/model/openai-embedding-model.spec.js.map +1 -0
  79. package/lib/common/model/openai-embedding-options.d.ts +35 -0
  80. package/lib/common/model/openai-embedding-options.d.ts.map +1 -0
  81. package/lib/common/model/openai-embedding-options.js +56 -0
  82. package/lib/common/model/openai-embedding-options.js.map +1 -0
  83. package/lib/common/module.d.ts +4 -0
  84. package/lib/common/module.d.ts.map +1 -0
  85. package/lib/common/module.js +6 -0
  86. package/lib/common/module.js.map +1 -0
  87. package/lib/common/support/index.d.ts +3 -0
  88. package/lib/common/support/index.d.ts.map +1 -0
  89. package/lib/common/support/index.js +6 -0
  90. package/lib/common/support/index.js.map +1 -0
  91. package/lib/common/support/openai-api-response-headers.d.ts +34 -0
  92. package/lib/common/support/openai-api-response-headers.d.ts.map +1 -0
  93. package/lib/common/support/openai-api-response-headers.js +45 -0
  94. package/lib/common/support/openai-api-response-headers.js.map +1 -0
  95. package/lib/common/support/openai-response-header-extractor.d.ts +12 -0
  96. package/lib/common/support/openai-response-header-extractor.d.ts.map +1 -0
  97. package/lib/common/support/openai-response-header-extractor.js +131 -0
  98. package/lib/common/support/openai-response-header-extractor.js.map +1 -0
  99. package/lib/common/test/mock-openai-api.d.ts +13 -0
  100. package/lib/common/test/mock-openai-api.d.ts.map +1 -0
  101. package/lib/common/test/mock-openai-api.js +57 -0
  102. package/lib/common/test/mock-openai-api.js.map +1 -0
  103. package/lib/common/test/test-container.d.ts +3 -0
  104. package/lib/common/test/test-container.d.ts.map +1 -0
  105. package/lib/common/test/test-container.js +16 -0
  106. package/lib/common/test/test-container.js.map +1 -0
  107. package/lib/package.spec.d.ts +1 -0
  108. package/lib/package.spec.d.ts.map +1 -0
  109. package/lib/package.spec.js +4 -0
  110. package/lib/package.spec.js.map +1 -0
  111. package/package.json +46 -0
  112. package/src/common/api/api-protocol.ts +51 -0
  113. package/src/common/api/chat-request.ts +258 -0
  114. package/src/common/api/chat-response.ts +218 -0
  115. package/src/common/api/embeddings-request.ts +92 -0
  116. package/src/common/api/embeddings-response.ts +44 -0
  117. package/src/common/api/index.ts +9 -0
  118. package/src/common/api/message.ts +273 -0
  119. package/src/common/api/openai-api.spec.ts +175 -0
  120. package/src/common/api/openai-api.ts +111 -0
  121. package/src/common/api/openai-model.ts +137 -0
  122. package/src/common/api/response-format.ts +109 -0
  123. package/src/common/api/usage.ts +135 -0
  124. package/src/common/index.ts +3 -0
  125. package/src/common/model/index.ts +4 -0
  126. package/src/common/model/openai-chat-model.spec.ts +85 -0
  127. package/src/common/model/openai-chat-model.ts +399 -0
  128. package/src/common/model/openai-chat-options.ts +326 -0
  129. package/src/common/model/openai-embedding-model.spec.ts +112 -0
  130. package/src/common/model/openai-embedding-model.ts +83 -0
  131. package/src/common/model/openai-embedding-options.ts +72 -0
  132. package/src/common/module.ts +4 -0
  133. package/src/common/support/index.ts +2 -0
  134. package/src/common/support/openai-api-response-headers.ts +46 -0
  135. package/src/common/support/openai-response-header-extractor.ts +141 -0
  136. package/src/common/test/mock-openai-api.ts +70 -0
  137. package/src/common/test/test-container.ts +13 -0
  138. package/src/package.spec.ts +4 -0
@@ -0,0 +1,193 @@
1
+ import { ChatCompletionFinishReason, ChatCompletionMessage } from './message';
2
+ import { Usage } from './usage';
3
+ /**
4
+ * The most likely tokens and their log probability, at this token position.
5
+ */
6
+ export declare class TopLogProbs {
7
+ /**
8
+ * The token.
9
+ */
10
+ token: string;
11
+ /**
12
+ * The log probability of the token.
13
+ */
14
+ logprob: number;
15
+ /**
16
+ * A list of integers representing the UTF-8 bytes
17
+ * representation of the token. Useful in instances where characters are represented by multiple
18
+ * tokens and their byte representations must be combined to generate the correct
19
+ * text representation. Can be null if there is no bytes representation for the
20
+ * token.
21
+ */
22
+ probBytes: number[];
23
+ }
24
+ /**
25
+ * Message content tokens with log probability information.
26
+ */
27
+ export declare class Content {
28
+ /**
29
+ * The token.
30
+ */
31
+ token: string;
32
+ /**
33
+ * The log probability of the token.
34
+ */
35
+ logprob: number;
36
+ /**
37
+ * A list of integers representing the UTF-8 bytes representation
38
+ * of the token. Useful in instances where characters are represented by multiple
39
+ * tokens and their byte representations must be combined to generate the correct
40
+ * text representation. Can be null if there is no bytes representation for the
41
+ * token.
42
+ */
43
+ probBytes: number[];
44
+ /**
45
+ * List of the most likely tokens and their log probability, at
46
+ * this token position. In rare cases, there may be fewer than the number of
47
+ * requested top_logprobs returned.
48
+ */
49
+ topLogprobs: TopLogProbs[];
50
+ }
51
+ /**
52
+ * Log probability information for the choice.
53
+ */
54
+ export declare class LogProbs {
55
+ /**
56
+ * Message content tokens with log probability information.
57
+ */
58
+ content: Content[];
59
+ /**
60
+ * Message refusal tokens with log probability information.
61
+ */
62
+ refusal: Content[];
63
+ }
64
+ /**
65
+ * Chat completion choice.
66
+ */
67
+ export declare class Choice {
68
+ /**
69
+ * The reason the model stopped generating tokens.
70
+ */
71
+ finishReason: ChatCompletionFinishReason;
72
+ /**
73
+ * The index of the choice in the list of choices.
74
+ */
75
+ index: number;
76
+ /**
77
+ * A chat completion message generated by the model.
78
+ */
79
+ message: ChatCompletionMessage;
80
+ /**
81
+ * Log probability information for the choice.
82
+ */
83
+ logprobs: LogProbs;
84
+ }
85
+ /**
86
+ * Represents a chat completion response returned by model, based on the provided
87
+ * input.
88
+ */
89
+ export declare class ChatCompletion {
90
+ /**
91
+ * A unique identifier for the chat completion.
92
+ */
93
+ id: string;
94
+ /**
95
+ * A list of chat completion choices. Can be more than one if n is
96
+ * greater than 1.
97
+ */
98
+ choices: Choice[];
99
+ /**
100
+ * The Unix timestamp (in seconds) of when the chat completion was
101
+ * created.
102
+ */
103
+ created: number;
104
+ /**
105
+ * The model used for the chat completion.
106
+ */
107
+ model: string;
108
+ /**
109
+ * The service tier used for processing the request. This field is
110
+ * only included if the service_tier parameter is specified in the request.
111
+ */
112
+ serviceTier: string;
113
+ /**
114
+ * This fingerprint represents the backend configuration that
115
+ * the model runs with. Can be used in conjunction with the seed request parameter to
116
+ * understand when backend changes have been made that might impact determinism.
117
+ */
118
+ systemFingerprint: string;
119
+ /**
120
+ * The object type, which is always chat.completion.
121
+ */
122
+ object: string;
123
+ /**
124
+ * Usage statistics for the completion request.
125
+ */
126
+ usage: Usage;
127
+ }
128
+ /**
129
+ * Chat completion choice.
130
+ */
131
+ export declare class ChunkChoice {
132
+ /**
133
+ * The reason the model stopped generating tokens.
134
+ */
135
+ finishReason: ChatCompletionFinishReason;
136
+ /**
137
+ * The index of the choice in the list of choices.
138
+ */
139
+ index: number;
140
+ /**
141
+ * A chat completion delta generated by streamed model responses.
142
+ */
143
+ delta: ChatCompletionMessage;
144
+ /**
145
+ * Log probability information for the choice.
146
+ */
147
+ logprobs: LogProbs;
148
+ }
149
+ /**
150
+ * Represents a streamed chunk of a chat completion response returned by model, based
151
+ * on the provided input.
152
+ */
153
+ export declare class ChatCompletionChunk {
154
+ /**
155
+ * A unique identifier for the chat completion. Each chunk has the same ID.
156
+ */
157
+ id: string;
158
+ /**
159
+ * A list of chat completion choices. Can be more than one if n is
160
+ * greater than 1.
161
+ */
162
+ choices: ChunkChoice[];
163
+ /**
164
+ * The Unix timestamp (in seconds) of when the chat completion was
165
+ * created. Each chunk has the same timestamp.
166
+ */
167
+ created: number;
168
+ /**
169
+ * The model used for the chat completion.
170
+ */
171
+ model: string;
172
+ /**
173
+ * The service tier used for processing the request. This field is
174
+ * only included if the service_tier parameter is specified in the request.
175
+ */
176
+ serviceTier: string;
177
+ /**
178
+ * This fingerprint represents the backend configuration that
179
+ * the model runs with. Can be used in conjunction with the seed request parameter to
180
+ * understand when backend changes have been made that might impact determinism.
181
+ */
182
+ systemFingerprint: string;
183
+ /**
184
+ * The object type, which is always 'chat.completion.chunk'.
185
+ */
186
+ object: string;
187
+ /**
188
+ * Usage statistics for the completion request. Present in the last chunk
189
+ * only if the StreamOptions.includeUsage is set to true.
190
+ */
191
+ usage: Usage;
192
+ }
193
+ //# sourceMappingURL=chat-response.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-response.d.ts","sourceRoot":"","sources":["../../../src/common/api/chat-response.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAC9E,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC;;GAEG;AACH,qBAAa,WAAW;IACpB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;;OAMG;IAEH,SAAS,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;GAEG;AACH,qBAAa,OAAO;IAChB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;;OAMG;IAEH,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB;;;;OAIG;IAEH,WAAW,EAAE,WAAW,EAAE,CAAC;CAC9B;AAED;;GAEG;AACH,qBAAa,QAAQ;IACjB;;OAEG;IAEH,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB;;OAEG;IAEH,OAAO,EAAE,OAAO,EAAE,CAAC;CACtB;AAED;;GAEG;AACH,qBAAa,MAAM;IACf;;OAEG;IAEH,YAAY,EAAE,0BAA0B,CAAC;IACzC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IAEH,OAAO,EAAE,qBAAqB,CAAC;IAC/B;;OAEG;IACH,QAAQ,EAAE,QAAQ,CAAC;CACtB;AAED;;;GAGG;AACH,qBAAa,cAAc;IACvB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;;OAGG;IAEH,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IAEH,WAAW,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IAEH,iBAAiB,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IAEH,KAAK,EAAE,KAAK,CAAC;CAChB;AAED;;GAEG;AACH,qBAAa,WAAW;IACpB;;OAEG;IAEH,YAAY,EAAE,0BAA0B,CAAC;IACzC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IAEH,KAAK,EAAE,qBAAqB,CAAC;IAC7B;;OAEG;IAEH,QAAQ,EAAE,QAAQ,CAAC;CACtB;AAED;;;GAGG;AACH,qBAAa,mBAAmB;IAC5B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;;OAGG;IAEH,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IAEH,WAAW,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IAEH,iBAAiB,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IAEH,KAAK,EAAE,KAAK,CAAC;CAChB"}
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ChatCompletionChunk = exports.ChunkChoice = exports.ChatCompletion = exports.Choice = exports.LogProbs = exports.Content = exports.TopLogProbs = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const class_transformer_1 = require("class-transformer");
6
+ const message_1 = require("./message");
7
+ const usage_1 = require("./usage");
8
+ /**
9
+ * The most likely tokens and their log probability, at this token position.
10
+ */
11
+ class TopLogProbs {
12
+ }
13
+ tslib_1.__decorate([
14
+ (0, class_transformer_1.Expose)({ name: 'bytes' }),
15
+ tslib_1.__metadata("design:type", Array)
16
+ ], TopLogProbs.prototype, "probBytes", void 0);
17
+ exports.TopLogProbs = TopLogProbs;
18
+ /**
19
+ * Message content tokens with log probability information.
20
+ */
21
+ class Content {
22
+ }
23
+ tslib_1.__decorate([
24
+ (0, class_transformer_1.Expose)({ name: 'bytes' }),
25
+ tslib_1.__metadata("design:type", Array)
26
+ ], Content.prototype, "probBytes", void 0);
27
+ tslib_1.__decorate([
28
+ (0, class_transformer_1.Expose)({ name: 'top_logprobs' }),
29
+ tslib_1.__metadata("design:type", Array)
30
+ ], Content.prototype, "topLogprobs", void 0);
31
+ exports.Content = Content;
32
+ /**
33
+ * Log probability information for the choice.
34
+ */
35
+ class LogProbs {
36
+ }
37
+ tslib_1.__decorate([
38
+ (0, class_transformer_1.Type)(() => Content),
39
+ tslib_1.__metadata("design:type", Array)
40
+ ], LogProbs.prototype, "content", void 0);
41
+ tslib_1.__decorate([
42
+ (0, class_transformer_1.Type)(() => Content),
43
+ tslib_1.__metadata("design:type", Array)
44
+ ], LogProbs.prototype, "refusal", void 0);
45
+ exports.LogProbs = LogProbs;
46
+ /**
47
+ * Chat completion choice.
48
+ */
49
+ class Choice {
50
+ }
51
+ tslib_1.__decorate([
52
+ (0, class_transformer_1.Expose)({ name: 'finish_reason' }),
53
+ tslib_1.__metadata("design:type", String)
54
+ ], Choice.prototype, "finishReason", void 0);
55
+ tslib_1.__decorate([
56
+ (0, class_transformer_1.Type)(() => message_1.ChatCompletionMessage),
57
+ tslib_1.__metadata("design:type", message_1.ChatCompletionMessage)
58
+ ], Choice.prototype, "message", void 0);
59
+ exports.Choice = Choice;
60
+ /**
61
+ * Represents a chat completion response returned by model, based on the provided
62
+ * input.
63
+ */
64
+ class ChatCompletion {
65
+ }
66
+ tslib_1.__decorate([
67
+ (0, class_transformer_1.Type)(() => Choice),
68
+ tslib_1.__metadata("design:type", Array)
69
+ ], ChatCompletion.prototype, "choices", void 0);
70
+ tslib_1.__decorate([
71
+ (0, class_transformer_1.Expose)({ name: 'service_tier' }),
72
+ tslib_1.__metadata("design:type", String)
73
+ ], ChatCompletion.prototype, "serviceTier", void 0);
74
+ tslib_1.__decorate([
75
+ (0, class_transformer_1.Expose)({ name: 'system_fingerprint' }),
76
+ tslib_1.__metadata("design:type", String)
77
+ ], ChatCompletion.prototype, "systemFingerprint", void 0);
78
+ tslib_1.__decorate([
79
+ (0, class_transformer_1.Type)(() => usage_1.Usage),
80
+ tslib_1.__metadata("design:type", usage_1.Usage)
81
+ ], ChatCompletion.prototype, "usage", void 0);
82
+ exports.ChatCompletion = ChatCompletion;
83
+ /**
84
+ * Chat completion choice.
85
+ */
86
+ class ChunkChoice {
87
+ }
88
+ tslib_1.__decorate([
89
+ (0, class_transformer_1.Expose)({ name: 'finish_reason' }),
90
+ tslib_1.__metadata("design:type", String)
91
+ ], ChunkChoice.prototype, "finishReason", void 0);
92
+ tslib_1.__decorate([
93
+ (0, class_transformer_1.Type)(() => message_1.ChatCompletionMessage),
94
+ tslib_1.__metadata("design:type", message_1.ChatCompletionMessage)
95
+ ], ChunkChoice.prototype, "delta", void 0);
96
+ tslib_1.__decorate([
97
+ (0, class_transformer_1.Type)(() => LogProbs),
98
+ tslib_1.__metadata("design:type", LogProbs)
99
+ ], ChunkChoice.prototype, "logprobs", void 0);
100
+ exports.ChunkChoice = ChunkChoice;
101
+ /**
102
+ * Represents a streamed chunk of a chat completion response returned by model, based
103
+ * on the provided input.
104
+ */
105
+ class ChatCompletionChunk {
106
+ }
107
+ tslib_1.__decorate([
108
+ (0, class_transformer_1.Type)(() => ChunkChoice),
109
+ tslib_1.__metadata("design:type", Array)
110
+ ], ChatCompletionChunk.prototype, "choices", void 0);
111
+ tslib_1.__decorate([
112
+ (0, class_transformer_1.Expose)({ name: 'service_tier' }),
113
+ tslib_1.__metadata("design:type", String)
114
+ ], ChatCompletionChunk.prototype, "serviceTier", void 0);
115
+ tslib_1.__decorate([
116
+ (0, class_transformer_1.Expose)({ name: 'system_fingerprint' }),
117
+ tslib_1.__metadata("design:type", String)
118
+ ], ChatCompletionChunk.prototype, "systemFingerprint", void 0);
119
+ tslib_1.__decorate([
120
+ (0, class_transformer_1.Type)(() => usage_1.Usage),
121
+ tslib_1.__metadata("design:type", usage_1.Usage)
122
+ ], ChatCompletionChunk.prototype, "usage", void 0);
123
+ exports.ChatCompletionChunk = ChatCompletionChunk;
124
+ //# sourceMappingURL=chat-response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-response.js","sourceRoot":"","sources":["../../../src/common/api/chat-response.ts"],"names":[],"mappings":";;;;AAAA,yDAAiD;AACjD,uCAA8E;AAC9E,mCAAgC;AAEhC;;GAEG;AACH,MAAa,WAAW;CAkBvB;AAFG;IAAC,IAAA,0BAAM,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;8CACN;AAjBxB,kCAkBC;AAED;;GAEG;AACH,MAAa,OAAO;CAyBnB;AATG;IAAC,IAAA,0BAAM,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;0CACN;AAMpB;IAAC,IAAA,0BAAM,EAAC,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;;4CACN;AAxB/B,0BAyBC;AAED;;GAEG;AACH,MAAa,QAAQ;CAWpB;AAPG;IAAC,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,OAAO,CAAC;;yCACD;AAInB;IAAC,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,OAAO,CAAC;;yCACD;AAVvB,4BAWC;AAED;;GAEG;AACH,MAAa,MAAM;CAmBlB;AAfG;IAAC,IAAA,0BAAM,EAAC,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;;4CACO;AAQzC;IAAC,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,+BAAqB,CAAC;sCACzB,+BAAqB;uCAAC;AAdnC,wBAmBC;AAED;;;GAGG;AACH,MAAa,cAAc;CA0C1B;AAjCG;IAAC,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC;;+CACD;AAclB;IAAC,IAAA,0BAAM,EAAC,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;;mDACb;AAMpB;IAAC,IAAA,0BAAM,EAAC,EAAE,IAAI,EAAE,oBAAoB,EAAE,CAAC;;yDACb;AAQ1B;IAAC,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,aAAK,CAAC;sCACX,aAAK;6CAAC;AAzCjB,wCA0CC;AAED;;GAEG;AACH,MAAa,WAAW;CAoBvB;AAhBG;IAAC,IAAA,0BAAM,EAAC,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;;iDACO;AAQzC;IAAC,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,+BAAqB,CAAC;sCAC3B,+BAAqB;0CAAC;AAI7B;IAAC,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,QAAQ,CAAC;sCACX,QAAQ;6CAAC;AAnBvB,kCAoBC;AAED;;;GAGG;AACH,MAAa,mBAAmB;CA2C/B;AAlCG;IAAC,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,WAAW,CAAC;;oDACD;AAcvB;IAAC,IAAA,0BAAM,EAAC,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;;wDACb;AAMpB;IAAC,IAAA,0BAAM,EAAC,EAAE,IAAI,EAAE,oBAAoB,EAAE,CAAC;;8DACb;AAS1B;IAAC,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,aAAK,CAAC;sCACX,aAAK;kDAAC;AA1CjB,kDA2CC"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Represents an embedding vector returned by embedding endpoint.
3
+ */
4
+ export declare class Embedding {
5
+ /**
6
+ * The index of the embedding in the list of embeddings.
7
+ */
8
+ index: number;
9
+ /**
10
+ * The embedding vector, which is a list of floats. The length of vector depends on the model.
11
+ */
12
+ embedding: number[];
13
+ /**
14
+ * The object type, which is always 'embedding'.
15
+ */
16
+ object: string;
17
+ constructor(index: number, embedding: number[], object?: string);
18
+ }
19
+ /**
20
+ * Creates an embedding vector representing the input text.
21
+ */
22
+ export declare class EmbeddingRequest<T> {
23
+ /**
24
+ * Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request,
25
+ * pass an array of strings or array of token arrays.
26
+ * The input must not exceed the max input tokens for the model (8192 tokens for text-embedding-ada-002),
27
+ * cannot be an empty string, and any array must be 2048 dimensions or less.
28
+ */
29
+ input: T;
30
+ /**
31
+ * ID of the model to use.
32
+ */
33
+ model: string;
34
+ /**
35
+ * The format to return the embeddings in. Can be either float or base64.
36
+ */
37
+ encodingFormat: string;
38
+ /**
39
+ * The number of dimensions the resulting output embeddings should have. Only supported in text-embedding-3 and later models.
40
+ */
41
+ dimensions?: number;
42
+ /**
43
+ * A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.
44
+ */
45
+ user?: string;
46
+ constructor(input: T, model: string, encodingFormat?: string, dimensions?: number, user?: string);
47
+ /**
48
+ * Create an embedding request with the given input, model and encoding format set to float.
49
+ * @param input Input text to embed.
50
+ * @param model ID of the model to use.
51
+ */
52
+ static fromInputAndModel<T>(input: T, model: string): EmbeddingRequest<T>;
53
+ /**
54
+ * Create an embedding request with the given input. Encoding format is set to float and user is null and the model is set to 'text-embedding-ada-002'.
55
+ * @param input Input text to embed.
56
+ */
57
+ static fromInput<T>(input: T): EmbeddingRequest<T>;
58
+ }
59
+ //# sourceMappingURL=embeddings-request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embeddings-request.d.ts","sourceRoot":"","sources":["../../../src/common/api/embeddings-request.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,qBAAa,SAAS;IAClB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,SAAS,EAAE,MAAM,EAAE,CAAC;IAEpB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;gBAEH,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,MAAM,GAAE,MAAoB;CAK/E;AAED;;GAEG;AACH,qBAAa,gBAAgB,CAAC,CAAC;IAC3B;;;;;OAKG;IACH,KAAK,EAAE,CAAC,CAAC;IAET;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IAEH,cAAc,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;gBAGV,KAAK,EAAE,CAAC,EACR,KAAK,EAAE,MAAM,EACb,cAAc,GAAE,MAAgB,EAChC,UAAU,CAAC,EAAE,MAAM,EACnB,IAAI,CAAC,EAAE,MAAM;IASjB;;;;OAIG;IACH,MAAM,CAAC,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,gBAAgB,CAAC,CAAC,CAAC;IAIzE;;;OAGG;IACH,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC;CAGrD"}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EmbeddingRequest = exports.Embedding = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const class_transformer_1 = require("class-transformer");
6
+ /**
7
+ * Represents an embedding vector returned by embedding endpoint.
8
+ */
9
+ class Embedding {
10
+ constructor(index, embedding, object = 'embedding') {
11
+ this.index = index;
12
+ this.embedding = embedding;
13
+ this.object = object;
14
+ }
15
+ }
16
+ exports.Embedding = Embedding;
17
+ /**
18
+ * Creates an embedding vector representing the input text.
19
+ */
20
+ class EmbeddingRequest {
21
+ constructor(input, model, encodingFormat = 'float', dimensions, user) {
22
+ this.input = input;
23
+ this.model = model;
24
+ this.encodingFormat = encodingFormat;
25
+ this.dimensions = dimensions;
26
+ this.user = user;
27
+ }
28
+ /**
29
+ * Create an embedding request with the given input, model and encoding format set to float.
30
+ * @param input Input text to embed.
31
+ * @param model ID of the model to use.
32
+ */
33
+ static fromInputAndModel(input, model) {
34
+ return new EmbeddingRequest(input, model);
35
+ }
36
+ /**
37
+ * Create an embedding request with the given input. Encoding format is set to float and user is null and the model is set to 'text-embedding-ada-002'.
38
+ * @param input Input text to embed.
39
+ */
40
+ static fromInput(input) {
41
+ return new EmbeddingRequest(input, 'text-embedding-ada-002');
42
+ }
43
+ }
44
+ tslib_1.__decorate([
45
+ (0, class_transformer_1.Expose)({ name: 'encoding_format' }),
46
+ tslib_1.__metadata("design:type", String)
47
+ ], EmbeddingRequest.prototype, "encodingFormat", void 0);
48
+ exports.EmbeddingRequest = EmbeddingRequest;
49
+ //# sourceMappingURL=embeddings-request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embeddings-request.js","sourceRoot":"","sources":["../../../src/common/api/embeddings-request.ts"],"names":[],"mappings":";;;;AAAA,yDAA2C;AAE3C;;GAEG;AACH,MAAa,SAAS;IAgBlB,YAAY,KAAa,EAAE,SAAmB,EAAE,SAAiB,WAAW;QACxE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;CACJ;AArBD,8BAqBC;AAED;;GAEG;AACH,MAAa,gBAAgB;IA8BzB,YACI,KAAQ,EACR,KAAa,EACb,iBAAyB,OAAO,EAChC,UAAmB,EACnB,IAAa;QAEb,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,iBAAiB,CAAI,KAAQ,EAAE,KAAa;QAC/C,OAAO,IAAI,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC9C,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,SAAS,CAAI,KAAQ;QACxB,OAAO,IAAI,gBAAgB,CAAC,KAAK,EAAE,wBAAwB,CAAC,CAAC;IACjE,CAAC;CACJ;AA3CG;IAAC,IAAA,0BAAM,EAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,CAAC;;wDACb;AAlB3B,4CA4DC"}
@@ -0,0 +1,27 @@
1
+ import { Embedding } from './embeddings-request';
2
+ import { Usage } from './usage';
3
+ /**
4
+ * List of multiple embedding responses.
5
+ *
6
+ * @typeparam T Type of the entities in the data list.
7
+ */
8
+ export declare class EmbeddingResponse {
9
+ /**
10
+ * Must have value "list".
11
+ */
12
+ object: string;
13
+ /**
14
+ * List of entities.
15
+ */
16
+ data: Embedding[];
17
+ /**
18
+ * ID of the model to use.
19
+ */
20
+ model: string;
21
+ /**
22
+ * Usage statistics for the completion request.
23
+ */
24
+ usage: Usage;
25
+ constructor(object: string, data: Embedding[], model: string, usage: Usage);
26
+ }
27
+ //# sourceMappingURL=embeddings-response.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embeddings-response.d.ts","sourceRoot":"","sources":["../../../src/common/api/embeddings-response.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC;;;;GAIG;AACH,qBAAa,iBAAiB;IAC1B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IAEH,IAAI,EAAE,SAAS,EAAE,CAAC;IAElB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IAEH,KAAK,EAAE,KAAK,CAAC;gBAGT,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,SAAS,EAAE,EACjB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,KAAK;CAOnB"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EmbeddingResponse = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const class_transformer_1 = require("class-transformer");
6
+ const embeddings_request_1 = require("./embeddings-request");
7
+ const usage_1 = require("./usage");
8
+ /**
9
+ * List of multiple embedding responses.
10
+ *
11
+ * @typeparam T Type of the entities in the data list.
12
+ */
13
+ class EmbeddingResponse {
14
+ constructor(object, data, model, usage) {
15
+ this.object = object;
16
+ this.data = data;
17
+ this.model = model;
18
+ this.usage = usage;
19
+ }
20
+ }
21
+ tslib_1.__decorate([
22
+ (0, class_transformer_1.Type)(() => embeddings_request_1.Embedding),
23
+ tslib_1.__metadata("design:type", Array)
24
+ ], EmbeddingResponse.prototype, "data", void 0);
25
+ tslib_1.__decorate([
26
+ (0, class_transformer_1.Type)(() => usage_1.Usage),
27
+ tslib_1.__metadata("design:type", usage_1.Usage)
28
+ ], EmbeddingResponse.prototype, "usage", void 0);
29
+ exports.EmbeddingResponse = EmbeddingResponse;
30
+ //# sourceMappingURL=embeddings-response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embeddings-response.js","sourceRoot":"","sources":["../../../src/common/api/embeddings-response.ts"],"names":[],"mappings":";;;;AAAA,yDAAyC;AACzC,6DAAiD;AACjD,mCAAgC;AAEhC;;;;GAIG;AACH,MAAa,iBAAiB;IAuB1B,YACI,MAAc,EACd,IAAiB,EACjB,KAAa,EACb,KAAY;QAEZ,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;CACJ;AAzBG;IAAC,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,8BAAS,CAAC;;+CACJ;AAUlB;IAAC,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,aAAK,CAAC;sCACX,aAAK;gDAAC;AArBjB,8CAkCC"}
@@ -0,0 +1,10 @@
1
+ export * from './api-protocol';
2
+ export * from './chat-request';
3
+ export * from './chat-response';
4
+ export * from './embeddings-request';
5
+ export * from './embeddings-response';
6
+ export * from './openai-api';
7
+ export * from './message';
8
+ export * from './openai-model';
9
+ export * from './response-format';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/common/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./api-protocol"), exports);
5
+ tslib_1.__exportStar(require("./chat-request"), exports);
6
+ tslib_1.__exportStar(require("./chat-response"), exports);
7
+ tslib_1.__exportStar(require("./embeddings-request"), exports);
8
+ tslib_1.__exportStar(require("./embeddings-response"), exports);
9
+ tslib_1.__exportStar(require("./openai-api"), exports);
10
+ tslib_1.__exportStar(require("./message"), exports);
11
+ tslib_1.__exportStar(require("./openai-model"), exports);
12
+ tslib_1.__exportStar(require("./response-format"), exports);
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/api/index.ts"],"names":[],"mappings":";;;AAAA,yDAA+B;AAC/B,yDAA+B;AAC/B,0DAAgC;AAChC,+DAAqC;AACrC,gEAAsC;AACtC,uDAA6B;AAC7B,oDAA0B;AAC1B,yDAA+B;AAC/B,4DAAkC"}