ogx-client 0.8.0 → 1.0.0

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 (176) hide show
  1. package/.github/workflows/release-doctor.yml +0 -2
  2. package/.release-please-manifest.json +1 -1
  3. package/.stats.yml +4 -4
  4. package/CHANGELOG.md +27 -0
  5. package/CONTRIBUTING.md +0 -14
  6. package/README.md +5 -4
  7. package/api.md +26 -48
  8. package/bin/check-release-environment +0 -4
  9. package/dist/CHANGELOG.md +27 -0
  10. package/dist/README.md +5 -4
  11. package/dist/index.d.mts +2 -18
  12. package/dist/index.d.ts +2 -18
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +0 -15
  15. package/dist/index.js.map +1 -1
  16. package/dist/index.mjs +1 -16
  17. package/dist/index.mjs.map +1 -1
  18. package/dist/package.json +1 -1
  19. package/dist/resources/chat/chat.d.ts +2 -2
  20. package/dist/resources/chat/chat.d.ts.map +1 -1
  21. package/dist/resources/chat/chat.js +2 -2
  22. package/dist/resources/chat/chat.js.map +1 -1
  23. package/dist/resources/chat/chat.mjs +2 -2
  24. package/dist/resources/chat/completions/completions.d.ts +2021 -0
  25. package/dist/resources/chat/completions/completions.d.ts.map +1 -0
  26. package/dist/resources/chat/completions/completions.js +70 -0
  27. package/dist/resources/chat/completions/completions.js.map +1 -0
  28. package/dist/resources/chat/completions/completions.mjs +43 -0
  29. package/dist/resources/chat/completions/completions.mjs.map +1 -0
  30. package/dist/resources/chat/completions/index.d.ts +3 -0
  31. package/dist/resources/chat/completions/index.d.ts.map +1 -0
  32. package/dist/resources/chat/completions/index.js +16 -0
  33. package/dist/resources/chat/completions/index.js.map +1 -0
  34. package/dist/resources/chat/completions/index.mjs +10 -0
  35. package/dist/resources/chat/completions/index.mjs.map +1 -0
  36. package/dist/resources/chat/completions/messages.d.ts +204 -0
  37. package/dist/resources/chat/completions/messages.d.ts.map +1 -0
  38. package/dist/resources/chat/completions/messages.js +35 -0
  39. package/dist/resources/chat/completions/messages.js.map +1 -0
  40. package/dist/resources/chat/completions/messages.mjs +30 -0
  41. package/dist/resources/chat/completions/messages.mjs.map +1 -0
  42. package/dist/resources/chat/completions.d.ts +1 -2020
  43. package/dist/resources/chat/completions.d.ts.map +1 -1
  44. package/dist/resources/chat/completions.js +15 -29
  45. package/dist/resources/chat/completions.js.map +1 -1
  46. package/dist/resources/chat/completions.mjs +1 -27
  47. package/dist/resources/chat/completions.mjs.map +1 -1
  48. package/dist/resources/chat/index.d.ts +1 -1
  49. package/dist/resources/chat/index.d.ts.map +1 -1
  50. package/dist/resources/chat/index.js +2 -2
  51. package/dist/resources/chat/index.js.map +1 -1
  52. package/dist/resources/chat/index.mjs +1 -1
  53. package/dist/resources/completions.d.ts +2 -2
  54. package/dist/resources/completions.d.ts.map +1 -1
  55. package/dist/resources/conversations/conversations.d.ts +12 -11
  56. package/dist/resources/conversations/conversations.d.ts.map +1 -1
  57. package/dist/resources/conversations/conversations.js.map +1 -1
  58. package/dist/resources/conversations/conversations.mjs.map +1 -1
  59. package/dist/resources/conversations/index.d.ts +1 -1
  60. package/dist/resources/conversations/index.d.ts.map +1 -1
  61. package/dist/resources/conversations/items.d.ts +49 -29
  62. package/dist/resources/conversations/items.d.ts.map +1 -1
  63. package/dist/resources/conversations/items.js +5 -5
  64. package/dist/resources/conversations/items.js.map +1 -1
  65. package/dist/resources/conversations/items.mjs +5 -5
  66. package/dist/resources/conversations/items.mjs.map +1 -1
  67. package/dist/resources/files.d.ts +10 -10
  68. package/dist/resources/files.d.ts.map +1 -1
  69. package/dist/resources/files.js.map +1 -1
  70. package/dist/resources/files.mjs.map +1 -1
  71. package/dist/resources/index.d.ts +1 -4
  72. package/dist/resources/index.d.ts.map +1 -1
  73. package/dist/resources/index.js +1 -7
  74. package/dist/resources/index.js.map +1 -1
  75. package/dist/resources/index.mjs +1 -4
  76. package/dist/resources/index.mjs.map +1 -1
  77. package/dist/resources/models/index.d.ts +2 -2
  78. package/dist/resources/models/index.d.ts.map +1 -1
  79. package/dist/resources/models/index.js.map +1 -1
  80. package/dist/resources/models/index.mjs +1 -1
  81. package/dist/resources/models/index.mjs.map +1 -1
  82. package/dist/resources/models/models.d.ts +220 -32
  83. package/dist/resources/models/models.d.ts.map +1 -1
  84. package/dist/resources/models/models.js +32 -10
  85. package/dist/resources/models/models.js.map +1 -1
  86. package/dist/resources/models/models.mjs +32 -10
  87. package/dist/resources/models/models.mjs.map +1 -1
  88. package/dist/resources/models/openai.d.ts +128 -2
  89. package/dist/resources/models/openai.d.ts.map +1 -1
  90. package/dist/resources/models/openai.js +17 -5
  91. package/dist/resources/models/openai.js.map +1 -1
  92. package/dist/resources/models/openai.mjs +17 -5
  93. package/dist/resources/models/openai.mjs.map +1 -1
  94. package/dist/resources/responses/responses.d.ts +0 -16
  95. package/dist/resources/responses/responses.d.ts.map +1 -1
  96. package/dist/resources/responses/responses.js.map +1 -1
  97. package/dist/resources/responses/responses.mjs.map +1 -1
  98. package/dist/resources/shared.d.ts +0 -19
  99. package/dist/resources/shared.d.ts.map +1 -1
  100. package/dist/src/index.ts +12 -43
  101. package/dist/src/resources/chat/chat.ts +2 -2
  102. package/dist/src/resources/chat/completions/completions.ts +2444 -0
  103. package/dist/src/resources/chat/completions/index.ts +24 -0
  104. package/dist/src/resources/chat/completions/messages.ts +273 -0
  105. package/dist/src/resources/chat/completions.ts +1 -2422
  106. package/dist/src/resources/chat/index.ts +1 -1
  107. package/dist/src/resources/completions.ts +2 -2
  108. package/dist/src/resources/conversations/conversations.ts +15 -9
  109. package/dist/src/resources/conversations/index.ts +1 -1
  110. package/dist/src/resources/conversations/items.ts +84 -28
  111. package/dist/src/resources/files.ts +29 -10
  112. package/dist/src/resources/index.ts +9 -10
  113. package/dist/src/resources/models/index.ts +10 -2
  114. package/dist/src/resources/models/models.ts +321 -32
  115. package/dist/src/resources/models/openai.ts +180 -3
  116. package/dist/src/resources/responses/responses.ts +0 -21
  117. package/dist/src/resources/shared.ts +0 -20
  118. package/dist/src/version.ts +1 -1
  119. package/dist/version.d.ts +1 -1
  120. package/dist/version.js +1 -1
  121. package/dist/version.mjs +1 -1
  122. package/package.json +1 -1
  123. package/src/index.ts +12 -43
  124. package/src/resources/chat/chat.ts +2 -2
  125. package/src/resources/chat/completions/completions.ts +2444 -0
  126. package/src/resources/chat/completions/index.ts +24 -0
  127. package/src/resources/chat/completions/messages.ts +273 -0
  128. package/src/resources/chat/completions.ts +1 -2422
  129. package/src/resources/chat/index.ts +1 -1
  130. package/src/resources/completions.ts +2 -2
  131. package/src/resources/conversations/conversations.ts +15 -9
  132. package/src/resources/conversations/index.ts +1 -1
  133. package/src/resources/conversations/items.ts +84 -28
  134. package/src/resources/files.ts +29 -10
  135. package/src/resources/index.ts +9 -10
  136. package/src/resources/models/index.ts +10 -2
  137. package/src/resources/models/models.ts +321 -32
  138. package/src/resources/models/openai.ts +180 -3
  139. package/src/resources/responses/responses.ts +0 -21
  140. package/src/resources/shared.ts +0 -20
  141. package/src/version.ts +1 -1
  142. package/tests/api-resources/chat/{completions.test.ts → completions/completions.test.ts} +0 -1
  143. package/tests/api-resources/chat/completions/messages.test.ts +47 -0
  144. package/tests/api-resources/completions.test.ts +1 -1
  145. package/tests/api-resources/conversations/items.test.ts +12 -0
  146. package/tests/api-resources/models/models.test.ts +34 -0
  147. package/tests/api-resources/models/openai.test.ts +18 -0
  148. package/tests/api-resources/responses/responses.test.ts +0 -2
  149. package/.github/workflows/publish-npm.yml +0 -32
  150. package/dist/resources/moderations.d.ts +0 -83
  151. package/dist/resources/moderations.d.ts.map +0 -1
  152. package/dist/resources/moderations.js +0 -24
  153. package/dist/resources/moderations.js.map +0 -1
  154. package/dist/resources/moderations.mjs +0 -20
  155. package/dist/resources/moderations.mjs.map +0 -1
  156. package/dist/resources/safety.d.ts +0 -297
  157. package/dist/resources/safety.d.ts.map +0 -1
  158. package/dist/resources/safety.js +0 -24
  159. package/dist/resources/safety.js.map +0 -1
  160. package/dist/resources/safety.mjs +0 -20
  161. package/dist/resources/safety.mjs.map +0 -1
  162. package/dist/resources/shields.d.ts +0 -82
  163. package/dist/resources/shields.d.ts.map +0 -1
  164. package/dist/resources/shields.js +0 -46
  165. package/dist/resources/shields.js.map +0 -1
  166. package/dist/resources/shields.mjs +0 -42
  167. package/dist/resources/shields.mjs.map +0 -1
  168. package/dist/src/resources/moderations.ts +0 -97
  169. package/dist/src/resources/safety.ts +0 -367
  170. package/dist/src/resources/shields.ts +0 -119
  171. package/src/resources/moderations.ts +0 -97
  172. package/src/resources/safety.ts +0 -367
  173. package/src/resources/shields.ts +0 -119
  174. package/tests/api-resources/moderations.test.ts +0 -29
  175. package/tests/api-resources/safety.test.ts +0 -41
  176. package/tests/api-resources/shields.test.ts +0 -88
