Skip to content

Commit 015b932

Browse files
feat(api): OpenAPI spec update via Stainless API (#53)
1 parent 026f32b commit 015b932

File tree

3 files changed

+83
-57
lines changed

3 files changed

+83
-57
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 21
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/prompt-foundry%2Fprompt-foundry-sdk-d41bc488242c386f09b168a0bf060dba4a5e33e7a724fe5772e150bb62523028.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/prompt-foundry%2Fprompt-foundry-sdk-5099b2b6ce467e4cae4520a778d3149d96ddf1331960860509028e7e2ac4b3f7.yml

src/resources/evaluation-assertions.ts

Lines changed: 66 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -65,24 +65,30 @@ export interface EvaluationAssertion {
6565

6666
evaluationId: string;
6767

68-
matcher: EvaluationAssertion.Matcher;
68+
/**
69+
* A JSON path to use when matching the response. Only required when type is
70+
* `JSON_EXACT_MATCH` or `JSON_CONTAINS`.
71+
*/
72+
jsonPath: string | null;
6973

70-
target: string;
71-
}
74+
targetValue: string;
7275

73-
export namespace EvaluationAssertion {
74-
export interface Matcher {
75-
/**
76-
* A JSON path to use when matching the response. Only required when type is
77-
* `jsonPath`.
78-
*/
79-
jsonPath: string | null;
80-
81-
/**
82-
* The type of evaluation matcher to use.
83-
*/
84-
type: 'CONTAINS' | 'EQUALS' | 'JSON';
85-
}
76+
/**
77+
* The name of the tool to match. Only required when type is `TOOL_CALLED` or
78+
* `TOOL_CALLED_WITH`.
79+
*/
80+
toolName: string | null;
81+
82+
/**
83+
* The type of evaluation matcher to use.
84+
*/
85+
type:
86+
| 'EXACT_MATCH'
87+
| 'CONTAINS'
88+
| 'JSON_EXACT_MATCH'
89+
| 'JSON_CONTAINS'
90+
| 'TOOL_CALLED'
91+
| 'TOOL_CALLED_WITH';
8692
}
8793

8894
export type EvaluationAssertionListResponse = Array<EvaluationAssertion>;
@@ -94,47 +100,59 @@ export interface EvaluationAssertionDeleteResponse {
94100
export interface EvaluationAssertionCreateParams {
95101
evaluationId: string;
96102

97-
matcher: EvaluationAssertionCreateParams.Matcher;
103+
/**
104+
* A JSON path to use when matching the response. Only required when type is
105+
* `JSON_EXACT_MATCH` or `JSON_CONTAINS`.
106+
*/
107+
jsonPath: string | null;
98108

99-
target: string;
100-
}
109+
targetValue: string;
101110

102-
export namespace EvaluationAssertionCreateParams {
103-
export interface Matcher {
104-
/**
105-
* A JSON path to use when matching the response. Only required when type is
106-
* `jsonPath`.
107-
*/
108-
jsonPath: string | null;
109-
110-
/**
111-
* The type of evaluation matcher to use.
112-
*/
113-
type: 'CONTAINS' | 'EQUALS' | 'JSON';
114-
}
111+
/**
112+
* The name of the tool to match. Only required when type is `TOOL_CALLED` or
113+
* `TOOL_CALLED_WITH`.
114+
*/
115+
toolName: string | null;
116+
117+
/**
118+
* The type of evaluation matcher to use.
119+
*/
120+
type:
121+
| 'EXACT_MATCH'
122+
| 'CONTAINS'
123+
| 'JSON_EXACT_MATCH'
124+
| 'JSON_CONTAINS'
125+
| 'TOOL_CALLED'
126+
| 'TOOL_CALLED_WITH';
115127
}
116128

117129
export interface EvaluationAssertionUpdateParams {
118130
evaluationId: string;
119131

120-
matcher: EvaluationAssertionUpdateParams.Matcher;
132+
/**
133+
* A JSON path to use when matching the response. Only required when type is
134+
* `JSON_EXACT_MATCH` or `JSON_CONTAINS`.
135+
*/
136+
jsonPath: string | null;
121137

122-
target: string;
123-
}
138+
targetValue: string;
124139

125-
export namespace EvaluationAssertionUpdateParams {
126-
export interface Matcher {
127-
/**
128-
* A JSON path to use when matching the response. Only required when type is
129-
* `jsonPath`.
130-
*/
131-
jsonPath: string | null;
132-
133-
/**
134-
* The type of evaluation matcher to use.
135-
*/
136-
type: 'CONTAINS' | 'EQUALS' | 'JSON';
137-
}
140+
/**
141+
* The name of the tool to match. Only required when type is `TOOL_CALLED` or
142+
* `TOOL_CALLED_WITH`.
143+
*/
144+
toolName: string | null;
145+
146+
/**
147+
* The type of evaluation matcher to use.
148+
*/
149+
type:
150+
| 'EXACT_MATCH'
151+
| 'CONTAINS'
152+
| 'JSON_EXACT_MATCH'
153+
| 'JSON_CONTAINS'
154+
| 'TOOL_CALLED'
155+
| 'TOOL_CALLED_WITH';
138156
}
139157

140158
export interface EvaluationAssertionListParams {

tests/api-resources/evaluation-assertions.test.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ describe('resource evaluationAssertions', () => {
1212
test('create: only required params', async () => {
1313
const responsePromise = promptFoundry.evaluationAssertions.create({
1414
evaluationId: 'string',
15-
matcher: { type: 'CONTAINS', jsonPath: 'string' },
16-
target: 'string',
15+
jsonPath: 'string',
16+
targetValue: 'string',
17+
toolName: 'string',
18+
type: 'EXACT_MATCH',
1719
});
1820
const rawResponse = await responsePromise.asResponse();
1921
expect(rawResponse).toBeInstanceOf(Response);
@@ -27,16 +29,20 @@ describe('resource evaluationAssertions', () => {
2729
test('create: required and optional params', async () => {
2830
const response = await promptFoundry.evaluationAssertions.create({
2931
evaluationId: 'string',
30-
matcher: { type: 'CONTAINS', jsonPath: 'string' },
31-
target: 'string',
32+
jsonPath: 'string',
33+
targetValue: 'string',
34+
toolName: 'string',
35+
type: 'EXACT_MATCH',
3236
});
3337
});
3438

3539
test('update: only required params', async () => {
3640
const responsePromise = promptFoundry.evaluationAssertions.update('1212121', {
3741
evaluationId: 'string',
38-
matcher: { type: 'CONTAINS', jsonPath: 'string' },
39-
target: 'string',
42+
jsonPath: 'string',
43+
targetValue: 'string',
44+
toolName: 'string',
45+
type: 'EXACT_MATCH',
4046
});
4147
const rawResponse = await responsePromise.asResponse();
4248
expect(rawResponse).toBeInstanceOf(Response);
@@ -50,8 +56,10 @@ describe('resource evaluationAssertions', () => {
5056
test('update: required and optional params', async () => {
5157
const response = await promptFoundry.evaluationAssertions.update('1212121', {
5258
evaluationId: 'string',
53-
matcher: { type: 'CONTAINS', jsonPath: 'string' },
54-
target: 'string',
59+
jsonPath: 'string',
60+
targetValue: 'string',
61+
toolName: 'string',
62+
type: 'EXACT_MATCH',
5563
});
5664
});
5765

0 commit comments

Comments
 (0)