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.
- package/.github/workflows/release-doctor.yml +0 -2
- package/.release-please-manifest.json +1 -1
- package/.stats.yml +4 -4
- package/CHANGELOG.md +27 -0
- package/CONTRIBUTING.md +0 -14
- package/README.md +5 -4
- package/api.md +26 -48
- package/bin/check-release-environment +0 -4
- package/dist/CHANGELOG.md +27 -0
- package/dist/README.md +5 -4
- package/dist/index.d.mts +2 -18
- package/dist/index.d.ts +2 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -16
- package/dist/index.mjs.map +1 -1
- package/dist/package.json +1 -1
- package/dist/resources/chat/chat.d.ts +2 -2
- package/dist/resources/chat/chat.d.ts.map +1 -1
- package/dist/resources/chat/chat.js +2 -2
- package/dist/resources/chat/chat.js.map +1 -1
- package/dist/resources/chat/chat.mjs +2 -2
- package/dist/resources/chat/completions/completions.d.ts +2021 -0
- package/dist/resources/chat/completions/completions.d.ts.map +1 -0
- package/dist/resources/chat/completions/completions.js +70 -0
- package/dist/resources/chat/completions/completions.js.map +1 -0
- package/dist/resources/chat/completions/completions.mjs +43 -0
- package/dist/resources/chat/completions/completions.mjs.map +1 -0
- package/dist/resources/chat/completions/index.d.ts +3 -0
- package/dist/resources/chat/completions/index.d.ts.map +1 -0
- package/dist/resources/chat/completions/index.js +16 -0
- package/dist/resources/chat/completions/index.js.map +1 -0
- package/dist/resources/chat/completions/index.mjs +10 -0
- package/dist/resources/chat/completions/index.mjs.map +1 -0
- package/dist/resources/chat/completions/messages.d.ts +204 -0
- package/dist/resources/chat/completions/messages.d.ts.map +1 -0
- package/dist/resources/chat/completions/messages.js +35 -0
- package/dist/resources/chat/completions/messages.js.map +1 -0
- package/dist/resources/chat/completions/messages.mjs +30 -0
- package/dist/resources/chat/completions/messages.mjs.map +1 -0
- package/dist/resources/chat/completions.d.ts +1 -2020
- package/dist/resources/chat/completions.d.ts.map +1 -1
- package/dist/resources/chat/completions.js +15 -29
- package/dist/resources/chat/completions.js.map +1 -1
- package/dist/resources/chat/completions.mjs +1 -27
- package/dist/resources/chat/completions.mjs.map +1 -1
- package/dist/resources/chat/index.d.ts +1 -1
- package/dist/resources/chat/index.d.ts.map +1 -1
- package/dist/resources/chat/index.js +2 -2
- package/dist/resources/chat/index.js.map +1 -1
- package/dist/resources/chat/index.mjs +1 -1
- package/dist/resources/completions.d.ts +2 -2
- package/dist/resources/completions.d.ts.map +1 -1
- package/dist/resources/conversations/conversations.d.ts +12 -11
- package/dist/resources/conversations/conversations.d.ts.map +1 -1
- package/dist/resources/conversations/conversations.js.map +1 -1
- package/dist/resources/conversations/conversations.mjs.map +1 -1
- package/dist/resources/conversations/index.d.ts +1 -1
- package/dist/resources/conversations/index.d.ts.map +1 -1
- package/dist/resources/conversations/items.d.ts +49 -29
- package/dist/resources/conversations/items.d.ts.map +1 -1
- package/dist/resources/conversations/items.js +5 -5
- package/dist/resources/conversations/items.js.map +1 -1
- package/dist/resources/conversations/items.mjs +5 -5
- package/dist/resources/conversations/items.mjs.map +1 -1
- package/dist/resources/files.d.ts +10 -10
- package/dist/resources/files.d.ts.map +1 -1
- package/dist/resources/files.js.map +1 -1
- package/dist/resources/files.mjs.map +1 -1
- package/dist/resources/index.d.ts +1 -4
- package/dist/resources/index.d.ts.map +1 -1
- package/dist/resources/index.js +1 -7
- package/dist/resources/index.js.map +1 -1
- package/dist/resources/index.mjs +1 -4
- package/dist/resources/index.mjs.map +1 -1
- package/dist/resources/models/index.d.ts +2 -2
- package/dist/resources/models/index.d.ts.map +1 -1
- package/dist/resources/models/index.js.map +1 -1
- package/dist/resources/models/index.mjs +1 -1
- package/dist/resources/models/index.mjs.map +1 -1
- package/dist/resources/models/models.d.ts +220 -32
- package/dist/resources/models/models.d.ts.map +1 -1
- package/dist/resources/models/models.js +32 -10
- package/dist/resources/models/models.js.map +1 -1
- package/dist/resources/models/models.mjs +32 -10
- package/dist/resources/models/models.mjs.map +1 -1
- package/dist/resources/models/openai.d.ts +128 -2
- package/dist/resources/models/openai.d.ts.map +1 -1
- package/dist/resources/models/openai.js +17 -5
- package/dist/resources/models/openai.js.map +1 -1
- package/dist/resources/models/openai.mjs +17 -5
- package/dist/resources/models/openai.mjs.map +1 -1
- package/dist/resources/responses/responses.d.ts +0 -16
- package/dist/resources/responses/responses.d.ts.map +1 -1
- package/dist/resources/responses/responses.js.map +1 -1
- package/dist/resources/responses/responses.mjs.map +1 -1
- package/dist/resources/shared.d.ts +0 -19
- package/dist/resources/shared.d.ts.map +1 -1
- package/dist/src/index.ts +12 -43
- package/dist/src/resources/chat/chat.ts +2 -2
- package/dist/src/resources/chat/completions/completions.ts +2444 -0
- package/dist/src/resources/chat/completions/index.ts +24 -0
- package/dist/src/resources/chat/completions/messages.ts +273 -0
- package/dist/src/resources/chat/completions.ts +1 -2422
- package/dist/src/resources/chat/index.ts +1 -1
- package/dist/src/resources/completions.ts +2 -2
- package/dist/src/resources/conversations/conversations.ts +15 -9
- package/dist/src/resources/conversations/index.ts +1 -1
- package/dist/src/resources/conversations/items.ts +84 -28
- package/dist/src/resources/files.ts +29 -10
- package/dist/src/resources/index.ts +9 -10
- package/dist/src/resources/models/index.ts +10 -2
- package/dist/src/resources/models/models.ts +321 -32
- package/dist/src/resources/models/openai.ts +180 -3
- package/dist/src/resources/responses/responses.ts +0 -21
- package/dist/src/resources/shared.ts +0 -20
- package/dist/src/version.ts +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.mjs +1 -1
- package/package.json +1 -1
- package/src/index.ts +12 -43
- package/src/resources/chat/chat.ts +2 -2
- package/src/resources/chat/completions/completions.ts +2444 -0
- package/src/resources/chat/completions/index.ts +24 -0
- package/src/resources/chat/completions/messages.ts +273 -0
- package/src/resources/chat/completions.ts +1 -2422
- package/src/resources/chat/index.ts +1 -1
- package/src/resources/completions.ts +2 -2
- package/src/resources/conversations/conversations.ts +15 -9
- package/src/resources/conversations/index.ts +1 -1
- package/src/resources/conversations/items.ts +84 -28
- package/src/resources/files.ts +29 -10
- package/src/resources/index.ts +9 -10
- package/src/resources/models/index.ts +10 -2
- package/src/resources/models/models.ts +321 -32
- package/src/resources/models/openai.ts +180 -3
- package/src/resources/responses/responses.ts +0 -21
- package/src/resources/shared.ts +0 -20
- package/src/version.ts +1 -1
- package/tests/api-resources/chat/{completions.test.ts → completions/completions.test.ts} +0 -1
- package/tests/api-resources/chat/completions/messages.test.ts +47 -0
- package/tests/api-resources/completions.test.ts +1 -1
- package/tests/api-resources/conversations/items.test.ts +12 -0
- package/tests/api-resources/models/models.test.ts +34 -0
- package/tests/api-resources/models/openai.test.ts +18 -0
- package/tests/api-resources/responses/responses.test.ts +0 -2
- package/.github/workflows/publish-npm.yml +0 -32
- package/dist/resources/moderations.d.ts +0 -83
- package/dist/resources/moderations.d.ts.map +0 -1
- package/dist/resources/moderations.js +0 -24
- package/dist/resources/moderations.js.map +0 -1
- package/dist/resources/moderations.mjs +0 -20
- package/dist/resources/moderations.mjs.map +0 -1
- package/dist/resources/safety.d.ts +0 -297
- package/dist/resources/safety.d.ts.map +0 -1
- package/dist/resources/safety.js +0 -24
- package/dist/resources/safety.js.map +0 -1
- package/dist/resources/safety.mjs +0 -20
- package/dist/resources/safety.mjs.map +0 -1
- package/dist/resources/shields.d.ts +0 -82
- package/dist/resources/shields.d.ts.map +0 -1
- package/dist/resources/shields.js +0 -46
- package/dist/resources/shields.js.map +0 -1
- package/dist/resources/shields.mjs +0 -42
- package/dist/resources/shields.mjs.map +0 -1
- package/dist/src/resources/moderations.ts +0 -97
- package/dist/src/resources/safety.ts +0 -367
- package/dist/src/resources/shields.ts +0 -119
- package/src/resources/moderations.ts +0 -97
- package/src/resources/safety.ts +0 -367
- package/src/resources/shields.ts +0 -119
- package/tests/api-resources/moderations.test.ts +0 -29
- package/tests/api-resources/safety.test.ts +0 -41
- package/tests/api-resources/shields.test.ts +0 -88
|
@@ -1,29 +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 OgxClient from 'ogx-client';
|
|
10
|
-
import { Response } from 'node-fetch';
|
|
11
|
-
|
|
12
|
-
const client = new OgxClient({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' });
|
|
13
|
-
|
|
14
|
-
describe('resource moderations', () => {
|
|
15
|
-
test('create: only required params', async () => {
|
|
16
|
-
const responsePromise = client.moderations.create({ input: 'string' });
|
|
17
|
-
const rawResponse = await responsePromise.asResponse();
|
|
18
|
-
expect(rawResponse).toBeInstanceOf(Response);
|
|
19
|
-
const response = await responsePromise;
|
|
20
|
-
expect(response).not.toBeInstanceOf(Response);
|
|
21
|
-
const dataAndResponse = await responsePromise.withResponse();
|
|
22
|
-
expect(dataAndResponse.data).toBe(response);
|
|
23
|
-
expect(dataAndResponse.response).toBe(rawResponse);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
test('create: required and optional params', async () => {
|
|
27
|
-
const response = await client.moderations.create({ input: 'string', model: 'model' });
|
|
28
|
-
});
|
|
29
|
-
});
|
|
@@ -1,41 +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 OgxClient from 'ogx-client';
|
|
10
|
-
import { Response } from 'node-fetch';
|
|
11
|
-
|
|
12
|
-
const client = new OgxClient({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' });
|
|
13
|
-
|
|
14
|
-
describe('resource safety', () => {
|
|
15
|
-
test('runShield: only required params', async () => {
|
|
16
|
-
const responsePromise = client.safety.runShield({
|
|
17
|
-
messages: [{ content: 'string', role: 'user' }],
|
|
18
|
-
shield_id: 'x',
|
|
19
|
-
});
|
|
20
|
-
const rawResponse = await responsePromise.asResponse();
|
|
21
|
-
expect(rawResponse).toBeInstanceOf(Response);
|
|
22
|
-
const response = await responsePromise;
|
|
23
|
-
expect(response).not.toBeInstanceOf(Response);
|
|
24
|
-
const dataAndResponse = await responsePromise.withResponse();
|
|
25
|
-
expect(dataAndResponse.data).toBe(response);
|
|
26
|
-
expect(dataAndResponse.response).toBe(rawResponse);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
test('runShield: required and optional params', async () => {
|
|
30
|
-
const response = await client.safety.runShield({
|
|
31
|
-
messages: [
|
|
32
|
-
{
|
|
33
|
-
content: 'string',
|
|
34
|
-
name: 'name',
|
|
35
|
-
role: 'user',
|
|
36
|
-
},
|
|
37
|
-
],
|
|
38
|
-
shield_id: 'x',
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
});
|
|
@@ -1,88 +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 OgxClient from 'ogx-client';
|
|
10
|
-
import { Response } from 'node-fetch';
|
|
11
|
-
|
|
12
|
-
const client = new OgxClient({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' });
|
|
13
|
-
|
|
14
|
-
describe('resource shields', () => {
|
|
15
|
-
test('retrieve', async () => {
|
|
16
|
-
const responsePromise = client.shields.retrieve('identifier');
|
|
17
|
-
const rawResponse = await responsePromise.asResponse();
|
|
18
|
-
expect(rawResponse).toBeInstanceOf(Response);
|
|
19
|
-
const response = await responsePromise;
|
|
20
|
-
expect(response).not.toBeInstanceOf(Response);
|
|
21
|
-
const dataAndResponse = await responsePromise.withResponse();
|
|
22
|
-
expect(dataAndResponse.data).toBe(response);
|
|
23
|
-
expect(dataAndResponse.response).toBe(rawResponse);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
test('retrieve: request options instead of params are passed correctly', async () => {
|
|
27
|
-
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
|
|
28
|
-
await expect(client.shields.retrieve('identifier', { path: '/_stainless_unknown_path' })).rejects.toThrow(
|
|
29
|
-
OgxClient.NotFoundError,
|
|
30
|
-
);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
test('list', async () => {
|
|
34
|
-
const responsePromise = client.shields.list();
|
|
35
|
-
const rawResponse = await responsePromise.asResponse();
|
|
36
|
-
expect(rawResponse).toBeInstanceOf(Response);
|
|
37
|
-
const response = await responsePromise;
|
|
38
|
-
expect(response).not.toBeInstanceOf(Response);
|
|
39
|
-
const dataAndResponse = await responsePromise.withResponse();
|
|
40
|
-
expect(dataAndResponse.data).toBe(response);
|
|
41
|
-
expect(dataAndResponse.response).toBe(rawResponse);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
test('list: request options instead of params are passed correctly', async () => {
|
|
45
|
-
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
|
|
46
|
-
await expect(client.shields.list({ path: '/_stainless_unknown_path' })).rejects.toThrow(
|
|
47
|
-
OgxClient.NotFoundError,
|
|
48
|
-
);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
test('delete', async () => {
|
|
52
|
-
const responsePromise = client.shields.delete('identifier');
|
|
53
|
-
const rawResponse = await responsePromise.asResponse();
|
|
54
|
-
expect(rawResponse).toBeInstanceOf(Response);
|
|
55
|
-
const response = await responsePromise;
|
|
56
|
-
expect(response).not.toBeInstanceOf(Response);
|
|
57
|
-
const dataAndResponse = await responsePromise.withResponse();
|
|
58
|
-
expect(dataAndResponse.data).toBe(response);
|
|
59
|
-
expect(dataAndResponse.response).toBe(rawResponse);
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
test('delete: request options instead of params are passed correctly', async () => {
|
|
63
|
-
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
|
|
64
|
-
await expect(client.shields.delete('identifier', { path: '/_stainless_unknown_path' })).rejects.toThrow(
|
|
65
|
-
OgxClient.NotFoundError,
|
|
66
|
-
);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
test('register: only required params', async () => {
|
|
70
|
-
const responsePromise = client.shields.register({ shield_id: 'shield_id' });
|
|
71
|
-
const rawResponse = await responsePromise.asResponse();
|
|
72
|
-
expect(rawResponse).toBeInstanceOf(Response);
|
|
73
|
-
const response = await responsePromise;
|
|
74
|
-
expect(response).not.toBeInstanceOf(Response);
|
|
75
|
-
const dataAndResponse = await responsePromise.withResponse();
|
|
76
|
-
expect(dataAndResponse.data).toBe(response);
|
|
77
|
-
expect(dataAndResponse.response).toBe(rawResponse);
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
test('register: required and optional params', async () => {
|
|
81
|
-
const response = await client.shields.register({
|
|
82
|
-
shield_id: 'shield_id',
|
|
83
|
-
params: { foo: 'bar' },
|
|
84
|
-
provider_id: 'provider_id',
|
|
85
|
-
provider_shield_id: 'provider_shield_id',
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
});
|