@@ -1,20 +0,0 @@
1
- // Copyright (c) The OGX Contributors.
2
- // All rights reserved.
3
- //
4
- // This source code is licensed under the terms described in the LICENSE file in
5
- // the root directory of this source tree.
6
- //
7
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
8
- import { APIResource } from "../resource.mjs";
9
- /**
10
- * OpenAI-compatible Moderations API.
11
- */
12
- export class Safety extends APIResource {
13
- /**
14
- * Run a safety shield on messages to check for policy violations.
15
- */
16
- runShield(body, options) {
17
- return this._client.post('/v1/safety/run-shield', { body, ...options });
18
- }
19
- }
20
- //# sourceMappingURL=safety.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"safety.mjs","sourceRoot":"","sources":["../src/resources/safety.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,uBAAuB;AACvB,EAAE;AACF,gFAAgF;AAChF,0CAA0C;AAC1C,EAAE;AACF,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAItB;;GAEG;AACH,MAAM,OAAO,MAAO,SAAQ,WAAW;IACrC;;OAEG;IACH,SAAS,CAAC,IAA2B,EAAE,OAA6B;QAClE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,uBAAuB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC1E,CAAC;CACF"}
@@ -1,82 +0,0 @@
1
- import { APIResource } from "../resource.js";
2
- import * as Core from "../core.js";
3
- export declare class Shields extends APIResource {
4
- /**
5
- * Get a shield by its identifier.
6
- */
7
- retrieve(identifier: string, options?: Core.RequestOptions): Core.APIPromise<Shield>;
8
- /**
9
- * List all shields.
10
- */
11
- list(options?: Core.RequestOptions): Core.APIPromise<ShieldListResponse>;
12
- /**
13
- * Unregister a shield.
14
- *
15
- * @deprecated
16
- */
17
- delete(identifier: string, options?: Core.RequestOptions): Core.APIPromise<void>;
18
- /**
19
- * Register a shield.
20
- *
21
- * @deprecated
22
- */
23
- register(body: ShieldRegisterParams, options?: Core.RequestOptions): Core.APIPromise<Shield>;
24
- }
25
- /**
26
- * Response containing a list of all shields.
27
- */
28
- export interface ListShieldsResponse {
29
- /**
30
- * List of shield objects
31
- */
32
- data: ShieldListResponse;
33
- }
34
- /**
35
- * A safety shield resource that can be used to check content.
36
- */
37
- export interface Shield {
38
- /**
39
- * Unique identifier for this resource in ogx
40
- */
41
- identifier: string;
42
- /**
43
- * ID of the provider that owns this resource
44
- */
45
- provider_id: string;
46
- params?: {
47
- [key: string]: unknown;
48
- } | null;
49
- /**
50
- * Unique identifier for this resource in the provider
51
- */
52
- provider_resource_id?: string | null;
53
- type?: 'shield';
54
- }
55
- /**
56
- * List of shield objects
57
- */
58
- export type ShieldListResponse = Array<Shield>;
59
- export interface ShieldRegisterParams {
60
- /**
61
- * The identifier of the shield to register.
62
- */
63
- shield_id: string;
64
- /**
65
- * The parameters of the shield.
66
- */
67
- params?: {
68
- [key: string]: unknown;
69
- } | null;
70
- /**
71
- * The identifier of the provider.
72
- */
73
- provider_id?: string | null;
74
- /**
75
- * The identifier of the shield in the provider.
76
- */
77
- provider_shield_id?: string | null;
78
- }
79
- export declare namespace Shields {
80
- export { type ListShieldsResponse as ListShieldsResponse, type Shield as Shield, type ShieldListResponse as ShieldListResponse, type ShieldRegisterParams as ShieldRegisterParams, };
81
- }
82
- //# sourceMappingURL=shields.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"shields.d.ts","sourceRoot":"","sources":["../src/resources/shields.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,IAAI,MAAM,SAAS,CAAC;AAEhC,qBAAa,OAAQ,SAAQ,WAAW;IACtC;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;IAIpF;;OAEG;IACH,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC;IAMxE;;;;OAIG;IACH,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;IAOhF;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,oBAAoB,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;CAG7F;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,IAAI,EAAE,kBAAkB,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB,MAAM,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IAE3C;;OAEG;IACH,oBAAoB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAErC,IAAI,CAAC,EAAE,QAAQ,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;AAE/C,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,MAAM,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IAE3C;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5B;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC;AAED,MAAM,CAAC,OAAO,WAAW,OAAO,CAAC;IAC/B,OAAO,EACL,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,MAAM,IAAI,MAAM,EACrB,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,oBAAoB,IAAI,oBAAoB,GAClD,CAAC;CACH"}
@@ -1,46 +0,0 @@
1
- "use strict";
2
- // Copyright (c) The OGX Contributors.
3
- // All rights reserved.
4
- //
5
- // This source code is licensed under the terms described in the LICENSE file in
6
- // the root directory of this source tree.
7
- //
8
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.Shields = void 0;
11
- const resource_1 = require("../resource.js");
12
- class Shields extends resource_1.APIResource {
13
- /**
14
- * Get a shield by its identifier.
15
- */
16
- retrieve(identifier, options) {
17
- return this._client.get(`/v1/shields/${identifier}`, options);
18
- }
19
- /**
20
- * List all shields.
21
- */
22
- list(options) {
23
- return this._client.get('/v1/shields', options)._thenUnwrap((obj) => obj.data);
24
- }
25
- /**
26
- * Unregister a shield.
27
- *
28
- * @deprecated
29
- */
30
- delete(identifier, options) {
31
- return this._client.delete(`/v1/shields/${identifier}`, {
32
- ...options,
33
- headers: { Accept: '*/*', ...options?.headers },
34
- });
35
- }
36
- /**
37
- * Register a shield.
38
- *
39
- * @deprecated
40
- */
41
- register(body, options) {
42
- return this._client.post('/v1/shields', { body, ...options });
43
- }
44
- }
45
- exports.Shields = Shields;
46
- //# sourceMappingURL=shields.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"shields.js","sourceRoot":"","sources":["../src/resources/shields.ts"],"names":[],"mappings":";AAAA,sCAAsC;AACtC,uBAAuB;AACvB,EAAE;AACF,gFAAgF;AAChF,0CAA0C;AAC1C,EAAE;AACF,sFAAsF;;;AAEtF,6CAA0C;AAG1C,MAAa,OAAQ,SAAQ,sBAAW;IACtC;;OAEG;IACH,QAAQ,CAAC,UAAkB,EAAE,OAA6B;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,UAAU,EAAE,EAAE,OAAO,CAAC,CAAC;IAChE,CAAC;IAED;;OAEG;IACH,IAAI,CAAC,OAA6B;QAChC,OACE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,OAAO,CACxC,CAAC,WAAW,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,UAAkB,EAAE,OAA6B;QACtD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,eAAe,UAAU,EAAE,EAAE;YACtD,GAAG,OAAO;YACV,OAAO,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE;SAChD,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,IAA0B,EAAE,OAA6B;QAChE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAChE,CAAC;CACF;AArCD,0BAqCC"}
@@ -1,42 +0,0 @@
1
- // Copyright (c) The OGX Contributors.
2
- // All rights reserved.
3
- //
4
- // This source code is licensed under the terms described in the LICENSE file in
5
- // the root directory of this source tree.
6
- //
7
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
8
- import { APIResource } from "../resource.mjs";
9
- export class Shields extends APIResource {
10
- /**
11
- * Get a shield by its identifier.
12
- */
13
- retrieve(identifier, options) {
14
- return this._client.get(`/v1/shields/${identifier}`, options);
15
- }
16
- /**
17
- * List all shields.
18
- */
19
- list(options) {
20
- return this._client.get('/v1/shields', options)._thenUnwrap((obj) => obj.data);
21
- }
22
- /**
23
- * Unregister a shield.
24
- *
25
- * @deprecated
26
- */
27
- delete(identifier, options) {
28
- return this._client.delete(`/v1/shields/${identifier}`, {
29
- ...options,
30
- headers: { Accept: '*/*', ...options?.headers },
31
- });
32
- }
33
- /**
34
- * Register a shield.
35
- *
36
- * @deprecated
37
- */
38
- register(body, options) {
39
- return this._client.post('/v1/shields', { body, ...options });
40
- }
41
- }
42
- //# sourceMappingURL=shields.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"shields.mjs","sourceRoot":"","sources":["../src/resources/shields.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,uBAAuB;AACvB,EAAE;AACF,gFAAgF;AAChF,0CAA0C;AAC1C,EAAE;AACF,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAGtB,MAAM,OAAO,OAAQ,SAAQ,WAAW;IACtC;;OAEG;IACH,QAAQ,CAAC,UAAkB,EAAE,OAA6B;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,UAAU,EAAE,EAAE,OAAO,CAAC,CAAC;IAChE,CAAC;IAED;;OAEG;IACH,IAAI,CAAC,OAA6B;QAChC,OACE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,OAAO,CACxC,CAAC,WAAW,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,UAAkB,EAAE,OAA6B;QACtD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,eAAe,UAAU,EAAE,EAAE;YACtD,GAAG,OAAO;YACV,OAAO,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE;SAChD,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,IAA0B,EAAE,OAA6B;QAChE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAChE,CAAC;CACF"}
@@ -1,97 +0,0 @@
1
- // Copyright (c) The OGX Contributors.
2
- // All rights reserved.
3
- //
4
- // This source code is licensed under the terms described in the LICENSE file in
5
- // the root directory of this source tree.
6
- //
7
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
8
-
9
- import { APIResource } from '../resource';
10
- import * as Core from '../core';
11
-
12
- /**
13
- * OpenAI-compatible Moderations API.
14
- */
15
- export class Moderations extends APIResource {
16
- /**
17
- * Classifies if text inputs are potentially harmful. OpenAI-compatible endpoint.
18
- */
19
- create(body: ModerationCreateParams, options?: Core.RequestOptions): Core.APIPromise<CreateResponse> {
20
- return this._client.post('/v1/moderations', { body, ...options });
21
- }
22
- }
23
-
24
- /**
25
- * A moderation object containing the results of content classification.
26
- */
27
- export interface CreateResponse {
28
- /**
29
- * The unique identifier for the moderation request
30
- */
31
- id: string;
32
-
33
- /**
34
- * The model used to generate the moderation results
35
- */
36
- model: string;
37
-
38
- /**
39
- * A list of moderation result objects
40
- */
41
- results: Array<CreateResponse.Result>;
42
- }
43
-
44
- export namespace CreateResponse {
45
- /**
46
- * A moderation result object containing flagged status and category information.
47
- */
48
- export interface Result {
49
- /**
50
- * Whether any of the below categories are flagged
51
- */
52
- flagged: boolean;
53
-
54
- /**
55
- * A dictionary of the categories, and whether they are flagged or not
56
- */
57
- categories?: { [key: string]: boolean } | null;
58
-
59
- /**
60
- * A dictionary of the categories along with the input type(s) that the score
61
- * applies to
62
- */
63
- category_applied_input_types?: { [key: string]: Array<string> } | null;
64
-
65
- /**
66
- * A dictionary of the categories along with their scores as predicted by model
67
- */
68
- category_scores?: { [key: string]: number } | null;
69
-
70
- /**
71
- * Additional metadata about the moderation
72
- */
73
- metadata?: { [key: string]: unknown };
74
-
75
- /**
76
- * A message to convey to the user about the moderation result
77
- */
78
- user_message?: string | null;
79
- }
80
- }
81
-
82
- export interface ModerationCreateParams {
83
- /**
84
- * Input (or inputs) to classify. Can be a single string or an array of strings.
85
- */
86
- input: string | Array<string>;
87
-
88
- /**
89
- * The content moderation model to use. If not specified, the default shield will
90
- * be used.
91
- */
92
- model?: string | null;
93
- }
94
-
95
- export declare namespace Moderations {
96
- export { type CreateResponse as CreateResponse, type ModerationCreateParams as ModerationCreateParams };
97
- }
@@ -1,367 +0,0 @@
1
- // Copyright (c) The OGX Contributors.
2
- // All rights reserved.
3
- //
4
- // This source code is licensed under the terms described in the LICENSE file in
5
- // the root directory of this source tree.
6
- //
7
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
8
-
9
- import { APIResource } from '../resource';
10
- import * as Core from '../core';
11
- import * as Shared from './shared';
12
-
13
- /**
14
- * OpenAI-compatible Moderations API.
15
- */
16
- export class Safety extends APIResource {
17
- /**
18
- * Run a safety shield on messages to check for policy violations.
19
- */
20
- runShield(body: SafetyRunShieldParams, options?: Core.RequestOptions): Core.APIPromise<RunShieldResponse> {
21
- return this._client.post('/v1/safety/run-shield', { body, ...options });
22
- }
23
- }
24
-
25
- /**
26
- * Response from running a safety shield.
27
- */
28
- export interface RunShieldResponse {
29
- /**
30
- * Details of a safety violation detected by content moderation.
31
- */
32
- violation?: Shared.SafetyViolation | null;
33
- }
34
-
35
- export interface SafetyRunShieldParams {
36
- /**
37
- * The messages to run the shield on
38
- */
39
- messages: Array<
40
- | SafetyRunShieldParams.OpenAIUserMessageParamInput
41
- | SafetyRunShieldParams.OpenAISystemMessageParam
42
- | SafetyRunShieldParams.OpenAIAssistantMessageParamInput
43
- | SafetyRunShieldParams.OpenAIToolMessageParam
44
- | SafetyRunShieldParams.OpenAIDeveloperMessageParam
45
- >;
46
-
47
- /**
48
- * The identifier of the shield to run
49
- */
50
- shield_id: string;
51
- }
52
-
53
- export namespace SafetyRunShieldParams {
54
- /**
55
- * A message from the user in an OpenAI-compatible chat completion request.
56
- */
57
- export interface OpenAIUserMessageParamInput {
58
- /**
59
- * The content of the message, which can include text and other media.
60
- */
61
- content:
62
- | string
63
- | Array<
64
- | OpenAIUserMessageParamInput.OpenAIChatCompletionContentPartTextParam
65
- | OpenAIUserMessageParamInput.OpenAIChatCompletionContentPartImageParam
66
- | OpenAIUserMessageParamInput.OpenAIFile
67
- >;
68
-
69
- /**
70
- * The name of the user message participant.
71
- */
72
- name?: string | null;
73
-
74
- /**
75
- * Must be 'user' to identify this as a user message.
76
- */
77
- role?: 'user';
78
- }
79
-
80
- export namespace OpenAIUserMessageParamInput {
81
- /**
82
- * Text content part for OpenAI-compatible chat completion messages.
83
- */
84
- export interface OpenAIChatCompletionContentPartTextParam {
85
- /**
86
- * The text content of the message.
87
- */
88
- text: string;
89
-
90
- /**
91
- * Must be 'text' to identify this as text content.
92
- */
93
- type?: 'text';
94
- }
95
-
96
- /**
97
- * Image content part for OpenAI-compatible chat completion messages.
98
- */
99
- export interface OpenAIChatCompletionContentPartImageParam {
100
- /**
101
- * Image URL specification and processing details.
102
- */
103
- image_url: OpenAIChatCompletionContentPartImageParam.ImageURL;
104
-
105
- /**
106
- * Must be 'image_url' to identify this as image content.
107
- */
108
- type?: 'image_url';
109
- }
110
-
111
- export namespace OpenAIChatCompletionContentPartImageParam {
112
- /**
113
- * Image URL specification and processing details.
114
- */
115
- export interface ImageURL {
116
- /**
117
- * URL of the image to include in the message.
118
- */
119
- url: string;
120
-
121
- /**
122
- * Level of detail for image processing. Can be 'low', 'high', or 'auto'.
123
- */
124
- detail?: 'low' | 'high' | 'auto' | null;
125
- }
126
- }
127
-
128
- /**
129
- * File content part for OpenAI-compatible chat completion messages.
130
- */
131
- export interface OpenAIFile {
132
- /**
133
- * File specification.
134
- */
135
- file: OpenAIFile.File;
136
-
137
- /**
138
- * Must be 'file' to identify this as file content.
139
- */
140
- type?: 'file';
141
- }
142
-
143
- export namespace OpenAIFile {
144
- /**
145
- * File specification.
146
- */
147
- export interface File {
148
- /**
149
- * Base64-encoded file data.
150
- */
151
- file_data?: string | null;
152
-
153
- /**
154
- * ID of an uploaded file.
155
- */
156
- file_id?: string | null;
157
-
158
- /**
159
- * Name of the file.
160
- */
161
- filename?: string | null;
162
- }
163
- }
164
- }
165
-
166
- /**
167
- * A system message providing instructions or context to the model.
168
- */
169
- export interface OpenAISystemMessageParam {
170
- /**
171
- * The content of the 'system prompt'. If multiple system messages are provided,
172
- * they are concatenated.
173
- */
174
- content: string | Array<OpenAISystemMessageParam.ListOpenAIChatCompletionContentPartTextParam>;
175
-
176
- /**
177
- * The name of the system message participant.
178
- */
179
- name?: string | null;
180
-
181
- /**
182
- * Must be 'system' to identify this as a system message.
183
- */
184
- role?: 'system';
185
- }
186
-
187
- export namespace OpenAISystemMessageParam {
188
- /**
189
- * Text content part for OpenAI-compatible chat completion messages.
190
- */
191
- export interface ListOpenAIChatCompletionContentPartTextParam {
192
- /**
193
- * The text content of the message.
194
- */
195
- text: string;
196
-
197
- /**
198
- * Must be 'text' to identify this as text content.
199
- */
200
- type?: 'text';
201
- }
202
- }
203
-
204
- /**
205
- * A message containing the model's (assistant) response in an OpenAI-compatible
206
- * chat completion request.
207
- */
208
- export interface OpenAIAssistantMessageParamInput {
209
- /**
210
- * The content of the model's response.
211
- */
212
- content?:
213
- | string
214
- | Array<OpenAIAssistantMessageParamInput.ListOpenAIChatCompletionContentPartTextParam>
215
- | null;
216
-
217
- /**
218
- * The name of the assistant message participant.
219
- */
220
- name?: string | null;
221
-
222
- /**
223
- * Must be 'assistant' to identify this as the model's response.
224
- */
225
- role?: 'assistant';
226
-
227
- /**
228
- * List of tool calls. Each tool call is an OpenAIChatCompletionToolCall object.
229
- */
230
- tool_calls?: Array<OpenAIAssistantMessageParamInput.ToolCall> | null;
231
-
232
- [k: string]: unknown;
233
- }
234
-
235
- export namespace OpenAIAssistantMessageParamInput {
236
- /**
237
- * Text content part for OpenAI-compatible chat completion messages.
238
- */
239
- export interface ListOpenAIChatCompletionContentPartTextParam {
240
- /**
241
- * The text content of the message.
242
- */
243
- text: string;
244
-
245
- /**
246
- * Must be 'text' to identify this as text content.
247
- */
248
- type?: 'text';
249
- }
250
-
251
- /**
252
- * Tool call specification for OpenAI-compatible chat completion responses.
253
- */
254
- export interface ToolCall {
255
- /**
256
- * Unique identifier for the tool call.
257
- */
258
- id: string;
259
-
260
- /**
261
- * Function call details.
262
- */
263
- function: ToolCall.Function;
264
-
265
- /**
266
- * Must be 'function' to identify this as a function call.
267
- */
268
- type: 'function';
269
- }
270
-
271
- export namespace ToolCall {
272
- /**
273
- * Function call details.
274
- */
275
- export interface Function {
276
- /**
277
- * Arguments to pass to the function as a JSON string.
278
- */
279
- arguments: string;
280
-
281
- /**
282
- * Name of the function to call.
283
- */
284
- name: string;
285
- }
286
- }
287
- }
288
-
289
- /**
290
- * A message representing the result of a tool invocation in an OpenAI-compatible
291
- * chat completion request.
292
- */
293
- export interface OpenAIToolMessageParam {
294
- /**
295
- * The response content from the tool.
296
- */
297
- content: string | Array<OpenAIToolMessageParam.ListOpenAIChatCompletionContentPartTextParam>;
298
-
299
- /**
300
- * Unique identifier for the tool call this response is for.
301
- */
302
- tool_call_id: string;
303
-
304
- /**
305
- * Must be 'tool' to identify this as a tool response.
306
- */
307
- role?: 'tool';
308
- }
309
-
310
- export namespace OpenAIToolMessageParam {
311
- /**
312
- * Text content part for OpenAI-compatible chat completion messages.
313
- */
314
- export interface ListOpenAIChatCompletionContentPartTextParam {
315
- /**
316
- * The text content of the message.
317
- */
318
- text: string;
319
-
320
- /**
321
- * Must be 'text' to identify this as text content.
322
- */
323
- type?: 'text';
324
- }
325
- }
326
-
327
- /**
328
- * A message from the developer in an OpenAI-compatible chat completion request.
329
- */
330
- export interface OpenAIDeveloperMessageParam {
331
- /**
332
- * The content of the developer message.
333
- */
334
- content: string | Array<OpenAIDeveloperMessageParam.ListOpenAIChatCompletionContentPartTextParam>;
335
-
336
- /**
337
- * The name of the developer message participant.
338
- */
339
- name?: string | null;
340
-
341
- /**
342
- * Must be 'developer' to identify this as a developer message.
343
- */
344
- role?: 'developer';
345
- }
346
-
347
- export namespace OpenAIDeveloperMessageParam {
348
- /**
349
- * Text content part for OpenAI-compatible chat completion messages.
350
- */
351
- export interface ListOpenAIChatCompletionContentPartTextParam {
352
- /**
353
- * The text content of the message.
354
- */
355
- text: string;
356
-
357
- /**
358
- * Must be 'text' to identify this as text content.
359
- */
360
- type?: 'text';
361
- }
362
- }
363
- }
364
-
365
- export declare namespace Safety {
366
- export { type RunShieldResponse as RunShieldResponse, type SafetyRunShieldParams as SafetyRunShieldParams };
367
- }