Skip to content
This repository was archived by the owner on Aug 14, 2025. It is now read-only.

Commit 26b572d

Browse files
feat(api): update via SDK Studio
1 parent 8a48a6f commit 26b572d

File tree

7 files changed

+138
-34
lines changed

7 files changed

+138
-34
lines changed

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 106
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-ab9c9bf2527d3b4179e2bc3e6495c64d43c42b2ea8dc1a55d472986e1a1430a0.yml
3-
openapi_spec_hash: b93c85fb747e3c29134451d2f364ce8b
4-
config_hash: b105ed4704c2998287916138c03d211a
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-fe0ae8a478adcaa69c96b9ee501073818e499700ce2ec66dd7f6eaf4c3fcf69c.yml
3+
openapi_spec_hash: 418d4a00c4676bbb2973b64a93484965
4+
config_hash: e6c3e48e220b264936ee6df8b996ab12

api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,12 +407,12 @@ Methods:
407407

408408
Types:
409409

410-
- <code><a href="./src/resources/safety.ts">OpenAIModerationsResponse</a></code>
410+
- <code><a href="./src/resources/safety.ts">CreateResponse</a></code>
411411
- <code><a href="./src/resources/safety.ts">RunShieldResponse</a></code>
412412

413413
Methods:
414414

415-
- <code title="post /v1/openai/v1/moderations">client.safety.<a href="./src/resources/safety.ts">openaiModerations</a>({ ...params }) -> OpenAIModerationsResponse</code>
415+
- <code title="post /v1/openai/v1/moderations">client.safety.<a href="./src/resources/safety.ts">create</a>({ ...params }) -> CreateResponse</code>
416416
- <code title="post /v1/safety/run-shield">client.safety.<a href="./src/resources/safety.ts">runShield</a>({ ...params }) -> RunShieldResponse</code>
417417

418418
# Shields

src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ import {
7171
import { ListProvidersResponse, ProviderListResponse, Providers } from './resources/providers';
7272
import { ListRoutesResponse, RouteListResponse, Routes } from './resources/routes';
7373
import {
74-
OpenAIModerationsResponse,
74+
CreateResponse,
7575
RunShieldResponse,
7676
Safety,
77-
SafetyOpenAIModerationsParams,
77+
SafetyCreateParams,
7878
SafetyRunShieldParams,
7979
} from './resources/safety';
8080
import {
@@ -605,9 +605,9 @@ export declare namespace LlamaStackClient {
605605

606606
export {
607607
Safety as Safety,
608-
type OpenAIModerationsResponse as OpenAIModerationsResponse,
608+
type CreateResponse as CreateResponse,
609609
type RunShieldResponse as RunShieldResponse,
610-
type SafetyOpenAIModerationsParams as SafetyOpenAIModerationsParams,
610+
type SafetyCreateParams as SafetyCreateParams,
611611
type SafetyRunShieldParams as SafetyRunShieldParams,
612612
};
613613

src/resources/chat/completions.ts

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ export namespace CompletionCreateResponse {
141141
| Array<
142142
| OpenAIUserMessageParam.OpenAIChatCompletionContentPartTextParam
143143
| OpenAIUserMessageParam.OpenAIChatCompletionContentPartImageParam
144+
| OpenAIUserMessageParam.OpenAIFile
144145
>;
145146

146147
/**
@@ -174,6 +175,22 @@ export namespace CompletionCreateResponse {
174175
detail?: string;
175176
}
176177
}
178+
179+
export interface OpenAIFile {
180+
file: OpenAIFile.File;
181+
182+
type: 'file';
183+
}
184+
185+
export namespace OpenAIFile {
186+
export interface File {
187+
file_data?: string;
188+
189+
file_id?: string;
190+
191+
filename?: string;
192+
}
193+
}
177194
}
178195

179196
/**
@@ -470,6 +487,7 @@ export namespace CompletionRetrieveResponse {
470487
| Array<
471488
| OpenAIUserMessageParam.OpenAIChatCompletionContentPartTextParam
472489
| OpenAIUserMessageParam.OpenAIChatCompletionContentPartImageParam
490+
| OpenAIUserMessageParam.OpenAIFile
473491
>;
474492

475493
/**
@@ -503,6 +521,22 @@ export namespace CompletionRetrieveResponse {
503521
detail?: string;
504522
}
505523
}
524+
525+
export interface OpenAIFile {
526+
file: OpenAIFile.File;
527+
528+
type: 'file';
529+
}
530+
531+
export namespace OpenAIFile {
532+
export interface File {
533+
file_data?: string;
534+
535+
file_id?: string;
536+
537+
filename?: string;
538+
}
539+
}
506540
}
507541

508542
/**
@@ -730,6 +764,7 @@ export namespace CompletionRetrieveResponse {
730764
| Array<
731765
| OpenAIUserMessageParam.OpenAIChatCompletionContentPartTextParam
732766
| OpenAIUserMessageParam.OpenAIChatCompletionContentPartImageParam
767+
| OpenAIUserMessageParam.OpenAIFile
733768
>;
734769

735770
/**
@@ -763,6 +798,22 @@ export namespace CompletionRetrieveResponse {
763798
detail?: string;
764799
}
765800
}
801+
802+
export interface OpenAIFile {
803+
file: OpenAIFile.File;
804+
805+
type: 'file';
806+
}
807+
808+
export namespace OpenAIFile {
809+
export interface File {
810+
file_data?: string;
811+
812+
file_id?: string;
813+
814+
filename?: string;
815+
}
816+
}
766817
}
767818

768819
/**
@@ -997,6 +1048,7 @@ export namespace CompletionListResponse {
9971048
| Array<
9981049
| OpenAIUserMessageParam.OpenAIChatCompletionContentPartTextParam
9991050
| OpenAIUserMessageParam.OpenAIChatCompletionContentPartImageParam
1051+
| OpenAIUserMessageParam.OpenAIFile
10001052
>;
10011053

10021054
/**
@@ -1030,6 +1082,22 @@ export namespace CompletionListResponse {
10301082
detail?: string;
10311083
}
10321084
}
1085+
1086+
export interface OpenAIFile {
1087+
file: OpenAIFile.File;
1088+
1089+
type: 'file';
1090+
}
1091+
1092+
export namespace OpenAIFile {
1093+
export interface File {
1094+
file_data?: string;
1095+
1096+
file_id?: string;
1097+
1098+
filename?: string;
1099+
}
1100+
}
10331101
}
10341102

10351103
/**
@@ -1257,6 +1325,7 @@ export namespace CompletionListResponse {
12571325
| Array<
12581326
| OpenAIUserMessageParam.OpenAIChatCompletionContentPartTextParam
12591327
| OpenAIUserMessageParam.OpenAIChatCompletionContentPartImageParam
1328+
| OpenAIUserMessageParam.OpenAIFile
12601329
>;
12611330

12621331
/**
@@ -1290,6 +1359,22 @@ export namespace CompletionListResponse {
12901359
detail?: string;
12911360
}
12921361
}
1362+
1363+
export interface OpenAIFile {
1364+
file: OpenAIFile.File;
1365+
1366+
type: 'file';
1367+
}
1368+
1369+
export namespace OpenAIFile {
1370+
export interface File {
1371+
file_data?: string;
1372+
1373+
file_id?: string;
1374+
1375+
filename?: string;
1376+
}
1377+
}
12931378
}
12941379

12951380
/**
@@ -1575,6 +1660,7 @@ export namespace CompletionCreateParams {
15751660
| Array<
15761661
| OpenAIUserMessageParam.OpenAIChatCompletionContentPartTextParam
15771662
| OpenAIUserMessageParam.OpenAIChatCompletionContentPartImageParam
1663+
| OpenAIUserMessageParam.OpenAIFile
15781664
>;
15791665

15801666
/**
@@ -1608,6 +1694,22 @@ export namespace CompletionCreateParams {
16081694
detail?: string;
16091695
}
16101696
}
1697+
1698+
export interface OpenAIFile {
1699+
file: OpenAIFile.File;
1700+
1701+
type: 'file';
1702+
}
1703+
1704+
export namespace OpenAIFile {
1705+
export interface File {
1706+
file_data?: string;
1707+
1708+
file_id?: string;
1709+
1710+
filename?: string;
1711+
}
1712+
}
16111713
}
16121714

16131715
/**

src/resources/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ export {
108108
export { Routes, type ListRoutesResponse, type RouteListResponse } from './routes';
109109
export {
110110
Safety,
111-
type OpenAIModerationsResponse,
111+
type CreateResponse,
112112
type RunShieldResponse,
113-
type SafetyOpenAIModerationsParams,
113+
type SafetyCreateParams,
114114
type SafetyRunShieldParams,
115115
} from './safety';
116116
export {

src/resources/safety.ts

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@ export class Safety extends APIResource {
88
/**
99
* Classifies if text and/or image inputs are potentially harmful.
1010
*/
11-
openaiModerations(
12-
body: SafetyOpenAIModerationsParams,
13-
options?: Core.RequestOptions,
14-
): Core.APIPromise<OpenAIModerationsResponse> {
11+
create(body: SafetyCreateParams, options?: Core.RequestOptions): Core.APIPromise<CreateResponse> {
1512
return this._client.post('/v1/openai/v1/moderations', { body, ...options });
1613
}
1714

@@ -26,7 +23,7 @@ export class Safety extends APIResource {
2623
/**
2724
* A moderation object.
2825
*/
29-
export interface OpenAIModerationsResponse {
26+
export interface CreateResponse {
3027
/**
3128
* The unique identifier for the moderation request.
3229
*/
@@ -40,40 +37,45 @@ export interface OpenAIModerationsResponse {
4037
/**
4138
* A list of moderation objects
4239
*/
43-
results: Array<OpenAIModerationsResponse.Result>;
40+
results: Array<CreateResponse.Result>;
4441
}
4542

46-
export namespace OpenAIModerationsResponse {
43+
export namespace CreateResponse {
4744
/**
4845
* A moderation object.
4946
*/
5047
export interface Result {
5148
/**
52-
* A list of the categories, and whether they are flagged or not.
49+
* Whether any of the below categories are flagged.
5350
*/
54-
categories: { [key: string]: boolean };
51+
flagged: boolean;
5552

56-
category_applied_input_types: { [key: string]: Array<string> };
53+
metadata: { [key: string]: boolean | number | string | Array<unknown> | unknown | null };
5754

58-
category_messages: { [key: string]: string };
55+
/**
56+
* A list of the categories, and whether they are flagged or not.
57+
*/
58+
categories?: { [key: string]: boolean };
5959

6060
/**
61-
* A list of the categories along with their scores as predicted by model.
61+
* A list of the categories along with the input type(s) that the score applies to.
6262
*/
63-
category_scores: { [key: string]: number };
63+
category_applied_input_types?: { [key: string]: Array<string> };
6464

6565
/**
66-
* Whether any of the below categories are flagged.
66+
* A list of the categories along with their scores as predicted by model.
6767
*/
68-
flagged: boolean;
68+
category_scores?: { [key: string]: number };
69+
70+
user_message?: string;
6971
}
7072
}
7173

7274
export interface RunShieldResponse {
7375
violation?: Shared.SafetyViolation;
7476
}
7577

76-
export interface SafetyOpenAIModerationsParams {
78+
export interface SafetyCreateParams {
7779
/**
7880
* Input (or inputs) to classify. Can be a single string, an array of strings, or
7981
* an array of multi-modal input objects similar to other models.
@@ -83,7 +85,7 @@ export interface SafetyOpenAIModerationsParams {
8385
/**
8486
* The content moderation model you would like to use.
8587
*/
86-
model?: string;
88+
model: string;
8789
}
8890

8991
export interface SafetyRunShieldParams {
@@ -105,9 +107,9 @@ export interface SafetyRunShieldParams {
105107

106108
export declare namespace Safety {
107109
export {
108-
type OpenAIModerationsResponse as OpenAIModerationsResponse,
110+
type CreateResponse as CreateResponse,
109111
type RunShieldResponse as RunShieldResponse,
110-
type SafetyOpenAIModerationsParams as SafetyOpenAIModerationsParams,
112+
type SafetyCreateParams as SafetyCreateParams,
111113
type SafetyRunShieldParams as SafetyRunShieldParams,
112114
};
113115
}

tests/api-resources/safety.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import { Response } from 'node-fetch';
66
const client = new LlamaStackClient({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' });
77

88
describe('resource safety', () => {
9-
test('openaiModerations: only required params', async () => {
10-
const responsePromise = client.safety.openaiModerations({ input: 'string' });
9+
test('create: only required params', async () => {
10+
const responsePromise = client.safety.create({ input: 'string', model: 'model' });
1111
const rawResponse = await responsePromise.asResponse();
1212
expect(rawResponse).toBeInstanceOf(Response);
1313
const response = await responsePromise;
@@ -17,8 +17,8 @@ describe('resource safety', () => {
1717
expect(dataAndResponse.response).toBe(rawResponse);
1818
});
1919

20-
test('openaiModerations: required and optional params', async () => {
21-
const response = await client.safety.openaiModerations({ input: 'string', model: 'model' });
20+
test('create: required and optional params', async () => {
21+
const response = await client.safety.create({ input: 'string', model: 'model' });
2222
});
2323

2424
test('runShield: only required params', async () => {

0 commit comments

Comments
 (0)